public IHttpActionResult FindDays(string from_date, string emp_id) { try { SqlDataReader SqlDtr; string sql; int leave = 0; sql = "select sum(datediff(day,date_from,dateadd(day,1,'" + from_date + "'))) from leave_register where cast(floor(cast(date_from as float)) as datetime) <= '" + from_date + "' and cast(floor(cast(date_to as float)) as datetime) > '" + from_date + "'and emp_id = '" + emp_id + "' and isSanction = 1 and datepart(month,date_from) = datepart(month,'" + from_date + "')"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.HasRows) { if (SqlDtr.Read()) { if (!SqlDtr.GetValue(0).ToString().Trim().Equals("")) { leave += System.Convert.ToInt32(SqlDtr.GetValue(0).ToString()); } } } SqlDtr.Close(); return(Ok(leave)); } catch (Exception) { return(Content(HttpStatusCode.NotFound, "Data Not Found")); } }
public IHttpActionResult PrintSelectCase(string from_date, string Emp_id, string str1) { try { SqlDataReader SqlDtr; string sql; int leave = 0; sql = "select case when cast(floor(cast(date_to as float)) as datetime) >= '" + from_date + "' then sum(datediff(day,'" + str1 + "',dateadd(day,1,'" + from_date + "'))) else sum(datediff(day,'" + str1 + "',dateadd(day,1,date_to))) end from leave_register where cast(floor(cast(date_from as float)) as datetime) < '" + str1 + "' and cast(floor(cast(date_to as float)) as datetime) >= '" + str1 + "'and emp_id = '" + Emp_id + "' and isSanction = 1 group by date_to"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.HasRows) { if (SqlDtr.Read()) { if (!SqlDtr.GetValue(0).ToString().Trim().Equals("")) { leave += System.Convert.ToInt32(SqlDtr.GetValue(0).ToString()); } } } SqlDtr.Close(); return(Ok(leave)); } catch (Exception) { return(Content(HttpStatusCode.NotFound, "Data Not Found")); } }
// This method displays the Dealers Logo. public void show() { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; string filePath = ""; sql = "select Logo from Organisation where CompanyID='1001'"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.Read()) { filePath = SqlDtr["Logo"].ToString(); } else { string home_drive = Environment.SystemDirectory; home_drive = home_drive.Substring(0, 2); filePath = home_drive + @"\Inetpub\wwwroot\Servosms\CompanyLogo\Logo.jpg"; } if (filePath.Trim().Equals("")) { string home_drive = Environment.SystemDirectory; home_drive = home_drive.Substring(0, 2); filePath = home_drive + @"\Inetpub\wwwroot\Servosms\CompanyLogo\Logo.jpg"; } imgSample.ImageUrl = filePath; SqlDtr.Close(); }
public IHttpActionResult GetNextRoleID() { string roleID = string.Empty; try { #region Fetch Next Role ID string sql = "select max(Role_ID)+1 from Roles"; SqlDataReader SqlDtr; EmployeeClass obj = new EmployeeClass(); SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { roleID = SqlDtr.GetSqlValue(0).ToString(); } SqlDtr.Close(); #endregion if (roleID == null) { return(Content(HttpStatusCode.NotFound, "Failed to get Next Role ID.")); } return(Ok(roleID)); } catch (Exception ex) { return(Content(HttpStatusCode.NotFound, "Failed to get Next Role ID.")); } }
/// <summary> /// This method is used to fatch the organization id from organization table and fill the /// dropdownlist on edit time. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, System.EventArgs e) { CreateLogFiles Err = new CreateLogFiles(); try { Label1.Visible = true; //txtFileTitle.Enabled=false; txtFileContents.EnableViewState = false; Button1.Visible = false; Drop.Visible = true; LblCompanyID.Visible = false; txtFileContents.Visible = false; InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; sql = "select max(CompanyID) from Organisation"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { Drop.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:OrganisationDetails.aspx,Class:InventoryClass.cs ,Method:saveButton EXCEPTION: " + ex.Message + " User_ID: " + 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); } }
public IHttpActionResult FetchCustomerNames() { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; ArrayList CustName = new ArrayList(); sql = "Select Cust_Name,city from Customer"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { CustName.Add(SqlDtr.GetValue(0).ToString() + ";" + SqlDtr.GetValue(1).ToString()); } SqlDtr.Close(); sql = "Select Ledger_Name+':'+cast(Ledger_ID as varchar) Ledger_Name from Ledger_Master lm,Ledger_master_sub_grp lmsg where lm.sub_grp_id = lmsg.sub_grp_id and lmsg.sub_grp_name not like 'Bank%' and lmsg.sub_grp_name != 'Cash in hand' and lmsg.sub_grp_name not like 'Discount%' and lmsg.sub_grp_name != 'Sundry Debtors' Order by Ledger_Name"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { CustName.Add(SqlDtr.GetValue(0).ToString() + "; "); } SqlDtr.Close(); sql = "Select Ledger_Name+':'+cast(Ledger_ID as varchar) Ledger_Name,city from Ledger_Master, Employee where Emp_Name=Ledger_Name Order by Ledger_Name"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { CustName.Add(SqlDtr.GetValue(0).ToString() + ";" + SqlDtr.GetValue(1).ToString()); } SqlDtr.Close(); CustName.Sort(); if (CustName == null || CustName.Count == 0) { return(Content(HttpStatusCode.NotFound, "Customer Names Not Found")); } return(Ok(CustName)); }
/// <summary> /// This method is used to generate the next user id /// </summary> public void GetNextUserID() { EmployeeClass obj = new EmployeeClass(); SqlDataReader SqlDtr; string sql; try { #region Fetch Next User ID sql = "select max(UserID)+1 from User_Master"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { lblUserID.Text = SqlDtr.GetSqlValue(0).ToString(); if (lblUserID.Text == "Null") { lblUserID.Text = "1001"; } } SqlDtr.Close(); #endregion } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:User_Profile.aspx,Method:GetNextUserID EXCEPTION: " + ex.Message + " " + uid); } }
public IHttpActionResult GetNextRouteID() { string Route_ID = string.Empty; try { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; #region Fetch the Next Route ID sql = "select Max(Route_ID)+1 from Route"; SqlDtr = obj.GetRecordSet(sql); if (SqlDtr.Read()) { Route_ID = SqlDtr.GetValue(0).ToString(); if (Route_ID == "") { Route_ID = "1"; } } else { Route_ID = "1"; } SqlDtr.Close(); #endregion return(Ok(Route_ID)); } catch (Exception ex) { return(Content(HttpStatusCode.NotFound, "Failed to get Next Route ID")); } }
/// <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 fatch the Customer name with type and fill the list. /// and also fatch the product name with pack type and fill the list. /// </summary> public void getCustandProd() { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; //sql="select cust_Name, cust_Name + ':' + cust_type from customer where cust_type='Fleet' or cust_type like('Oe%') order by cust_Name"; sql = "select cust_Name, cust_Name + ':' + cust_type from customer where cust_type like'Oe%' order by cust_Name"; SqlDtr = obj.GetRecordSet(sql); ListEmpAvailable.Items.Clear(); while (SqlDtr.Read()) { ListEmpAvailable.Items.Add(SqlDtr.GetValue(1).ToString()); } SqlDtr.Close(); //********************************* sql = "select prod_Name, prod_Name + ':' + pack_type from products order by prod_Name"; SqlDtr = obj.GetRecordSet(sql); Listprodavail.Items.Clear(); while (SqlDtr.Read()) { Listprodavail.Items.Add(SqlDtr.GetValue(1).ToString()); } SqlDtr.Close(); //*********************************** }
/// <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); } }
public IHttpActionResult fillCombo2() { SqlDataReader SqlDtr; List <string> DropBy = new List <string>(); string sql, str, strCash; strCash = ""; sql = "Select Ledger_Name,sub_grp_name from Ledger_Master lm,Ledger_master_sub_grp lmsg where lm.sub_grp_id = lmsg.sub_grp_id and (sub_grp_name='Cash in hand' or sub_grp_name like'Bank%') Order by Ledger_Name"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { str = SqlDtr["sub_grp_name"].ToString(); if (str.Equals("Cash in hand") || str.IndexOf("Bank") > -1) { DropBy.Add(SqlDtr["Ledger_Name"].ToString()); if (str.Equals("Cash in hand")) { strCash = SqlDtr["Ledger_Name"].ToString(); } } } SqlDtr.Close(); payment.DropBy1 = DropBy; payment.strCash = strCash; if (payment.Equals(0) || payment == null) { return(Content(HttpStatusCode.NotFound, "Data Not Found")); } return(Ok(payment)); }
public IHttpActionResult DeletePayment(string CustName, string VoucherId) { SqlDataReader SqlDtr; string sql = "select Cust_id from Customer where Cust_Name='" + CustName + "' "; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { payment.CustId = SqlDtr.GetValue(0).ToString(); } SqlDtr.Close(); sql = "delete from payment_transaction where voucher_id = '" + VoucherId + "'"; SqlDtr = obj.GetRecordSet(sql); SqlDtr.Close(); sql = "delete from AccountsLedgerTable where Particulars = 'Payment (" + VoucherId + ")'"; SqlDtr = obj.GetRecordSet(sql); SqlDtr.Close(); if (payment.CustId != "") { sql = "delete from CustomerLedgerTable where Particular = 'Voucher(" + VoucherId + ")'"; } if (payment.Equals(0) || payment == null) { return(Content(HttpStatusCode.NotFound, "Payment Not Deleted")); } return(Ok(payment)); }
public IHttpActionResult SelectCustId(string Ledger_ID1, string OldLedger_ID) { SqlDataReader SqlDtr; string sql = "select Cust_ID from Customer,Ledger_Master where Ledger_Name = Cust_Name and Ledger_ID ='" + Ledger_ID1 + "' "; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { payment.Ledger_ID1 = SqlDtr["Cust_ID"].ToString(); } SqlDtr.Close(); sql = "select Cust_ID from Customer,Ledger_Master where Ledger_Name = Cust_Name and Ledger_ID ='" + OldLedger_ID + "' "; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { payment.OldLedger_ID = SqlDtr["Cust_ID"].ToString(); } SqlDtr.Close(); if (payment.Equals(0) || payment == null) { return(Content(HttpStatusCode.NotFound, "Customer ID Not Found")); } return(Ok(payment)); }
public string GetInvoiceNo1() { //int no = 0; string InNo = ""; try { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; sql = "select max(Invoice_No) from Purchase_Master"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { InNo = SqlDtr.GetValue(0).ToString(); //no = Int32.Parse(InNo); //no = no + 1; } SqlDtr.Close(); //InNo = no.ToString(); return(InNo); } catch (Exception) { return(InNo); throw; } }
//This is used to generate ID auto. private void fillID() { SqlConnection con; SqlCommand cmd; try { con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Servosms"]); con.Open(); SqlDataReader SqlDtr; cmd = new SqlCommand("select max(customermechid)+1 from Customermechanicentry", con); SqlDtr = cmd.ExecuteReader(); if (SqlDtr.HasRows) { while (SqlDtr.Read()) { txtcustid.Text = SqlDtr.GetValue(0).ToString(); if (txtcustid.Text.Trim().Equals("")) { txtcustid.Text = "1"; } } } SqlDtr.Close(); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// This method is used to generate next CustomerTypeID from CustomerType table /// and fill in the textbox when page is loaded. /// </summary> private void fillID() { SqlConnection con; SqlCommand cmd; try { con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Servosms"]); con.Open(); SqlDataReader SqlDtr; cmd = new SqlCommand("select max(CustomerTypeID)+1 from CustomerType", con); SqlDtr = cmd.ExecuteReader(); if (SqlDtr.HasRows) { while (SqlDtr.Read()) { txtid.Text = SqlDtr.GetValue(0).ToString(); if (txtid.Text.Trim().Equals("")) { txtid.Text = "1"; } } } SqlDtr.Close(); con.Close(); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:CustomerType.aspx,Method:FillID, EXCEPTION " + ex.Message + " userid " + uid); MessageBox.Show(ex.Message); } }
public IHttpActionResult SeqStockMaster(string str1) { try { SqlDataReader SqlDtr; StockAdjustmentModel stkadj = new StockAdjustmentModel(); string sql; sql = "select * from Stock_Master where Productid='" + str1 + "' order by Stock_date"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { controlopening_stock.Add(SqlDtr["opening_stock"].ToString()); controlreceipt.Add(SqlDtr["receipt"].ToString()); controlsales.Add(SqlDtr["sales"].ToString()); controlsalesfoc.Add(SqlDtr["salesfoc"].ToString()); controlProductid.Add(SqlDtr["Productid"].ToString()); controlstock_date.Add(SqlDtr["stock_date"].ToString()); } SqlDtr.Close(); stkadj.opening_stock = controlopening_stock; stkadj.receipt = controlreceipt; stkadj.sales = controlsales; stkadj.salesfoc = controlsalesfoc; stkadj.Productid = controlProductid; stkadj.stock_date = controlstock_date; return(Ok(stkadj)); } catch (Exception ex) { return(Content(HttpStatusCode.NotFound, "Route could not update.")); } }
public IHttpActionResult GetNextOTID() { try { SqlDataReader SqlDtr; string sql, nextid = ""; sql = "select max(OT_ID) from OverTime_Register"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { if (nextid == null || nextid == "") { nextid = SqlDtr.GetValue(0).ToString(); } else { nextid = "1"; } } SqlDtr.Close(); return(Ok(nextid)); } catch (Exception) { return(Content(HttpStatusCode.NotFound, "Data Not Found")); } }
public string GetNextPeriodID() { try { Next_Period_Id = "1"; InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql = " Select max(Period_Id)+1 Next_Id from Cust_Sale_MS_HSD"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { if (SqlDtr["Next_Id"].ToString() != null && SqlDtr["Next_Id"].ToString() != "") { Next_Period_Id = SqlDtr["Next_Id"].ToString(); } else { Next_Period_Id = "1"; } } SqlDtr.Close(); return(Next_Period_Id); } catch (Exception ex) { return(Next_Period_Id); } }
/// <summary> /// This method is used to fatch the ssr information from employee table and also fatch the /// city from beat Master table and fill into the dropdownlist. /// </summary> public void FillList() { try { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql = "select emp_name from employee where Designation='Servo Sales Representative' order by emp_name"; SqlDtr = obj.GetRecordSet(sql); DropSSRname.Items.Clear(); DropSSRname.Items.Add("Select");; while (SqlDtr.Read()) { DropSSRname.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); sql = "select city from beat_master order by city"; SqlDtr = obj.GetRecordSet(sql); Listbeat.Items.Clear(); while (SqlDtr.Read()) { Listbeat.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form : SelesPersionAssignment.aspx,Method : FillList()" + ex.Message + " EXCEPTION " + uid); } }
protected void Page_Load(object sender, System.EventArgs e) { try { string check = ""; Cal_Img1.Visible = false; // check string gets the value from the check() method present in Security.dll; check = MySecurity.MySecurity.check(); // If the return value is false then the activation period expired and redirect to the error.aspx if (check.Equals("false")) { Response.Redirect("..\\Sysitem\\error.aspx", false); return; } // If the return value is Service then the Print_WindowsService is stopped and redirect to the Service.aspx if (check.Equals("Service")) { Response.Redirect("..\\Sysitem\\Service.aspx", false); return; } // If the return value is starts with P then dispaly the activation period. if (!check.Equals("")) { if (!check.Equals("true") && check.StartsWith("P")) { lblMessage.Text = check.Substring(1) + " left for Activation"; Cal_Img.Disabled = true; Cal_Img.Visible = false; Cal_Img1.Visible = true; Cal_Img1.Disabled = true; } } Session.Clear(); if (!IsPostBack) { PetrolPumpClass obj = new PetrolPumpClass(); SqlDataReader SqlDtr; string sql; // Fetch the roles and fills the User Type combo. sql = "select Role_Name from Roles"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { DropUser.Items.Add(SqlDtr.GetValue(0).ToString()); } SqlDtr.Close(); txtSetDate.Text = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); } }
/// <summary> /// this method is used to fatch the CustomerTypeName and CustomerTypeID from CustomerType table /// and fill the textboxes. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dropid_SelectedIndexChanged(object sender, System.EventArgs e) { try { //add by vikas sharma 23.10.2012 if (dropid.SelectedIndex == 0) { txtname.Text = ""; dropGroup.SelectedIndex = 0; dropSGroup.SelectedIndex = 0; return; } btnEdit.Text = "Update"; btnEdit.Enabled = true; btnDelete.Enabled = true; //dropid.Visible=true; SqlCommand cmd; SqlConnection con; con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Servosms"]); con.Open(); SqlDataReader SqlDtr; // * cmd=new SqlCommand("select * from CustomerType where CustomerTypeID='"+dropid.SelectedItem.Text.ToString()+"'",con); cmd = new SqlCommand("select * from CustomerType where CustomerTypeName='" + dropid.SelectedItem.Text.Trim().ToString() + "'", con); SqlDtr = cmd.ExecuteReader(); while (SqlDtr.Read()) { txtid.Text = SqlDtr.GetValue(0).ToString(); txtname.Text = SqlDtr.GetValue(1).ToString(); dropGroup.SelectedIndex = dropGroup.Items.IndexOf(dropGroup.Items.FindByText(SqlDtr.GetValue(2).ToString())); //Add by Vikas Sharma 23.10.2012 dropSGroup.SelectedIndex = dropSGroup.Items.IndexOf(dropSGroup.Items.FindByText(SqlDtr.GetValue(3).ToString())); //Add by Vikas Sharma 23.10.2012 } Object Add_Flag = Cache["Add"]; Object Edit_Flag = Cache["Edit"]; Object Del_Flag = Cache["Del"]; if (System.Convert.ToString(Add_Flag) == "0") { btnAdd.Enabled = false; } if (System.Convert.ToString(Edit_Flag) == "0") { btnEdit.Enabled = false; } if (System.Convert.ToString(Del_Flag) == "0") { btnDelete.Enabled = false; } CreateLogFiles.ErrorLog("Form:CustomerType.aspx,Method:Dropid_SelectedIndexChange, userid " + uid); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:CustomerType.aspx,Method:Dropid_SelectedIndexChange, EXCEPTION " + ex.Message + " userid " + uid); } }
public string GetBackOrderNo(string Order_No, string Prod_id, string cust_id) { try { BO_No = "0"; InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql = ""; sql = " select distinct bo_1,bo_2,bo_3 from ovd where cast(item_qty as float)>cast(sale_qty as float) and Order_id=" + Order_No.ToString() + " and item_id=" + Prod_id.ToString() + " and cust_id=" + cust_id.ToString(); SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { if (SqlDtr["Bo_3"].ToString() == null || SqlDtr["Bo_3"].ToString() == "") { if (SqlDtr["Bo_2"] == null || SqlDtr["Bo_2"].ToString() == "") { if (SqlDtr["Bo_1"].ToString() == null || SqlDtr["Bo_1"].ToString() == "") { BO_No = "0"; } else { if (SqlDtr["Bo_1"].ToString() != null && SqlDtr["Bo_1"].ToString() != "") { BO_No = "BO:" + SqlDtr["Bo_1"].ToString(); } } } else { if (SqlDtr["Bo_2"].ToString() != null && SqlDtr["Bo_2"].ToString() != "") { BO_No = "BO:" + SqlDtr["Bo_2"].ToString(); } } } else { if (SqlDtr["Bo_3"].ToString() != null && SqlDtr["Bo_3"].ToString() != "") { BO_No = "BO:" + SqlDtr["Bo_3"].ToString(); } } } SqlDtr.Close(); return(BO_No.ToString()); } catch (Exception ex) { return(BO_No.ToString()); CreateLogFiles.ErrorLog(" Form : BackOrder_Report.aspx , Method : GetOrderInvoice, Exception : " + ex.Message + " user : " + uid); } }
public string GetBackOrderDate(string Order_No, string Prod_id, string cust_id) { try { BO_Date = "0"; InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql = ""; sql = " select distinct Date_Bo_1,Date_Bo_2,Date_Bo_3 from ovd where item_qty > sale_qty and Order_id=" + Order_No.ToString() + " and item_id=" + Prod_id.ToString() + " and cust_id=" + cust_id.ToString(); SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { if (SqlDtr["Date_Bo_3"].ToString() == null || SqlDtr["Date_Bo_3"].ToString() == "") { if (SqlDtr["Date_Bo_2"] == null || SqlDtr["Date_Bo_2"].ToString() == "") { if (SqlDtr["Date_Bo_1"].ToString() == null || SqlDtr["Date_Bo_1"].ToString() == "") { BO_Date = "0"; } else { if (SqlDtr["Date_Bo_1"].ToString() != null && SqlDtr["Date_Bo_1"].ToString() != "") { BO_Date = GenUtil.str2DDMMYYYY(GenUtil.trimDate(SqlDtr["Date_Bo_1"].ToString())); } } } else { if (SqlDtr["Date_Bo_2"].ToString() != null && SqlDtr["Date_Bo_2"].ToString() != "") { BO_Date = GenUtil.str2DDMMYYYY(GenUtil.trimDate(SqlDtr["Date_Bo_2"].ToString())); } } } else { if (SqlDtr["Date_Bo_3"].ToString() != null && SqlDtr["Date_Bo_3"].ToString() != "") { BO_Date = GenUtil.str2DDMMYYYY(GenUtil.trimDate(SqlDtr["Date_Bo_3"].ToString())); } } } SqlDtr.Close(); return(BO_Date.ToString()); } catch (Exception ex) { return(BO_Date.ToString()); CreateLogFiles.ErrorLog(" Form : HSD_MS_Report.aspx , Method : GetOrderInvoice, Exception : " + ex.Message + " user : " + uid); } }
/// <summary> /// This method is used to fatch the all market customer id from database table /// and fill this value into the dropdownlist. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnselect_Click(object sender, System.EventArgs e) { SqlConnection con; SqlCommand cmd; try { con = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Servosms"]); con.Open(); SqlDataReader SqlDtr; cmd = new SqlCommand("select mcid from marketCustomerentry1", con); SqlDtr = cmd.ExecuteReader(); dropid.Items.Clear(); dropid.Items.Add("select"); if (SqlDtr.HasRows) { while (SqlDtr.Read()) { dropid.Items.Add(SqlDtr.GetValue(0).ToString()); } } dropid.Visible = true; btnselect.Visible = false; btnadd.Enabled = false; SqlDtr.Close(); con.Close(); Object Add_Flag = Cache["Add"]; Object Edit_Flag = Cache["Edit"]; Object Del_Flag = Cache["Del"]; if (System.Convert.ToString(Add_Flag) == "0") { btnadd.Enabled = false; } if (System.Convert.ToString(Edit_Flag) == "0") { btnedit.Enabled = false; } if (System.Convert.ToString(Del_Flag) == "0") { btndelete.Enabled = false; } CreateLogFiles.ErrorLog("Form:MarketCustEntry.aspx,Method:btnSelect, Userid= " + uid); } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:MarketCustEntry.aspx,Method:btnSelect" + " EXCEPTION " + ex.Message + "Userid= " + uid); MessageBox.Show(ex.Message); } }
/// <summary> /// This method is used to fatch the all product name with pack type and fill in list. /// </summary> public void FillList() { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql="select prod_Name, prod_Name + ':' + pack_type from products where unit!='Nos.' order by prod_Name"; SqlDtr = obj.GetRecordSet (sql); ListEmpAvailable.Items.Clear(); while(SqlDtr.Read ()) { ListEmpAvailable.Items.Add(SqlDtr.GetValue(1).ToString ()); } SqlDtr.Close(); }
/// <summary> /// This method is used to Displays the Organisation details information on edit time. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Drop_SelectedIndexChanged(object sender, System.EventArgs e) { try { txtdumy.Text = Drop.SelectedItem.Value.ToString(); if (txtdumy.Text == "Select") { MessageBox.Show("Please Select Company ID "); } else { InventoryClass obj = new InventoryClass(); SqlDataReader SqlDtr; string sql; sql = "select * from Organisation where CompanyID='" + Drop.SelectedItem.Value + "'"; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { txtDealerName.Text = SqlDtr.GetValue(1).ToString(); DropDealerShip.SelectedIndex = (DropDealerShip.Items.IndexOf((DropDealerShip.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())))); txtPhoneOff.Text = SqlDtr.GetValue(7).ToString(); TxtFaxNo.Text = SqlDtr.GetValue(8).ToString(); txtEMail.Text = SqlDtr.GetValue(9).ToString(); TxtWebsite.Text = SqlDtr.GetValue(10).ToString(); TxtTinno.Text = SqlDtr.GetValue(11).ToString(); txtentry.Text = SqlDtr.GetValue(12).ToString(); txtfood.Text = SqlDtr.GetValue(13).ToString(); TxtWMlic.Text = SqlDtr.GetValue(14).ToString(); dropstateoffice.SelectedIndex = (dropstateoffice.Items.IndexOf((dropstateoffice.Items.FindByValue(SqlDtr.GetValue(16).ToString())))); txtFileContents.Name = SqlDtr.GetValue(15).ToString(); txtMsg.Text = SqlDtr.GetValue(17).ToString(); txtVatRate.Text = GenUtil.strNumericFormat(SqlDtr.GetValue(18).ToString().Trim()); txtDateFrom.Text = checkDate(GenUtil.str2DDMMYYYY(trimDate(SqlDtr.GetValue(19).ToString().Trim()))); txtDateTo.Text = checkDate(GenUtil.str2DDMMYYYY(trimDate(SqlDtr.GetValue(20).ToString().Trim()))); txtStartInvoiceNo.Text = SqlDtr.GetValue(21).ToString(); } SqlDtr.Close(); } } catch (Exception ex) { CreateLogFiles.ErrorLog("Form:OrganisationDetails.aspx,Class:InventoryClass.cs ,Method:Drop_SelectedIndexChanged(). EXCEPTION: " + ex.Message + ". userid " + uid); } }
public string SaveAttandance(string Att_Date, string lblEmpID) { string str = ""; SqlDataReader SqlDtr; string sql = "select Status from Attandance_Register where Att_Date='" + Att_Date + "' and Emp_ID=" + lblEmpID + ""; SqlDtr = obj.GetRecordSet(sql); while (SqlDtr.Read()) { str = SqlDtr.GetValue(0).ToString(); } SqlDtr.Close(); return(str); }