protected void Page_Load(object sender, EventArgs e) { try { warecell.UpdateCell(); if (!IsPostBack) { pager.PageSize = pageSize; if (Request.QueryString["BILLNO"] != null) { LoadBill(Request.QueryString["BILLNO"]); this.hdnOpFlag.Value = "1"; } else { this.lblMsg.Visible = true; this.txtBillNo.Text = billMaster.GetNewBillNo(); this.txtOperatePerson.Text = Session["EmployeeCode"].ToString(); this.txtEmployeeName.Text = Session["EmployeeName"].ToString(); this.txtBillDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); Warehouse objHouse = new Warehouse(); DataSet dsHouse = objHouse.QueryAllWarehouse(); DataRow[] rows = dsHouse.Tables[0].Select("WH_TYPE='0'"); if (rows.Length == 1) { this.txtWHCODE.Text = rows[0]["WH_CODE"].ToString(); this.txtWHNAME.Text = rows[0]["WH_NAME"].ToString(); } LoadDetail(); } ViewState["pageIndex"] = pageIndex; ViewState["totalCount"] = totalCount; } else { pageIndex = Convert.ToInt32(ViewState["pageIndex"]); totalCount = Convert.ToInt32(ViewState["totalCount"]); LoadDetail(); } } catch (Exception exp) { JScript.Instance.ShowMessage(this, exp.Message); } }
protected void btnCreateBill_Click(object sender, EventArgs e) { //JScript.Instance.ShowMessage(this, this.moveList.Items.Count.ToString()); string billNo = this.billNo.Value; if (this.billNo.Value == "") { billNo = billMaster.GetNewBillNo(); billMaster.BILLNO = billNo; billMaster.BILLDATE = System.DateTime.Now; billMaster.BILLTYPE = ""; billMaster.STATUS = "1"; billMaster.OPERATEPERSON = Session["EmployeeCode"].ToString(); billMaster.Insert(); } else { DataSet ds = billDetail.QueryByBillNo(billNo); for (int k = 0; k < ds.Tables[0].Rows.Count; k++) { ds.Tables[0].Rows[k].Delete(); } billDetail.Delete(ds); } for (int i = 0; i < moveList.Items.Count; i++) { billDetail.BILLNO = billNo; billDetail.OUT_CELLCODE = moveList.Items[i].Cells[0].Text; billDetail.PRODUCTCODE = moveList.Items[i].Cells[2].Text; billDetail.IN_CELLCODE = moveList.Items[i].Cells[4].Text; billDetail.UNITCODE = moveList.Items[i].Cells[6].Text; billDetail.QUANTITY = Convert.ToDecimal(moveList.Items[i].Cells[8].Text); billDetail.STATUS = "0"; billDetail.Insert(); } Response.Redirect("MoveBillEditPage.aspx?BILLNO=" + billNo); }