/// <summary> /// This is to delete the particular beat from the database. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, System.EventArgs e) { PartiesClass obj = new PartiesClass(); try { if (DropBeatNo.Visible == true && DropBeatNo.SelectedIndex == 0) { MessageBox.Show("Please select the Beat Number to Delete"); } else { string bno = DropBeatNo.SelectedItem.Value; string[] Beat = bno.Split(new char[] { ':' }, bno.Length); //obj.Beat_No = DropBeatNo.SelectedItem.Value ; obj.Beat_No = Beat[0]; obj.DeleteBeatMaster(); MessageBox.Show("Beat deleted"); CreateLogFiles.ErrorLog("Form:BeatMasterEntry.aspx,Method: btnDelete_Click" + " Beat no " + obj.Beat_No + " is DELETED " + " user id " + uid); Clear(); btnEdit.Visible = true; Edit1.Visible = false; DropBeatNo.Visible = false; lblBeatNo.Visible = true; FillID(); checkPrevileges(); } } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:BeatMasterEntry.aspx,Method: btnDelete_Click. EXCEPTION " + ex.Message + " user id " + uid); } }
/// <summary> /// This method fetch the beat related information and put into the textboxes. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DropBeatNo_SelectedIndexChanged(object sender, System.EventArgs e) { try { if (DropBeatNo.SelectedIndex == 0) { return; } PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; string sql; string cty = DropBeatNo.SelectedItem.Value; string[] arr = cty.Split(new char[] { ':' }, cty.Length); //sql="Select * from Beat_Master where Beat_No='"+ DropBeatNo.SelectedItem.Value +"'"; sql = "Select * from Beat_Master where Beat_No='" + arr[0] + "'"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { txtCity.Text = SqlDtr.GetValue(1).ToString(); txtState.Text = SqlDtr.GetValue(2).ToString(); txtCountry.Text = SqlDtr.GetValue(3).ToString(); } SqlDtr.Close(); CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx,Method:DropBeatNo_SelectedIndexChanged" + uid); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx,Method:DropBeatNo_SelectedIndexChange" + " EXCEPTION " + ex.Message + uid); } }
//************** /// <summary> /// This method is used to get the nextID auto. /// </summary> public void GetNextschemeID() { try { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; #region Fetch Next scheme ID SqlDtr = obj.GetNextFOID(); while (SqlDtr.Read()) { lblschid.Text = SqlDtr.GetSqlValue(0).ToString(); if (lblschid.Text == "Null") { lblschid.Text = "100001"; } } SqlDtr.Close(); #endregion } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:fleet/oe discountEntry.aspx,Class:PartiesClass.cs: Method:GetNextschemeID(). EXCEPTION " + ex.Message + " User " + uid); } }
/// <summary> /// This method is used to update the particular beat information, who is select from dropdownlist. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Edit1_Click(object sender, System.EventArgs e) { PartiesClass obj1 = new PartiesClass(); try { PartiesClass obj = new PartiesClass(); obj1.City = txtCity.Text; obj1.State = txtState.Text; obj1.Country = txtCountry.Text; string cty = DropBeatNo.SelectedItem.Value; string[] arr = cty.Split(new char[] { ':' }, cty.Length); //obj1.Beat_No =DropBeatNo.SelectedItem.Value ; obj1.Beat_No = arr[0]; obj1.UpdateBeatMaster(); MessageBox.Show("Beat Updated"); Clear(); DropBeatNo.Visible = false; lblBeatNo.Visible = true; Edit1.Visible = false; btnEdit.Visible = true; checkPrevileges(); CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx ,method Edit1_Click," + " Beat no " + obj1.Beat_No + "City Updated to " + obj1.City + " user:"******"Form:BeatMasterEntery.aspx ,method Edit1_Click," + " Beat no " + obj1.Beat_No + "City Updated to " + obj1.City + " EXCEPTION " + ex.Message + " user:" + uid); } }
/// <summary> /// this is used to generate the next ID auto . /// </summary> public void GetNextschemeID() { try { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr = null; #region Fetch Next scheme ID dbobj.SelectQuery("Select max(sch_id)+1 from stktSchDiscount", ref SqlDtr); if (SqlDtr.Read()) { if (SqlDtr.GetValue(0).ToString() != null && SqlDtr.GetValue(0).ToString() != "") { lblschid.Text = SqlDtr.GetValue(0).ToString(); } else { lblschid.Text = "600001"; } } else { lblschid.Text = "600001"; } SqlDtr.Close(); #endregion } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:StockiestDiscountEntry.aspx,Class:PartiesClass.cs: Method:GetNextschemeID(). EXCEPTION " + ex.Message + " User " + uid); } }
/// <summary> /// This method is used to bindind the datagrid. /// </summary> public void initGrid() { try { PartiesClass obj = new PartiesClass(); DataSet ds; ds = obj.ShowSupplierInfo(txtSuppID.Text, txtName.Text, txtPlace.Text); //****** DataTable dt = ds.Tables[0]; DataView dv = new DataView(dt); dv.Sort = System.Convert.ToString(Cache["strorderby"]); //****** if (dv.Count > 0) // if(ds.Tables[0].Rows.Count>0) { GridSearch.DataSource = dv; GridSearch.DataBind(); GridSearch.Visible = true; } else { MessageBox.Show("Vendor not Found"); GridSearch.Visible = false; } } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Supplier_List.aspx,Method:initGrid(),Class:PartiesClass.cs. EXCEPTION: " + ex.Message + " User_ID: " + uid); } }
/// <summary> /// This is used fill all ID's in dropdown. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, System.EventArgs e) { DropBeatNo.Visible = true; btnEdit.Visible = false; Edit1.Visible = true; Edit1.Enabled = true; btnDelete.Enabled = true; btnSave.CausesValidation = false; lblBeatNo.Visible = false; // Clear(); try { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; SqlDtr = obj.GetRecordSet("select Beat_No,city from Beat_Master order by city"); DropBeatNo.Items.Clear(); DropBeatNo.Items.Add("Select"); while (SqlDtr.Read()) { DropBeatNo.Items.Add(SqlDtr.GetValue(0).ToString() + ':' + SqlDtr.GetValue(1).ToString()); } SqlDtr.Close(); checkPrevileges(); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx,Method:btnEdit_Click(). EXCEPTION " + ex.Message + " " + uid); } }
/// <summary> /// This is used to binding the grid. /// </summary> public void gridInit() { try { PartiesClass obj = new PartiesClass(); CustomerModel customer = new CustomerModel(); DataSet ds; ds = obj.ShowCustomerInfo(txtCustID.Text, txtName.Text, txtPlace.Text); //**** DataTable dt = ds.Tables[0]; DataView dv = new DataView(dt); customer.CustomerID = txtCustID.Text; customer.CustomerName = txtName.Text; customer.Place = txtPlace.Text; //dv.Sort = System.Convert.ToString(Cache["strorderby"]); //using (var client = new HttpClient()) //{ // client.BaseAddress = new Uri(BaseUri); // var myContent = JsonConvert.SerializeObject(customer); // var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); // var byteContent = new ByteArrayContent(buffer); // byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); // client.DefaultRequestHeaders.Accept.Clear(); // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // var response = client.PostAsync("api/CustomerController/GetCustomersData", byteContent).Result; // if (response.IsSuccessStatusCode) // { // string responseString = response.Content.ReadAsStringAsync().Result; // dv = JsonConvert.DeserializeObject<DataView>(responseString); // } // else // response.EnsureSuccessStatusCode(); //} //dv.Sort = System.Convert.ToString(Cache["strorderby"]); if (dv.Count > 0) { GridSearch.DataSource = dv; GridSearch.DataBind(); GridSearch.Visible = true; } else { MessageBox.Show("Customer not Found"); GridSearch.Visible = false; } } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Customer_list.aspx,Method:on_pageload EXCEPTION: " + ex.Message + " User_ID: " + uid); } }
/// <summary> /// This is to Save the beat information. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, System.EventArgs e) { PartiesClass obj = new PartiesClass(); try { SqlDataReader SqlDtr; string sql; int flag = 0; sql = "select City from Beat_Master where City='" + txtCity.Text + "'"; //sql="select City from Beat_Master where City='"+ arr[0] +"'"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.Read()) { flag = 1; } else if (DropBeatNo.Visible == false) { obj.City = StringUtil.FirstCharUpper(txtCity.Text.ToString()); obj.State = StringUtil.FirstCharUpper(txtState.Text.ToString()); obj.Country = StringUtil.FirstCharUpper(txtCountry.Text.ToString()); obj.Beat_No = lblBeatNo.Text; obj.InsertBeatMaster(); CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx,Method: btnSave_Click" + " Beatno " + obj.Beat_No + " city " + obj.City + " state " + obj.State + " Country" + obj.Country + " IS SAVED " + " userid " + uid); FillID(); lblBeatNo.Visible = true; DropBeatNo.Visible = false; MessageBox.Show("Beat details Saved"); Clear(); } else if (DropBeatNo.Visible == true && DropBeatNo.SelectedIndex == 0) { MessageBox.Show("Please select the Beat Number to Edit"); } if (flag == 1) { RMG.MessageBox.Show("City already Exits"); SqlDtr.Close(); } checkPrevileges(); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx,Method: btnSave_Click" + " Beatno " + obj.Beat_No + " city " + obj.City + " state " + obj.State + " Country" + obj.Country + ex.Message + " userid " + uid); } }
/// <summary> /// This method is used to returns the Next Supplier ID from table Supplier. /// </summary> public void GetNextSupplierID() { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; #region Fetch Next Vendor ID SqlDtr = obj.GetNextSupplierID(); while (SqlDtr.Read()) { lblSupplierID.Text = SqlDtr.GetSqlValue(0).ToString(); if (lblSupplierID.Text == "Null") { lblSupplierID.Text = "1001"; } } SqlDtr.Close(); #endregion }
/// <summary> /// This is used to generate next CompanyID auto. /// </summary> public void GetNextCustomerID() { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; #region Fetch Next Customer ID SqlDtr = obj.GetNextCustomerID1(); while (SqlDtr.Read()) { LblCompanyID.Text = SqlDtr.GetSqlValue(0).ToString(); if (LblCompanyID.Text == "Null") { LblCompanyID.Text = "1001"; } } SqlDtr.Close(); #endregion }
/// <summary> /// Method Fetch the next beat ID from Beat_Master table. /// </summary> public void FillID() { try { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; SqlDtr = obj.GetRecordSet("select max(Beat_No)+1 from Beat_Master"); while (SqlDtr.Read()) { lblBeatNo.Text = SqlDtr.GetValue(0).ToString(); if (lblBeatNo.Text == "") { lblBeatNo.Text = "1001"; } } } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:BeatMasterEntery.aspx,Method:FillID(). EXCEPTION " + ex.Message + " " + uid); } }
/// <summary> /// This method is used to check the customer name, ledger name and Tin no can not be duplicate /// in customer or Ledger_Master table. After that call stored procedure 'ProCustomerUpdate' for /// update the custoemr information. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, System.EventArgs e) { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr = null; try { StringBuilder errorMessage = new StringBuilder(); if (txtTinNo.Text != string.Empty) { string sPattern = "^[a-zA-Z0-9]+$"; if (!System.Text.RegularExpressions.Regex.IsMatch(txtTinNo.Text, sPattern)) { errorMessage.Append("- Please Enter GSTIN No. in Alpha Numeric"); errorMessage.Append("\n"); } } if (errorMessage.Length > 0) { MessageBox.Show(errorMessage.ToString()); return; } if (!TempCustName.Text.ToLower().Trim().Equals(lblName.Text.ToLower().Trim())) { string ename = lblName.Text.Trim(); string sql1 = "select * from Customer where Cust_Name='" + ename.Trim() + "'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { MessageBox.Show("Customer Name " + ename + " Already Exist"); return; } SqlDtr.Close(); sql1 = "select * from Ledger_Master where Ledger_Name='" + ename.Trim() + "'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { MessageBox.Show("Ledger Name " + ename + " Already Exist"); return; } SqlDtr.Close(); } if (!txtTinNo.Text.Trim().Equals("")) { string sql1 = "Select Tin_No,Cust_ID from customer where Tin_No = '" + txtTinNo.Text.Trim() + "' and Tin_No<>'unregister' and Tin_No<>'UNREGISTERED' and Tin_No<>'Un Register'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { if (SqlDtr.Read()) { if (!LblCustomerID.Text.Equals(SqlDtr["Cust_ID"].ToString())) { MessageBox.Show("The Tin No. " + txtTinNo.Text.Trim() + " Already Exist"); return; } } } SqlDtr.Close(); } else { txtTinNo.Text = "Un Register"; } obj.Cust_ID = LblCustomerID.Text; obj.Cust_Name = lblName.Text.ToString().Trim(); obj.TempCustName = TempCustName.Text; obj.Cust_Type = DropCustType.SelectedItem.Value.ToString(); obj.Address = txtAddress.Text.ToString(); obj.City = DropCity.SelectedItem.Value.ToString(); obj.State = DropState.SelectedItem.Value.ToString(); obj.Country = DropCountry.SelectedItem.Value.ToString(); obj.EMail = txtEMail.Text.ToString(); if (txtcode.Text == "") { obj.sadbhavnacd = "0"; } else { obj.sadbhavnacd = txtcode.Text.ToString(); } if (txtPhoneRes.Text == "") { obj.Tel_Res = "0"; } else { obj.Tel_Res = txtPhoneRes.Text; } if (txtPhoneOff.Text == "") { obj.Tel_Off = "0"; } else { obj.Tel_Off = txtPhoneOff.Text; } if (txtMobile.Text == "") { obj.Mobile = "0"; } else { obj.Mobile = txtMobile.Text; } if (txtCRLimit.Text == "") { obj.CR_Limit = "0"; } else { obj.CR_Limit = txtCRLimit.Text; } if (DropCrDay.SelectedIndex == 0) { obj.CR_Days = "0"; } else { obj.CR_Days = DropCrDay.SelectedItem.Value.ToString(); } string OpBal = "0"; if (txtOpBalance.Text == "") { obj.Op_Balance = "0"; } else { obj.Op_Balance = txtOpBalance.Text; OpBal = txtOpBalance.Text; } obj.Balance_Type = DropBal.SelectedItem.Value.ToString(); obj.Tin_No = txtTinNo.Text.Trim(); if (DropSSR.SelectedIndex == 0) { obj.SSR = ""; } else { SqlDtr = obj.GetRecordSet("select Emp_ID from Employee where Emp_Name='" + DropSSR.SelectedItem.Text + "'"); if (SqlDtr.Read()) { obj.SSR = SqlDtr["Emp_ID"].ToString(); } else { obj.SSR = ""; } SqlDtr.Close(); } obj.ContactPerson = txtContactPerson.Text; // Calls method to update the customers details. obj.UpdateCustomer(); /* Comment by Mahesh b'coz balance updated by existing procedure * string Ledger_ID = ""; * dbobj.SelectQuery("select Ledger_ID from Ledger_Master where Ledger_Name=(select Cust_Name from Customer where Cust_ID='"+LblCustomerID.Text.Trim()+"')",ref SqlDtr); * if(SqlDtr.Read()) * { * Ledger_ID = SqlDtr.GetValue(0).ToString(); * } * SqlDtr.Close(); * //UpdateCustomerBalance(LblCustomerID.Text.Trim(),Ledger_ID); * object op=null; * dbobj.ExecProc(OprType.Update,"UpdateAccountsLedgerForCustomer",ref op,"@Ledger_ID",Ledger_ID); */ MessageBox.Show("Customer Updated"); Clear(); CreateLogFiles.ErrorLog("Form:Customer_Updates.aspx,Class:PartiesClass.cs: Method:btnUpdate_Click " + " Recored of - Cust Name " + obj.Cust_Name + " Cust id " + obj.Cust_ID + " IS UPDATED " + " User Type " + uid); Response.Redirect("Customer_List.aspx", false); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Customer_Updates.aspx,Class:PartiesClass.cs: Method:btnUpdate_Click " + " recored of " + " Cust Name " + obj.Cust_Name + " IS UPDATED " + " EXCEPTION " + ex.Message + " User Type " + uid); //Err.ErrorLog(Server.MapPath("Logs/ErrorLog"),"Form:Customer_Update.aspx,Method:btnUpdate_Click,Class:PartiesClass.cs " + ex.Message); } }
/// <summary> /// This method is used to update the data with the help of ProCustomerUpdateAll stored procedure. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, System.EventArgs e) { try { DBUtil dbobj1 = new DBUtil(System.Configuration.ConfigurationSettings.AppSettings["Servosms"], true); //InventoryClass obj1=new InventoryClass (); //SqlDataReader SqlDtr1=null; SqlDataReader rdr1 = null; int Total_Cust = 0; //string prod_cat="",sql; //int flag = 0; //string j=""; //int x=0; PartiesClass obj = new PartiesClass(); Total_Cust = System.Convert.ToInt32(Request.Params.Get("Total_Cust")); int i = 0; for (int j = 0; j < Total_Cust; j++) { i = 0; obj.Cust_ID = Request.Params.Get("txtInfo" + j + "To" + i++); obj.sadbhavnacd = Request.Params.Get("txtInfo" + j + "To" + i++); obj.Cust_Name = Request.Params.Get("txtInfo" + j + "To" + i++); obj.Address = Request.Params.Get("txtInfo" + j + "To" + i++); //obj.EMail=Request.Params.Get("txtInfo"+j+"To"+i++); string type = Request.Params.Get("txtInfo" + j + "To" + i++); if (type != "Select") { obj.Cust_Type = type; } else { obj.Cust_Type = ""; } string ssr = Request.Params.Get("txtInfo" + j + "To" + i++); if (ssr == "Select") { obj.SSR = ""; } else { dbobj1.SelectQuery("select Emp_ID from Employee where Emp_Name='" + ssr + "'", ref rdr1); if (rdr1.Read()) { obj.SSR = rdr1["Emp_ID"].ToString(); } else { obj.SSR = ""; } rdr1.Close(); } //obj.SSR=Request.Params.Get("txtInfo"+j+"To"+i++); string city = Request.Params.Get("txtInfo" + j + "To" + i++); if (city != "Select") { obj.City = city; } else { obj.City = ""; } dbobj1.SelectQuery("select state,country from beat_master where city='" + city + "'", ref rdr1); if (rdr1.Read()) { obj.State = rdr1["state"].ToString(); obj.Country = rdr1["country"].ToString(); } else { obj.State = ""; obj.Country = ""; } rdr1.Close(); //obj.Op_Balance=Request.Params.Get("txtInfo"+j+"To"+i++); //Coment by vikas 17.07.09 //obj.Balance_Type=Request.Params.Get("txtInfo"+j+"To"+i++); //Coment by vikas 17.07.09 obj.ContactPerson = Request.Params.Get("txtInfo" + j + "To" + i++); //Add by vikas 17.07.09 obj.Tel_Off = Request.Params.Get("txtInfo" + j + "To" + i++); obj.Mobile = Request.Params.Get("txtInfo" + j + "To" + i++); obj.Tin_No = Request.Params.Get("txtInfo" + j + "To" + i++); obj.CR_Limit = Request.Params.Get("txtInfo" + j + "To" + i++); obj.CR_Days = Request.Params.Get("txtInfo" + j + "To" + i++); obj.Op_Balance = Request.Params.Get("txtInfo" + j + "To" + i++); //Add by vikas 17.07.09 obj.Balance_Type = Request.Params.Get("txtInfo" + j + "To" + i++); //Add by vikas 17.07.09 //call the procedure ProCustomerUpdateAll for update the customer data. obj.UpdateCustomerAll(); } if (i > 0) { DropSearchBy.SelectedIndex = 0; //Add by vikas 17.07.09 DropValue.Value = "All"; //Add by vikas 17.07.09 //Customer balance update after update the customer record. CustomerBalanceUpdation(); MessageBox.Show("Customer Updated"); } CreateLogFiles.ErrorLog("Form:CustomerUpdation.aspx,Method:btnSubmit_click(), Customer Updated Successfully"); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:CustomerUpdation.aspx,Method:update(). EXCEPTION " + ex.Message); // CreateLogFiles.ErrorLog("Form:stockledgerUpdation.aspx,Method:update(). EXCEPTION " +ex.Message +" User_ID : "+ Session["User_Name"].ToString()); } }
/// <summary> /// this method is used to update the vendor information with the help of ProsupplierUpdate Procedure /// before check the vendor name should not be duplicate after that update the vendor balance. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, System.EventArgs e) { PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr = null; try { StringBuilder errorMessage = new StringBuilder(); if (txtTinNo.Text != string.Empty) { string sPattern = "^[a-zA-Z0-9]+$"; if (!System.Text.RegularExpressions.Regex.IsMatch(txtTinNo.Text, sPattern)) { errorMessage.Append("- Please Enter GSTIN No. in Alpha Numeric"); errorMessage.Append("\n"); } } if (errorMessage.Length > 0) { MessageBox.Show(errorMessage.ToString()); return; } string sql1 = ""; if (!TempVenderName.Text.ToLower().Trim().Equals(lblName.Text.ToLower().Trim())) { string sname = lblName.Text.Trim(); sql1 = "select * from Supplier where Supp_Name='" + sname.Trim() + "'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { MessageBox.Show("Vendor Name " + sname + " Already Exist"); return; } SqlDtr.Close(); sql1 = "select * from Ledger_Master where Ledger_Name='" + sname.Trim() + "'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { MessageBox.Show("Ledger Name " + sname + " Already Exist"); return; } SqlDtr.Close(); } // sql1 = "Select Tin_No,Supp_ID from supplier where Tin_No = '"+txtTinNo.Text.Trim()+"'"; // SqlDtr= obj.GetRecordSet(sql1); // if(SqlDtr.HasRows) // { // if(SqlDtr.Read()) // { // if(!lblSupplierID.Text.Equals(SqlDtr["Supp_ID"].ToString() ) ) // { // MessageBox.Show("The Tin No. "+txtTinNo.Text.Trim()+" Already Exist"); // return; // } // } // // } // SqlDtr.Close(); obj.Supp_ID = lblSupplierID.Text; obj.Supp_Name = lblName.Text.ToString(); obj.TempCustName = TempVenderName.Text; obj.Supp_Type = DropSuppType.SelectedItem.Value.ToString(); obj.Address = txtAddress.Text.ToString(); obj.City = DropCity.SelectedItem.Value.ToString(); obj.State = DropState.SelectedItem.Value.ToString(); obj.Country = DropCountry.SelectedItem.Value.ToString(); obj.EMail = txtEMail.Text.ToString(); if (txtPhoneRes.Text == "") { obj.Tel_Res = "0"; } else { obj.Tel_Res = txtPhoneRes.Text; } if (txtPhoneOff.Text == "") { obj.Tel_Off = "0"; } else { obj.Tel_Off = txtPhoneOff.Text; } if (txtMobile.Text == "") { obj.Mobile = "0"; } else { obj.Mobile = txtMobile.Text; } if (txtOpBalance.Text == "") { obj.Op_Balance = "0"; } else { obj.Op_Balance = txtOpBalance.Text; } obj.Balance_Type = DropBal.SelectedItem.Value.ToString(); if (DropCrDay.SelectedIndex == 0) { obj.CR_Days = "0"; } else { obj.CR_Days = DropCrDay.SelectedItem.Value.ToString(); } obj.Tin_No = txtTinNo.Text.Trim(); // call function to update the supplier details obj.UpdateSupplier(); string Ledger_ID = ""; dbobj.SelectQuery("select Ledger_ID from Ledger_Master where Ledger_Name=(select Supp_Name from Supplier where Supp_ID='" + lblSupplierID.Text.Trim() + "')", ref SqlDtr); if (SqlDtr.Read()) { Ledger_ID = SqlDtr.GetValue(0).ToString(); } UpdateCustomerBalance(Ledger_ID); MessageBox.Show("Vendor Updated"); Clear(); CreateLogFiles.ErrorLog("Form:Supllier_update.aspx, Method:btnUpdate_Click " + " Supplier_ID " + obj.Supp_ID + " Supplier Name " + lblName.Text.ToString() + " IS UPDATED " + " user " + uid); Response.Redirect("Supplier_List.aspx", false); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Supplier_Update.aspx,Class:PartiesClass.cs,Method:btnUpdate_Click(). EXCEPTION " + ex.Message + " user " + uid); } }
/// <summary> /// This method is used for setting the Session variable for userId and /// after that filling the required dropdowns with database values /// and also check accessing priviledges for particular user /// and generate the next ID also. /// and also fatch the vendor information according to select supplier ID in comes from url. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { try { uid = (Session["User_Name"].ToString()); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Supplier_Update.aspx,Class:PartiesClass.cs,Method:page_load " + ex.Message + " EXCEPTION " + uid); Response.Redirect("../../Sysitem/ErrorPage.aspx", false); return; } if (!Page.IsPostBack) { try { #region Check Privileges int i; string View_flag = "0", Add_Flag = "0", Edit_Flag = "0", Del_Flag = "0"; string Module = "3"; string SubModule = "12"; string[,] Priv = (string[, ])Session["Privileges"]; for (i = 0; i < Priv.GetLength(0); i++) { if (Priv[i, 0] == Module && Priv[i, 1] == SubModule) { View_flag = Priv[i, 2]; Add_Flag = Priv[i, 3]; Edit_Flag = Priv[i, 4]; Del_Flag = Priv[i, 5]; break; } } if (View_flag == "0") { Response.Redirect("../../Sysitem/AccessDeny.aspx", false); } if (Edit_Flag == "0") { btnUpdate.Enabled = false; } #endregion getbeat(); // Fills the credit limit combo with the 30 numbers. for (i = 1; i <= 30; i++) { DropCrDay.Items.Add(i.ToString()); } lblSupplierID.Text = Request.QueryString.Get("ID"); PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; string sql; #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct Country from Beat_Master"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCountry.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); sql = "select distinct City from Beat_Master"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCity.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); string sql1; sql1 = "select distinct State from Beat_Master"; SqlDtr = obj.GetRecordSet(sql1); while (SqlDtr.Read()) { DropState.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion SqlDtr = obj.SupplierList(lblSupplierID.Text.ToString(), "", ""); while (SqlDtr.Read()) { lblName.Text = SqlDtr.GetValue(1).ToString(); TempVenderName.Text = SqlDtr.GetValue(1).ToString(); DropSuppType.SelectedIndex = DropSuppType.Items.IndexOf(DropSuppType.Items.FindByValue(SqlDtr.GetValue(2).ToString())); txtAddress.Text = SqlDtr.GetValue(3).ToString(); DropCity.SelectedIndex = DropCity.Items.IndexOf(DropCity.Items.FindByValue(SqlDtr.GetValue(4).ToString())); DropState.SelectedIndex = DropState.Items.IndexOf(DropState.Items.FindByValue(SqlDtr.GetValue(5).ToString())); DropCountry.SelectedIndex = DropCountry.Items.IndexOf(DropCountry.Items.FindByValue(SqlDtr.GetValue(6).ToString())); if (SqlDtr.GetValue(7).ToString().Equals("0")) { txtPhoneRes.Text = ""; } else { txtPhoneRes.Text = SqlDtr.GetValue(7).ToString(); } if (SqlDtr.GetValue(8).ToString().Equals("0")) { txtPhoneOff.Text = ""; } else { txtPhoneOff.Text = SqlDtr.GetValue(8).ToString(); } if (SqlDtr.GetValue(9).ToString().Equals("0")) { txtMobile.Text = ""; } else { txtMobile.Text = SqlDtr.GetValue(9).ToString(); } txtEMail.Text = SqlDtr.GetValue(10).ToString(); txtOpBalance.Text = SqlDtr.GetValue(11).ToString(); DropBal.SelectedIndex = DropBal.Items.IndexOf(DropBal.Items.FindByValue(SqlDtr.GetValue(12).ToString())); DropCrDay.SelectedIndex = DropCrDay.Items.IndexOf(DropCrDay.Items.FindByValue(SqlDtr.GetValue(13).ToString())); txtTinNo.Text = SqlDtr.GetValue(14).ToString(); } SqlDtr.Close(); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Supplier_Update.aspx,Class:PartiesClass.cs,Method:page_load EXCEPTION: " + ex.Message + " User_ID: " + uid); } } }
/// <summary> /// Put user code to initialize the page here /// This method is used for setting the Session variable for userId and /// after that filling the required dropdowns with database values and also fill some /// additional information and also check accessing priviledges for particular user /// and generate the next ID also. /// and also fatch the customer information according to select customer ID in comes from url. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { try { uid = (Session["User_Name"].ToString()); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Customer_Update.aspx,Method:on_pageload,Class:PartiesClass.cs " + "EXCEPTION " + ex.Message + " " + uid); Response.Redirect("../../Sysitem/ErrorPage.aspx", false); return; } if (!Page.IsPostBack) { try { //************* SqlCommand cmd; SqlConnection con; con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Servosms"]); con.Open(); SqlDataReader SqlDtr1; cmd = new SqlCommand("select * from CustomerType order by CustomerTypeName", con); SqlDtr1 = cmd.ExecuteReader(); DropCustType.Items.Clear(); DropCustType.Items.Add("SELECT"); if (SqlDtr1.HasRows) { while (SqlDtr1.Read()) { DropCustType.Items.Add(SqlDtr1.GetValue(1).ToString()); } } con.Close(); SqlDtr1.Close(); cmd.Dispose(); getbeat(); //******** #region Check Privileges int i; string View_flag = "0", Add_Flag = "0", Edit_Flag = "0", Del_Flag = "0"; string Module = "3"; string SubModule = "2"; string[,] Priv = (string[, ])Session["Privileges"]; for (i = 0; i < Priv.GetLength(0); i++) { if (Priv[i, 0] == Module && Priv[i, 1] == SubModule) { View_flag = Priv[i, 2]; Add_Flag = Priv[i, 3]; Edit_Flag = Priv[i, 4]; Del_Flag = Priv[i, 5]; break; } } if (View_flag == "0") { Response.Redirect("../../Sysitem/AccessDeny.aspx", false); } if (Edit_Flag == "0") { btnUpdate.Enabled = false; } #endregion for (i = 1; i <= 30; i++) { DropCrDay.Items.Add(i.ToString()); } LblCustomerID.Text = Request.QueryString.Get("ID"); PartiesClass obj = new PartiesClass(); PartiesClass obj1 = new PartiesClass(); SqlDataReader SqlDtr; string sql; #region Fetch Extra Cities from Database and add to the ComboBox sql = "select City from Beat_Master order by city"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCity.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); sql = "select distinct State from Beat_Master"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropState.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); sql = "select distinct Country from Beat_Master"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCountry.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fetch SSR Employee from Employee Table and add to the ComboBox sql = "select Emp_Name from Employee where Designation='Servo Sales Representative' and status=1 order by Emp_Name"; SqlDtr = obj.GetRecordSet(sql); DropSSR.Items.Clear(); DropSSR.Items.Add("Select"); while (SqlDtr.Read()) { DropSSR.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fatch the Customer information according to Customer ID and fill the textboxes and dropdownlist SqlDtr = obj.CustomerList(LblCustomerID.Text.ToString(), "", ""); while (SqlDtr.Read()) { lblName.Text = SqlDtr.GetValue(1).ToString(); TempCustName.Text = SqlDtr.GetValue(1).ToString(); DropCustType.SelectedIndex = DropCustType.Items.IndexOf(DropCustType.Items.FindByValue(SqlDtr.GetValue(2).ToString())); txtAddress.Text = SqlDtr.GetValue(3).ToString(); DropCity.SelectedIndex = DropCity.Items.IndexOf(DropCity.Items.FindByValue(SqlDtr.GetValue(4).ToString())); DropState.SelectedIndex = DropState.Items.IndexOf(DropState.Items.FindByValue(SqlDtr.GetValue(5).ToString())); DropCountry.SelectedIndex = DropCountry.Items.IndexOf(DropCountry.Items.FindByValue(SqlDtr.GetValue(6).ToString())); if (SqlDtr.GetValue(7).ToString().Equals("0")) { txtPhoneRes.Text = ""; } else { txtPhoneRes.Text = SqlDtr.GetValue(7).ToString(); } if (SqlDtr.GetValue(8).ToString().Equals("0")) { txtPhoneOff.Text = ""; } else { txtPhoneOff.Text = SqlDtr.GetValue(8).ToString(); } if (SqlDtr.GetValue(9).ToString().Equals("0")) { txtMobile.Text = ""; } else { txtMobile.Text = SqlDtr.GetValue(9).ToString(); } txtEMail.Text = SqlDtr.GetValue(10).ToString(); txtCRLimit.Text = SqlDtr.GetValue(11).ToString(); DropCrDay.SelectedIndex = DropCrDay.Items.IndexOf(DropCrDay.Items.FindByValue(SqlDtr.GetValue(12).ToString())); if (SqlDtr["SSR"].ToString() != "" && SqlDtr["SSR"].ToString() != null) { SqlDtr1 = obj1.GetRecordSet("select Emp_Name from Employee where Emp_ID='" + SqlDtr["SSR"].ToString() + "'"); if (SqlDtr1.Read()) { DropSSR.SelectedIndex = DropSSR.Items.IndexOf(DropSSR.Items.FindByValue(SqlDtr1["Emp_Name"].ToString())); } else { DropSSR.SelectedIndex = 0; } SqlDtr1.Close(); } else { DropSSR.SelectedIndex = 0; } txtOpBalance.Text = SqlDtr.GetValue(13).ToString(); DropBal.SelectedIndex = DropBal.Items.IndexOf(DropBal.Items.FindByValue(SqlDtr.GetValue(14).ToString())); txtTinNo.Text = SqlDtr.GetValue(15).ToString().Trim(); txtcode.Text = SqlDtr.GetValue(17).ToString().Trim(); txtContactPerson.Text = SqlDtr["ContactPerson"].ToString(); } SqlDtr.Close(); #endregion } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Customer_Update.aspx,Method:on_pageload,Class:PartiesClass.cs " + "EXCEPTION " + ex.Message + " " + uid); } } }
/// <summary> /// This method is used for setting the Session variable for userId and /// after that filling the required dropdowns with database values /// and also check accessing priviledges for particular user /// and generate the next ID also. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { try { uid = (Session["User_Name"].ToString()); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Customer_Entry.aspx,Class:PartiesClass.cs ,Method:onpageload" + ex.Message + " EXCEPTION " + uid); Response.Redirect("../../Sysitem/ErrorPage.aspx", false); return; } //txtbeatname.Visible=false; if (!IsPostBack) { try { # region Fill dropType PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; string sql; SqlDtr = obj.GetRecordSet("select * from CustomerType order by CustomerTypeName"); DropType.Items.Clear(); DropType.Items.Add("Select"); while (SqlDtr.Read()) { DropType.Items.Add(SqlDtr.GetValue(1).ToString()); } SqlDtr.Close(); #endregion #region Check Privileges int i; string View_flag = "0", Add_Flag = "0", Edit_Flag = "0", Del_Flag = "0"; string Module = "3"; string SubModule = "2"; string[,] Priv = (string[, ])Session["Privileges"]; for (i = 0; i < Priv.GetLength(0); i++) { if (Priv[i, 0] == Module && Priv[i, 1] == SubModule) { View_flag = Priv[i, 2]; Add_Flag = Priv[i, 3]; Edit_Flag = Priv[i, 4]; Del_Flag = Priv[i, 5]; break; } } if (View_flag == "0") { Response.Redirect("../../Sysitem/AccessDeny.aspx", false); } if (Add_Flag == "0") { btnUpdate.Enabled = false; } #endregion for (i = 1; i <= 30; i++) { DropCrDay.Items.Add(i.ToString()); } GetNextCustomerID(); getbeat(); #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct City from Beat_Master order by City asc"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCity.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct state from Beat_Master order by state asc"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropState.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct country from Beat_Master order by country asc"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCountry.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fetch SSR Employee from Employee Table and add to the ComboBox sql = "select Emp_Name from Employee where Designation='Servo Sales Representative' order by Emp_Name"; SqlDtr = obj.GetRecordSet(sql); DropSSR.Items.Clear(); DropSSR.Items.Add("Select"); while (SqlDtr.Read()) { DropSSR.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion }
/// <summary> /// This method is used to Update the vendor entry with the help of ProSupplierEntry Procedure before check /// the vendor name must be unique if vendor name is duplicate then show popup message for user. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, System.EventArgs e) { PartiesClass obj = new PartiesClass(); try { StringBuilder errorMessage = new StringBuilder(); if (txtTinNo.Text != string.Empty) { string sPattern = "^[a-zA-Z0-9]+$"; if (!System.Text.RegularExpressions.Regex.IsMatch(txtTinNo.Text, sPattern)) { errorMessage.Append("- Please Enter GSTIN No. in Alpha Numeric"); errorMessage.Append("\n"); } } if (errorMessage.Length > 0) { MessageBox.Show(errorMessage.ToString()); return; } if (!checkAcc_Period()) { MessageBox.Show("Please enter the Accounts Period from Organization Details"); return; } // string sname=StringUtil.FirstCharUpper((txtFName.Text.ToString().Trim())) +" "+ StringUtil.FirstCharUpper((txtMName.Text.ToString().Trim() ))+" "+ StringUtil.FirstCharUpper((txtLName.Text.ToString().Trim() )); SqlDataReader SqlDtr; // string sql1="select Supp_ID from supplier where Supp_Name='"+sname+"'"; // // SqlDtr=obj.GetRecordSet(sql1); // // if(SqlDtr.HasRows) // { // MessageBox.Show("Vendor Name "+sname+" Already Exist"); // return; // } // SqlDtr.Close(); string sql1; SqlDataReader SqlDtr = null; string sname = ""; if (txtFName.Text.Trim() != "") { sname += txtFName.Text.Trim(); } if (txtMName.Text.Trim() != "") { sname += " " + txtMName.Text.Trim(); } if (txtLName.Text.Trim() != "") { sname += " " + txtLName.Text.Trim(); } //((txtFName.Text.ToString().Trim() )) +" "+ StringUtil.FirstCharUpper((txtMName.Text.ToString().Trim() ))+" "+ StringUtil.FirstCharUpper((txtLName.Text.ToString().Trim() )); sql1 = "select Supp_Id from Supplier where Supp_Name='" + sname.Trim() + "'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { MessageBox.Show("Vendor Name " + sname + " Already Exist"); return; } SqlDtr.Close(); sql1 = "select * from Ledger_Master where Ledger_Name='" + sname.Trim() + "'"; SqlDtr = obj.GetRecordSet(sql1); if (SqlDtr.HasRows) { MessageBox.Show("Ledger Name " + sname + " Already Exist"); return; } SqlDtr.Close(); // sql1 = "Select Tin_No from supplier where Tin_No = '"+txtTinNo.Text.Trim()+"'"; // SqlDtr= obj.GetRecordSet(sql1); // if(SqlDtr.HasRows) // { // MessageBox.Show("The Tin No. "+txtTinNo.Text.Trim()+" Already Exist"); // return; // } // SqlDtr.Close(); obj.Supp_ID = lblSupplierID.Text; if (txtMName.Text != "" && txtLName.Text != "") { obj.Supp_Name = StringUtil.FirstCharUpper((txtFName.Text.ToString().Trim())) + " " + StringUtil.FirstCharUpper((txtMName.Text.ToString().Trim()) + " " + (txtLName.Text.ToString().Trim())); } else if (txtMName.Text == "" && txtLName.Text != "") { obj.Supp_Name = StringUtil.FirstCharUpper((txtFName.Text.ToString().Trim())) + " " + StringUtil.FirstCharUpper((txtLName.Text.ToString().Trim())); } else if (txtMName.Text != "" && txtLName.Text == "") { obj.Supp_Name = StringUtil.FirstCharUpper((txtFName.Text.ToString().Trim())) + " " + StringUtil.FirstCharUpper((txtMName.Text.ToString().Trim())); } else if (txtLName.Text == "" && txtMName.Text == "") { obj.Supp_Name = StringUtil.FirstCharUpper((txtFName.Text.ToString().Trim())); } obj.Supp_Type = DropType.SelectedItem.Value.ToString(); obj.Address = txtAddress.Text.Trim(); obj.City = DropCity.SelectedItem.Value.ToString(); obj.State = DropState.SelectedItem.Value.ToString(); obj.Country = DropCountry.SelectedItem.Value.ToString(); if (txtPhoneOff.Text == "") { obj.Tel_Off = "0"; } else { obj.Tel_Off = txtPhoneOff.Text; } if (txtPhoneRes.Text == "") { obj.Tel_Res = "0"; } else { obj.Tel_Res = txtPhoneRes.Text; } if (txtMobile.Text == "") { obj.Mobile = "0"; } else { obj.Mobile = txtMobile.Text; } obj.EMail = txtEMail.Text.Trim(); if (txtOpBalance.Text == "") { obj.Op_Balance = "0"; } else { obj.Op_Balance = txtOpBalance.Text; } obj.Balance_Type = DropBal.SelectedItem.Value.ToString(); if (DropCrDay.SelectedIndex == 0) { obj.CR_Days = "0"; } else { obj.CR_Days = DropCrDay.SelectedItem.Value.ToString(); } obj.Tin_No = txtTinNo.Text.Trim(); // call the function to insert the supplier details. obj.InsertSupplier(); MessageBox.Show("Vendor Saved"); Clear(); GetNextSupplierID(); CreateLogFiles.ErrorLog("Form:Vender_Entry.aspx, Method:btnUpdate_Click " + " Supplier_ID " + obj.Supp_ID + " Supplier Type " + obj.Supp_Type + " supplier City " + obj.City + " IS SAVED " + " user " + uid); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Vender_Entry.aspx, Method:btnUpdate_Click (). EXCEPTION: " + ex.Message + " user " + uid); } }
/// <summary> /// This method is used for setting the Session variable for userId and /// after that filling the required dropdowns with database values /// and also check accessing priviledges for particular user /// and generate the next ID also. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { try { uid = (Session["User_Name"].ToString()); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Supplier_Entry.aspx,Method:page_load" + " EXCEPTION " + ex.Message + uid); Response.Redirect("../../Sysitem/ErrorPage.aspx", false); return; } if (!IsPostBack) { try { #region Check Privileges int i; string View_flag = "0", Add_Flag = "0", Edit_Flag = "0", Del_Flag = "0"; string Module = "3"; string SubModule = "12"; string[,] Priv = (string[, ])Session["Privileges"]; for (i = 0; i < Priv.GetLength(0); i++) { if (Priv[i, 0] == Module && Priv[i, 1] == SubModule) { View_flag = Priv[i, 2]; Add_Flag = Priv[i, 3]; Edit_Flag = Priv[i, 4]; Del_Flag = Priv[i, 5]; break; } } if (View_flag == "0") { // string msg="UnAthourized Visit to Vendor Entry Page"; // dbobj.LogActivity(msg,Session["User_Name"].ToString()); Response.Redirect("../../Sysitem/AccessDeny.aspx", false); } if (Add_Flag == "0") { btnUpdate.Enabled = false; } #endregion getbeat(); // Fills the Credit Limit combo with 30 Numbers. for (i = 1; i <= 30; i++) { DropCrDay.Items.Add(i.ToString()); } PartiesClass obj = new PartiesClass(); SqlDataReader SqlDtr; string sql; GetNextSupplierID(); #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct City from Beat_Master order by City asc"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCity.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct state from Beat_Master order by state asc"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropState.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion #region Fetch Extra Cities from Database and add to the ComboBox sql = "select distinct country from Beat_Master order by country asc"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropCountry.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); #endregion } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:Supplier_Entry.aspx,Method:page_load" + " EXCEPTION " + ex.Message + uid); } } }
//this method is used to show the report. protected void btnShow_Click(object sender, System.EventArgs e) { Purchase = new ArrayList(); Sales = new ArrayList(); Payment = new ArrayList(); Receipt = new ArrayList(); PartiesClass obj = new PartiesClass(); obj.DateFrom = GenUtil.str2MMDDYYYY(txtDateFrom.Text); obj.DateTo = GenUtil.str2MMDDYYYY(txtDateTo.Text); string str = obj.FatchCancelPurchaseInvoice(); if (str != "") { string[] strPur = str.Split(new char[] { ',' }, str.Length); for (int i = 0; i < strPur.Length; i++) { Purchase.Add(strPur[i].ToString()); } } str = ""; str = obj.FatchCancelSalesInvoice(); if (str != "") { string[] strPur1 = str.Split(new char[] { ',' }, str.Length); //10.07.09 for(int i=0;i<strPur1.Length;i++) for (int i = 1; i < strPur1.Length; i++) { //10.07.09 Sales.Add(strPur1[i].ToString()); string sales_inv = strPur1[i].ToString(); if (sales_inv.ToString() != "" && sales_inv.ToString() != null) { sales_inv = sales_inv.Substring(3, (sales_inv.Length) - 3); } Sales.Add(sales_inv.ToString()); } } str = ""; str = obj.FatchCancelPaymentInvoice(); if (str != "") { string[] strPur2 = str.Split(new char[] { ',' }, str.Length); for (int i = 0; i < strPur2.Length; i++) { Payment.Add(strPur2[i].ToString()); } } str = ""; //10.07.09 Comented by vikas str = obj.FatchCancelReceiptNo(); str = FatchCancelReceiptNo1(); //10.07.09 Add by vikas if (str != "") { string[] strPur2 = str.Split(new char[] { ',' }, str.Length); for (int i = 0; i < strPur2.Length; i++) { Receipt.Add(strPur2[i].ToString()); } } Flag = 1; /*SqlDataReader rdr = obj.GetRecordSet("select receipt_no from Payment_receipt where subreceiptno='Deleted' and cast(floor(cast(cast(receipt_date as datetime) as float)) as datetime)>='"+GenUtil.str2MMDDYYYY(txtDateFrom.Text)+"' and cast(floor(cast(cast(receipt_date as datetime) as float)) as datetime)<='"+GenUtil.str2MMDDYYYY(txtDateTo.Text)+"' order by receipt_no"); * if(rdr.HasRows) * { * while(rdr.Read()) * { * Receipt.Add(rdr.GetValue(0).ToString()); * } * } * rdr.Close();*/ }