protected void Approval_Click(object sender, EventArgs e) { try { string NumberDelivery = TBDelivery.Text; int i = 0; int numcheck = 0; DBservices dbs = new DBservices(); Table TBL = new Table(); TBL = (Table)(Session["itemINoRDER"]); int num = TBL.Rows.Count; foreach (TableRow x in TBL.Rows) { if (TBL.Rows.GetRowIndex(x) != 0) { if (i < num - 1) { CheckBox itemBox = divOrder.FindControl("ChekBox" + i.ToString()) as CheckBox; i++; if (itemBox.Checked == true) { numcheck++; DBservices.AprroveItem(NumberOrder, x.Cells[2].Text); } } } } // string sup_date = ShippingDateCalendar.SelectedDate.ToShortDateString(); string sup_date = TBdate.Text; if (numcheck == count) { dbs.UpDateOrder(NumberOrder, "close", NumberDelivery, sup_date); } else { dbs.UpDateOrder(NumberOrder, "partially approved", NumberDelivery, sup_date); } Response.Redirect("OrderList.aspx", false); } catch (Exception ex) { ErrHandler.WriteError(ex.Message); Response.Write("ארעה שגיאה"); } }
protected void Approval_Click(object sender, EventArgs e) { try { if (TBDelivery.Text != string.Empty || TBdate.Text != string.Empty) { DBservices dbs = new DBservices(); string NumberDelivery = TBDelivery.Text; string workername = (string)(Session["Name"]); string workerPASS = (string)(Session["Password"]); string workerID = dbs.getWorkerID(workername, workerPASS); string branch = dbs.getWorkerBranch(workerID); int i = 0; int numcheck = 0; Table TBL = new Table(); TBL = (Table)(Session["itemINoRDER"]); int num = TBL.Rows.Count; foreach (TableRow x in TBL.Rows) { if (TBL.Rows.GetRowIndex(x) != 0) { if (i < num - 1) { CheckBox itemBox = divOrder.FindControl("ChekBox" + i.ToString()) as CheckBox; i++; if (itemBox.Checked == true) { numcheck++; DBservices.AprroveItem(NumberOrder, x.Cells[2].Text); int Quntity = (Convert.ToInt32(x.Cells[1].Text)); DBservices.UpDateStock(x.Cells[2].Text, branch, Quntity); } } } } // string sup_date = ShippingDateCalendar.SelectedDate.ToShortDateString(); string sup_date = TBdate.Text; if (numcheck == count) { dbs.UpDateOrder(NumberOrder, "close", NumberDelivery, sup_date); } else { dbs.UpDateOrder(NumberOrder, "partially approved", NumberDelivery, sup_date); } Response.Redirect("OrderList.aspx", false); } else { //Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('שדה תאריך או שדה מספר הזמנה אינו מלא')</SCRIPT>"); ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('שדה תאריך או שדה מספר הזמנה אינו מלא');", true); } } catch (Exception ex) { ErrHandler.WriteError(ex.Message); Response.Write("ארעה שגיאה"); } }