namespace Main.CRM
{
/// <summary>
/// CostAdd 的摘要说明。
/// </summary>
public class CostAdd : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList Plist;
protected System.Web.UI.WebControls.DropDownList Clist;
protected System.Web.UI.WebControls.DropDownList Palist;
string StrConn =System.Configuration.ConfigurationSettings.AppSettings["Db"];
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection MyConn=new SqlConnection(StrConn);
MyConn.Open();
if(!this.IsPostBack)
{
//HttpContext.Current.Response.Cookies["DropCookies"]="";
string StrSql="select * from _List_Province order by OderId";
SqlCommand MyComm=new SqlCommand(StrSql,MyConn);
SqlDataReader MyDr=MyComm.ExecuteReader();
this.Plist.DataSource=MyDr;
this.Plist.DataTextField="Province";
this.Plist.DataValueField="Province";
this.Plist.DataBind();
MyDr.Close();
HttpContext.Current.Session["DropCookies"]="P";
string _Province="辽宁";
B2(_Province);
string _City="大连";
B3(_City);
}
}
public void B2(string _Province)
{
SqlConnection MyConn=new SqlConnection(StrConn);
MyConn.Open();
string StrSql2="select * from _List_City where Province='"+_Province+"' order by OderId";
SqlCommand MyComm2=new SqlCommand(StrSql2,MyConn);
SqlDataReader MyDr2=MyComm2.ExecuteReader();
this.Clist.DataSource=MyDr2;
this.Clist.DataTextField="City";
this.Clist.DataValueField="City";
this.Clist.DataBind();
MyDr2.Close();
}
public void B3(string _City)
{
string Company="";
object _Company=HttpContext.Current.Session["Company"];
if(!object.Equals(_Company,null))
{
Company=_Company.ToString();
}
else
{
Company="RSE";
}
string Administrators="";
object _Administrators=HttpContext.Current.Session["EmployeeId"];
if(!object.Equals(_Administrators,null))
{
Administrators=_Administrators.ToString();
}
else
{
Administrators="000";
}
SqlConnection MyConn=new SqlConnection(StrConn);
MyConn.Open();
string StrSql3="select * from Partner where City='"+_City+"' and Company like '%"+Company+"%'";
if(Administrators!="000")
{
StrSql3+="and Administrators like '%"+Administrators+"%'";
}
SqlCommand MyComm3=new SqlCommand(StrSql3,MyConn);
SqlDataReader MyDr3=MyComm3.ExecuteReader();
this.Palist.DataSource=MyDr3;
this.Palist.DataTextField="PartnerName";
this.Palist.DataValueField="PartnerNo";
this.Palist.DataBind();
HttpContext.Current.Session["DropCookies"]="p";
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Plist.SelectedIndexChanged += new System.EventHandler(this.Plist_SelectedIndexChanged);
this.Clist.SelectedIndexChanged += new System.EventHandler(this.Clist_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Plist_SelectedIndexChanged(object sender, System.EventArgs e)
{
HttpContext.Current.Session["DropCookies"]="P";
string _Province=this.Plist.SelectedValue;
B2(_Province);
string _City=this.Clist.SelectedValue;
B3(_City);
}
private void Clist_SelectedIndexChanged(object sender, System.EventArgs e)
{
HttpContext.Current.Session["DropCookies"]="p";
string _City=this.Clist.SelectedValue;
B3(_City);
}
}
}