protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { tb_ConsignorService conSer = new tb_ConsignorService(); List <tb_Consignor> allCons = conSer.GetListArray(string.Format(" appPer={0}", Session["currentUserId"].ToString())); this.gvList.DataSource = allCons; this.gvList.DataBind(); string sql = string.Format(" consignor={0} and conState='开启'", Session["currentUserId"].ToString()); List <tb_Consignor> allCons_Bei = conSer.GetListArray(sql); this.GvBeiWei.DataSource = allCons_Bei; this.GvBeiWei.DataBind(); A_ProInfoService proSer = new A_ProInfoService(); List <A_ProInfo> pros = proSer.GetListArray(""); pros.Insert(0, new A_ProInfo()); ddlProType.DataSource = pros; ddlProType.DataBind(); DropDownList1.DataSource = pros; DropDownList1.DataBind(); ddlProType.DataTextField = "pro_Type"; ddlProType.DataValueField = "pro_Id"; DropDownList1.DataTextField = "pro_Type"; DropDownList1.DataValueField = "pro_Id"; } }
protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e) { tb_ConsignorService conSer = new tb_ConsignorService(); conSer.Delete(Convert.ToInt32(this.gvList.DataKeys[e.RowIndex].Value.ToString())); show(); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { VAN_OA.Dal.SysUserService userSer = new VAN_OA.Dal.SysUserService(); List <VAN_OA.Model.User> user = userSer.getAllUserByLoginName(""); ddlUser.DataSource = user; ddlUser.DataBind(); ddlUser.DataTextField = "LoginName"; ddlUser.DataValueField = "Id"; A_ProInfoService proSer = new A_ProInfoService(); List <A_ProInfo> pros = proSer.GetListArray(""); ddlProType.DataSource = pros; ddlProType.DataBind(); ddlProType.DataTextField = "pro_Type"; ddlProType.DataValueField = "pro_Id"; if (base.Request["ID"] != null) { cbAll.Visible = false; this.btnAdd.Visible = false; tb_ConsignorService conSer = new tb_ConsignorService(); tb_Consignor consi = conSer.GetListArray(" con_Id=" + base.Request["ID"])[0]; ddlProType.SelectedItem.Value = consi.proId.ToString(); if (consi.fromTime != null) { txtFrom.Text = Convert.ToDateTime(consi.fromTime).ToShortDateString(); } if (consi.toTime != null) { txtTo.Text = Convert.ToDateTime(consi.toTime).ToShortDateString(); } // txtconsignor.Text = consi.Consignor_Name; cbYouXiao.Checked = consi.ifYouXiao; ddlUser.Text = consi.consignor.ToString(); } else { this.btnUpdate.Visible = false; } } }
private void show2() { tb_ConsignorService conSer = new tb_ConsignorService(); string sql = string.Format(" consignor={0} and conState='开启'", Session["currentUserId"].ToString()); if (DropDownList1.SelectedItem.Text != "") { sql += " and proId=" + DropDownList1.SelectedItem.Value; } List <tb_Consignor> allCons_Bei = conSer.GetListArray(sql); this.GvBeiWei.DataSource = allCons_Bei; this.GvBeiWei.DataBind(); }
private void show() { if (this.ddlProType.SelectedItem.Text.Trim() != "") { tb_ConsignorService conSer = new tb_ConsignorService(); List <tb_Consignor> allCons = conSer.GetListArray(string.Format(" appPer={0} and proId={1}", Session["currentUserId"].ToString(), ddlProType.SelectedItem.Value)); this.gvList.DataSource = allCons; this.gvList.DataBind(); } else { tb_ConsignorService conSer = new tb_ConsignorService(); List <tb_Consignor> allCons = conSer.GetListArray(string.Format(" appPer={0}", Session["currentUserId"].ToString())); this.gvList.DataSource = allCons; this.gvList.DataBind(); } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (this.FormCheck()) { try { tb_Consignor conSer = new tb_Consignor(); conSer.appPer = Convert.ToInt32(Session["currentUserId"]); // string sql = string.Format("select id from tb_User where loginName='{0}'", ddlUser.SelectedItem.Value); int userId = Convert.ToInt32(ddlUser.SelectedItem.Value); conSer.consignor = userId; conSer.conState = "开启"; if (txtFrom.Text != "") { conSer.fromTime = Convert.ToDateTime(txtFrom.Text + " 00:00:00"); } if (txtTo.Text != "") { conSer.toTime = Convert.ToDateTime(txtTo.Text + " 23:59:59"); } conSer.proId = Convert.ToInt32(ddlProType.SelectedItem.Value); conSer.ifYouXiao = cbYouXiao.Checked; conSer.con_Id = Convert.ToInt32(Request["ID"]); tb_ConsignorService consiSer = new tb_ConsignorService(); consiSer.Update(conSer); base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改成功!');</script>"); } catch (Exception ex) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (this.FormCheck()) { try { tb_Consignor conSer = new tb_Consignor(); conSer.appPer = Convert.ToInt32(Session["currentUserId"]); // string sql = string.Format("select id from tb_User where loginName='{0}'",ddlUser.SelectedItem.Value); int userId = Convert.ToInt32(ddlUser.SelectedItem.Value); conSer.consignor = userId; conSer.conState = "开启"; if (txtFrom.Text != "") { conSer.fromTime = Convert.ToDateTime(txtFrom.Text + " 00:00:00"); } if (txtTo.Text != "") { conSer.toTime = Convert.ToDateTime(txtTo.Text + " 23:59:59"); } conSer.proId = Convert.ToInt32(ddlProType.SelectedItem.Value); conSer.ifYouXiao = cbYouXiao.Checked; tb_ConsignorService consiSer = new tb_ConsignorService(); if (cbAll.Checked == false) { if (consiSer.Add(conSer) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加成功!');</script>"); txtFrom.Text = ""; txtTo.Text = ""; cbYouXiao.Checked = false; // txtconsignor.Text = ""; ddlProType.Focus(); } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加失败!');</script>"); } } else { List <int> conList = new List <int>(); for (int i = 0; i < ddlProType.Items.Count; i++) { conList.Add(Convert.ToInt32(ddlProType.Items[i].Value)); } if (consiSer.AddSome(conSer, conList) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加成功!');</script>"); txtFrom.Text = ""; txtTo.Text = ""; cbYouXiao.Checked = false; //txtconsignor.Text = ""; ddlProType.Focus(); } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加失败!');</script>"); } } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>"); } } }