public partial class Admin_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
public string Filter
{
get
{
if (this.ViewState["filterExpression"] != null)
return (string)this.ViewState["filterExpression"];
return string.Empty;
}
set
{
this.ViewState["filterExpression"] = value;
}
}
protected void dvUser_DataBound(object sender, EventArgs e)
{
if (dvUser.CurrentMode == DetailsViewMode.ReadOnly)
{
if (dvUser.Rows.Count > 0)
{
Label lblSex = (Label)dvUser.FindControl("lblSex");
Label lblLevel = dvUser.FindControl("lblLevel") as Label;
DataRowView row = (DataRowView)this.dvUser.DataItem;
if (row["F_Sex"].ToString() == "0")
lblSex.Text = "男";
else
lblSex.Text = "女";
switch (row["F_Level"].ToString())
{
case "0":
lblLevel.Text = "普通会员";
break;
case "1":
lblLevel.Text = "银卡会员";
break;
case "2":
lblLevel.Text = "金卡会员";
break;
}
}
}
if (dvUser.CurrentMode == DetailsViewMode.Edit)
{
DropDownList ddlLevel = dvUser.FindControl("ddlLevel") as DropDownList;
DataRowView row = (DataRowView)this.dvUser.DataItem;
ddlLevel.SelectedValue = row["F_Level"].ToString();
}
}
protected void dvUser_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
{
}
protected void dvUser_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{
if (dvUser.CurrentMode == DetailsViewMode.Edit)
{
DropDownList ddlLevel = dvUser.FindControl("ddlLevel") as DropDownList;
TextBox TextBox1 = dvUser.FindControl("TextBox1") as TextBox;
//odUser.UpdateParameters["Level"].DefaultValue = ddlLevel.SelectedValue;
}
}
protected void odUser_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters["level"] = ((DropDownList)dvUser.FindControl("ddlLevel")).SelectedValue;
}
protected void odUser_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
gvUserCompany.DataSourceID = "ODUserCompany";
GetFilterExpression();
}
protected void dvCompany_DataBound(object sender, EventArgs e)
{
if (dvCompany.CurrentMode == DetailsViewMode.ReadOnly)
{
if (dvUser.Rows.Count > 0)
{
Label lblProPerty = dvCompany.FindControl("lblProPerty") as Label;
Label lblIsTop = dvCompany.FindControl("lblIsTop") as Label;
DataRowView row = this.dvCompany.DataItem as DataRowView;
if (row != null)
{
switch (row["F_ProPerty"].ToString())
{
case "1":
lblProPerty.Text = "企业单位";
break;
case "2":
lblProPerty.Text = "个体经营";
break;
case "3":
lblProPerty.Text = "事业单位或者社会团体";
break;
default:
break;
}
if (row["F_IsTop"].ToString() == "1")
lblIsTop.Text = "推荐企业";
else
lblIsTop.Text = "普通企业";
}
}
}
if (dvCompany.CurrentMode == DetailsViewMode.Edit)
{
DropDownList ddlIsTop = dvCompany.FindControl("ddlIsTop") as DropDownList;
DataRowView row = this.dvCompany.DataItem as DataRowView;
ddlIsTop.SelectedValue = row["F_IsTop"].ToString();
}
}
protected void odCompany_Updating(object sender, ObjectDataSourceMethodEventArgs e)
{
e.InputParameters["istop"] = ((DropDownList)dvCompany.FindControl("ddlIsTop")).SelectedValue;
}
protected void odCompany_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
gvUserCompany.DataSourceID = "ODUserCompany";
GetFilterExpression();
}
protected void gvUserCompany_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
}
protected void gvUserCompany_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
//{
//}
Label lblIsTop = e.Row.FindControl("lblIsTop") as Label;
Label lblLevel = e.Row.FindControl("lblLevel") as Label;
DataRowView gv = (DataRowView)e.Row.DataItem;
if (gv != null)
{
if (gv.Row["F_IsTop"].ToString() == "1")
lblIsTop.Text = "推荐企业";
else if (gv.Row["F_IsTop"].ToString() == "0")
lblIsTop.Text = "普通企业";
else
lblIsTop.Text = "";
/*
if (gv.Row["F_CheckStatus"].ToString()=="")
e.Row.Cells[9].Text = "";
*/
switch (gv.Row["F_UserLevel"].ToString())
{
case "0":
lblLevel.Text = "普通会员";
break;
case "1":
lblLevel.Text = "银卡会员";
break;
case "2":
lblLevel.Text = "金卡会员";
break;
}
}
}
}
protected void ODUserCompany_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
}
protected void GetFilterExpression()
{
if (ddlProvince.SelectedValue != "-1" && ddlProvince.SelectedValue != "0")
{
ODUserCompany.FilterExpression += " and F_ProvinceID=" + ddlProvince.SelectedValue;
}
if (ddlCity.SelectedValue != "-1" && ddlCity.SelectedValue != "0")
{
ODUserCompany.FilterExpression += " and F_CityID=" + ddlCity.SelectedValue;
}
if (ddlBigType.SelectedValue != "-1" && ddlBigType.SelectedValue != "0")
{
ODUserCompany.FilterExpression += " and F_IndustryID1=" + ddlBigType.SelectedValue;
}
if (ddlSmallType.SelectedValue != "-1" && ddlSmallType.SelectedValue != "0")
{
ODUserCompany.FilterExpression += " and F_IndustryID2=" + ddlSmallType.SelectedValue;
}
}
protected void ODUserCompany_Filtering(object sender, ObjectDataSourceFilteringEventArgs e)
{
}
protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
{
Comm.DataBind(Comm.Execute_strSql_Re_Ds("select F_ID,F_Name from T_City Where F_Province_ID=" + ddlProvince.SelectedValue), ddlCity, "F_Name", "F_ID", true);
GetFilterExpression();
}
protected void ddlBigType_SelectedIndexChanged(object sender, EventArgs e)
{
Comm.DataBind(Comm.Execute_strSql_Re_Ds("select F_ID,F_Name from T_IndustryCategory where F_ParentID="+ddlBigType.SelectedValue), ddlSmallType, "F_Name", "F_ID", true);
GetFilterExpression();
}
protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e)
{
GetFilterExpression();
}
protected void ddlSmallType_SelectedIndexChanged(object sender, EventArgs e)
{
GetFilterExpression();
}
protected void gvUserCompany_PageIndexChanged(object sender, EventArgs e)
{
GetFilterExpression();
}
}