protected void btn_order_cancel_Click(object sender, EventArgs e) { ModalPopupOrder.Hide(); }
protected void btn_Save_Click(object sender, EventArgs e) { if (Validation() != false && btn_Save.Text == "Add New Order") { string ordernumber = txt_OrderNumber.Text.ToString(); string Placedby = txt_Placedby.Text.ToUpper().ToString(); int ordertype = int.Parse(ddl_ordertype.SelectedValue.ToString()); int clientid = int.Parse(ddl_ClientName.SelectedValue.ToString()); string Customernumber = txt_ClientNumber.Text.ToUpper().ToString(); int subprocessid = int.Parse(ddl_SubProcess.SelectedValue.ToString()); string Subprocessnumber = txt_SubprocessNumber.Text.ToUpper().ToString(); string VendorName = txt_VendorName.Text.ToUpper().ToString(); string VendorNumber = txt_VendorNumber.Text.ToUpper().ToString(); string address = txt_Address.Text.ToUpper().ToString(); int zipcode = int.Parse(txt_ZipCode.Text.ToString()); string City = txt_City.Text.ToUpper().ToString(); int state = int.Parse(ddl_State.SelectedValue.ToString()); int county = int.Parse(ddl_County.SelectedValue.ToString()); string Similar = txt_Similar.Text.ToUpper().ToString(); string Barrowername = txt_Borrowername.Text.ToUpper().ToString(); string BarrowerName2 = txt_BorrowerName2.Text.ToUpper().ToString(); string effectivedate = txt_Effectivedate.Text.ToString(); string Lastdeed = txt_LastDeed.Text.ToString(); string Grantee = txt_Grantee.Text.ToString(); string APN = txt_APN.Text.ToUpper().ToString(); if (txt_TotalCost.Text != "") { Totalcost = Convert.ToDecimal(txt_TotalCost.Text.ToString()); } else { Totalcost = 0; } int OrderStatus = int.Parse(ddl_orderstatus.SelectedValue.ToString()); string Notes = txt_Notes.Text.ToUpper().ToString(); string Legal = txt_Legal.Text.ToUpper().ToString(); Hashtable htorder = new Hashtable(); DataTable dtorder = new DataTable(); DateTime date = new DateTime(); date = DateTime.Now; string dateeval = date.ToString("dd/MM/yyyy"); htorder.Add("@Trans", "INSERT"); htorder.Add("@Sub_ProcessId", subprocessid); htorder.Add("@Date", date); htorder.Add("@Order_Type", ordertype); htorder.Add("@Order_Number", ordernumber); htorder.Add("@Customer_Number", Customernumber); htorder.Add("@Vendor_Name", VendorName); htorder.Add("@Vendor_Number", VendorNumber); htorder.Add("@Order_Status", OrderStatus); htorder.Add("@Documents", ""); htorder.Add("@APN", APN); htorder.Add("@Address", address); htorder.Add("@City", City); htorder.Add("@State", state); htorder.Add("@Zip", zipcode); htorder.Add("@County", county); htorder.Add("@Borrower_Name", Barrowername); htorder.Add("@Borrower_Name2", BarrowerName2); htorder.Add("@Notes", Notes); htorder.Add("@Effective_date", effectivedate); htorder.Add("@Total_Cost", Totalcost); htorder.Add("@Grantee", Grantee); htorder.Add("@Legal", Legal); htorder.Add("@Last_Deed", Lastdeed); htorder.Add("@Paid", ""); htorder.Add("@Id", 0); htorder.Add("@Opened", date); htorder.Add("@Action_Date", date); htorder.Add("@Turn_Time", ""); htorder.Add("@Inserted_By", userid); htorder.Add("@Inserted_date", date); htorder.Add("@status", true); dtorder = dataaccess.ExecuteSP("Sp_Order", htorder); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Msg", "<script> alert('New Order Added Sucessfully')</script>", false); GridviewbindOrderdata(); ModalPopupOrder.Hide(); } else if (Validation() != false && btn_Save.Text == "Edit Order") { string ordernumber = txt_OrderNumber.Text.ToString(); string Placedby = txt_Placedby.Text.ToUpper().ToString(); int ordertype = int.Parse(ddl_ordertype.SelectedValue.ToString()); int clientid = int.Parse(ddl_ClientName.SelectedValue.ToString()); string Customernumber = txt_ClientNumber.Text.ToUpper().ToString(); int subprocessid = int.Parse(ddl_SubProcess.SelectedValue.ToString()); string Subprocessnumber = txt_SubprocessNumber.Text.ToUpper().ToString(); string VendorName = txt_VendorName.Text.ToUpper().ToString(); string VendorNumber = txt_VendorNumber.Text.ToUpper().ToString(); string address = txt_Address.Text.ToUpper().ToString(); int zipcode = int.Parse(txt_ZipCode.Text.ToString()); string City = txt_City.Text.ToUpper().ToString(); int state = int.Parse(ddl_State.SelectedValue.ToString()); int county = int.Parse(ddl_County.SelectedValue.ToString()); string Similar = txt_Similar.Text.ToUpper().ToString(); string Barrowername = txt_Borrowername.Text.ToUpper().ToString(); string BarrowerName2 = txt_BorrowerName2.Text.ToUpper().ToString(); string effectivedate = txt_Effectivedate.Text.ToString(); string Lastdeed = txt_LastDeed.Text.ToString(); string Grantee = txt_Grantee.Text.ToString(); string APN = txt_APN.Text.ToUpper().ToString(); if (txt_TotalCost.Text != "") { Totalcost = Convert.ToDecimal(txt_TotalCost.Text.ToString()); } else { Totalcost = 0; } int OrderStatus = int.Parse(ddl_orderstatus.SelectedValue.ToString()); string Notes = txt_Notes.Text.ToUpper().ToString(); string Legal = txt_Legal.Text.ToUpper().ToString(); int orderid = int.Parse(ViewState["Orderid"].ToString()); Hashtable htorder = new Hashtable(); DataTable dtorder = new DataTable(); DateTime date = new DateTime(); date = DateTime.Now; string dateeval = date.ToString("dd/MM/yyyy"); htorder.Add("@Trans", "UPDATE"); htorder.Add("@Order_ID", orderid); htorder.Add("@Date", date); htorder.Add("@Sub_ProcessId", subprocessid); htorder.Add("@Placed_By", Placedby); htorder.Add("@Order_Type", ordertype); htorder.Add("@Order_Number", ordernumber); htorder.Add("@Customer_Number", Customernumber); htorder.Add("@Vendor_Name", VendorName); htorder.Add("@Vendor_Number", VendorNumber); htorder.Add("@Order_Status", OrderStatus); htorder.Add("@Documents", ""); htorder.Add("@APN", APN); htorder.Add("@Address", address); htorder.Add("@City", City); htorder.Add("@State", state); htorder.Add("@Zip", zipcode); htorder.Add("@County", county); htorder.Add("@Borrower_Name", Barrowername); htorder.Add("@Borrower_Name2", BarrowerName2); htorder.Add("@Notes", Notes); htorder.Add("@Effective_date", effectivedate); htorder.Add("@Total_Cost", Totalcost); htorder.Add("@Grantee", Grantee); htorder.Add("@Legal", Legal); htorder.Add("@Last_Deed", Lastdeed); htorder.Add("@Paid", ""); htorder.Add("@Id", 0); htorder.Add("@Opened", date); htorder.Add("@Action_Date", date); htorder.Add("@Turn_Time", ""); htorder.Add("@Inserted_By", userid); htorder.Add("@Inserted_date", date); htorder.Add("@status", true); dtorder = dataaccess.ExecuteSP("Sp_Order", htorder); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Msg", "<script> alert('Order Updated Sucessfully')</script>", false); btn_Save.Text = "Add New Order"; GridviewbindOrderdata(); Clear_Order_Details(); GetMaximum_OrderNumber(); DivView.Visible = true; Divcreate.Visible = false; ModalPopupOrder.Hide(); } }