private void BindData() { CW_InStockBU instock1 = new CW_InStockBU(); Hashtable ht = instock1.GetObjectByID(Request.QueryString["id"]); for (int i = 0; i < arr1.Length; i++) { Util.SetControlValue(this.bill.Parent.FindControl(arr1[i]), ht[arr1[i]]); } //调整票据时间显示 if (this.billtime.Text != "" && this.billtime.Text != null) { this.billtime.Text = DateTime.Parse(this.billtime.Text).ToString("yyyy-M-d"); } string bill = this.bill.Text; DataSet ds1 = instock1.GetInStockBill(bill); this.Repeater1.DataSource = ds1; this.Repeater1.DataBind(); instock1.Close(); if (ht["checktime"] != DBNull.Value) { this.Button1.Visible = false; this.Button2.Attributes["onclick"] = "history.go(-1);return false;"; } else { this.Button2.Attributes["onclick"] = "top.location.href='CheckShouKuanList.aspx';return false;"; } }
//保存支出单据 protected void SaveDataClick(object sender, EventArgs e) { this.SetDataSource(); Hashtable ht = new Hashtable(); string[] arr1 = new string[] { "bill", "billtime", "danwei", "zeren", "remark", "billmen" }; for (int i = 0; i < arr1.Length; i++) { ht.Add(arr1[i], Util.GetControlValue(this.billmen.Parent.FindControl(arr1[i]))); } ht.Add("zcid", Request.QueryString["zcid"]); DataSet ds = (DataSet)ViewState["DataSource"]; try { CW_InStockBU stock1 = new CW_InStockBU(); bool result = stock1.InsertData(ht, ds); stock1.Close(); if (result) { PubComm.ShowInfo("【增加入库单据】操作成功!", Application["root"] + "/Caiwu/ZcSearch.aspx"); } } catch { PubComm.ShowInfo("【增加入库单据】操作失败,可能的原因是单据编号重复,请重新输入!", Request.RawUrl); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string bill = this.GridView1.DataKeys[e.RowIndex].Value.ToString(); if (bill != "") { CW_InStockBU is1 = new CW_InStockBU(); is1.DelInStockDJ(bill); is1.Close(); this.BindData(); } }
//审核入库单 protected void SaveDataClick(object sender, EventArgs e) { CW_InStockBU instock1 = new CW_InStockBU(); bool check1 = instock1.CheckBill(Request.QueryString["id"], User.Identity.Name); instock1.Close(); if (check1) { PubComm.ShowInfo("提示:审核单据成功!", Application["root"] + "/Caiwu/CheckInStockList.aspx"); } else { PubComm.ShowInfo("提示:审核单据失败,请重新审核!", Request.RawUrl); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.billtime.Text = DateTime.Now.ToString("yyyy-M-d"); this.billmen.Text = User.Identity.Name; U_ZCBU zc1 = new U_ZCBU(); DataSet ds = zc1.GetDetailByID(Request.QueryString["zcid"], "danwei,zeren"); zc1.Close(); if (ds.Tables[0].Rows.Count > 0) { Util.SetControlValue(danwei, ds.Tables[0].Rows[0]["danwei"]); Util.SetControlValue(zeren, ds.Tables[0].Rows[0]["zeren"]); CW_InStockBU stock1 = new CW_InStockBU(); this.bill.Text = stock1.GetBillNum(); stock1.Close(); } this.BindData(); this.billtime.Attributes["onfocus"] = "setday(this)"; } }