private void checkPendingBills(DataSet ds) { foreach (GridViewRow tt in GrdViewSales.Rows) { if (tt.RowType == DataControlRowType.DataRow) { string billNo = tt.Cells[0].Text; bool exists = false; if (ds != null) { foreach (DataRow d in ds.Tables[0].Rows) { string bNo = d[1].ToString(); if (bNo == billNo) { exists = true; } } } if (!exists) { hdPendingCount.Value = "1"; UpdatePanelPage.Update(); return; } } } hdPendingCount.Value = "0"; UpdatePanelPage.Update(); }
protected void btnCancel_Click(object sender, EventArgs e) { try { Reset(); //MyAccordion.Visible = true; pnlEmp.Visible = false; lnkBtnAdd.Visible = true; txtEmpno.Enabled = true; GrdEmp.Visible = true; UpdatePanelPage.Update(); ModalPopupExtender2.Hide(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnCancel_Click(object sender, EventArgs e) { try { Reset(); tbMain.Visible = false; pnsApprov.Visible = false; pnsSave.Visible = false; pnsTse.Visible = false; pnsTime.Visible = false; //lnkBtnAdd.Visible = true; GrdTse.Visible = true; //MyAccordion.Visible = true; ModalPopupExtender1.Hide(); UpdatePanelPage.Update(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); BusinessLogic bl = new BusinessLogic(sDataSource); int empNO = 0; string sEmpFName = string.Empty; string sEmpMName = string.Empty; string sEmpSName = string.Empty; string sDesig = string.Empty; string sRemarks = string.Empty; string sTitle = string.Empty; int ManagerId = 0; string UserGroup = string.Empty; string sEmailID = string.Empty; string sMobNo = string.Empty; string sBranch = string.Empty; //string dDOJ = string.Empty; //string dDOB = string.Empty; if (Page.IsValid) { if (hdEmp.Value.Trim() != string.Empty) { empNO = Convert.ToInt32(hdEmp.Value.Trim()); } if (txtEmpFName.Text.Trim() != string.Empty) { sEmpFName = txtEmpFName.Text.Trim(); } if (txtEmpMName.Text.Trim() != string.Empty) { sEmpMName = txtEmpMName.Text.Trim(); } if (txtEmpSName.Text.Trim() != string.Empty) { sEmpSName = txtEmpSName.Text.Trim(); } if (txtDesig.Text.Trim() != string.Empty) { sDesig = txtDesig.Text.Trim(); } if (txtDoj.Text.Trim() != string.Empty) { dDOJ = Convert.ToDateTime(txtDoj.Text.Trim().ToString()); } if (txtDOB.Text.Trim() != string.Empty) { dDOB = Convert.ToDateTime(txtDOB.Text.Trim().ToString()); } if (txtRemarks.Text.Trim() != string.Empty) { sRemarks = txtRemarks.Text.Trim(); } if (txtEmailID.Text.Trim() != string.Empty) { sEmailID = txtEmailID.Text.Trim(); } if (txtMobNo.Text.Trim() != string.Empty) { sMobNo = txtMobNo.Text.Trim(); } sBranch = drpBranch.SelectedValue; sTitle = drpTitle.SelectedItem.Text; string stype = drptype.SelectedItem.Text; if (drpIncharge.Text.Trim() != string.Empty) { ManagerId = Convert.ToInt32(drpIncharge.SelectedValue); } if (txtUserGroup.Text.Trim() != string.Empty) { UserGroup = txtUserGroup.Text.Trim(); } //int empno = bl.UpdateEmpDetails(empNO, sTitle, sEmpFName, sEmpMName, sEmpSName, sDesig, sRemarks, dDOJ, dDOB, stype); int empno = bl.UpdateEmpDetails(empNO, sTitle, sEmpFName, sEmpMName, sEmpSName, sDesig, sRemarks, dDOJ, dDOB, ManagerId, UserGroup, sEmailID, sMobNo, sBranch); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Business Partner Details Updated Successfully. Partner No " + empno + "');", true); Reset(); BindEmp(); btnUpdate.Enabled = false; btnSave.Enabled = true; ResetSearch(); pnlEmp.Visible = false; lnkBtnAdd.Visible = true; txtEmpno.Enabled = true; //MyAccordion.Visible = true; GrdEmp.Visible = true; UpdatePanelPage.Update(); ModalPopupExtender2.Hide(); } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnSave_Click(object sender, EventArgs e) { try { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); BusinessLogic bl = new BusinessLogic(sDataSource); int empNO = 0; string sEmpFName = string.Empty; string sempNO = string.Empty; string sEmpMName = string.Empty; string sEmpSName = string.Empty; string sDesig = string.Empty; string sRemarks = string.Empty; string sTitle = string.Empty; string sEmailID = string.Empty; string sMobNo = string.Empty; string sBranch = string.Empty; int ManagerId = 0; //string dDOJ = string.Empty; //string dDOB = string.Empty; string UserGroup = string.Empty; if (Page.IsValid) { if (txtEmpno.Text.Trim() != string.Empty) { empNO = Convert.ToInt32(txtEmpno.Text.Trim()); sempNO = txtEmpno.Text.Trim(); } if (txtEmpFName.Text.Trim() != string.Empty) { sEmpFName = txtEmpFName.Text.Trim(); } if (txtEmpMName.Text.Trim() != string.Empty) { sEmpMName = txtEmpMName.Text.Trim(); } if (txtEmpSName.Text.Trim() != string.Empty) { sEmpSName = txtEmpSName.Text.Trim(); } if (txtDesig.Text.Trim() != string.Empty) { sDesig = txtDesig.Text.Trim(); } if (txtDoj.Text.Trim() != string.Empty) { dDOJ = Convert.ToDateTime(txtDoj.Text.Trim().ToString()); } if (txtDOB.Text.Trim() != string.Empty) { dDOB = Convert.ToDateTime(txtDOB.Text.Trim().ToString()); } if (txtRemarks.Text.Trim() != string.Empty) { sRemarks = txtRemarks.Text.Trim(); } if (drpIncharge.Text.Trim() != string.Empty) { ManagerId = Convert.ToInt32(drpIncharge.SelectedValue); } if (txtUserGroup.Text.Trim() != string.Empty) { UserGroup = txtUserGroup.Text.Trim(); } if (txtEmailID.Text.Trim() != string.Empty) { sEmailID = txtEmailID.Text.Trim(); } if (txtMobNo.Text.Trim() != string.Empty) { sMobNo = txtMobNo.Text.Trim(); } sTitle = drpTitle.SelectedItem.Text; sBranch = drpBranch.SelectedValue; string stype = drptype.SelectedItem.Text; string connection = Request.Cookies["Company"].Value; string branch = Request.Cookies["Branch"].Value; //DataSet checkemp = bl.SearchEmp(empNO, "", "", ""); DataSet checkemp = bl.SearchEmployee(connection, sempNO, "PartnerNo", branch); if (checkemp == null || checkemp.Tables[0].Rows.Count == 0) { if (txtEmailID.Text != "") { bool isEmail = Regex.IsMatch(txtEmailID.Text.Trim(), @"\A(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)\Z"); if (!isEmail) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Email Id is invalid')", true); return; } } //int empno = bl.InsertEmpDetails(empNO, sTitle, sEmpFName, sEmpMName, sEmpSName, sDesig, sRemarks, dDOJ, dDOB, stype); int empno = bl.InsertEmpDetails(empNO, sTitle, sEmpFName, sEmpMName, sEmpSName, sDesig, sRemarks, dDOJ, dDOB, ManagerId, UserGroup, sEmailID, sMobNo, sBranch); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Business Partner Details Saved Successfully.');", true); Reset(); ResetSearch(); BindEmp(); pnlEmp.Visible = false; lnkBtnAdd.Visible = true; txtEmpno.Enabled = true; //MyAccordion.Visible = true; GrdEmp.Visible = true; UpdatePanelPage.Update(); ModalPopupExtender2.Hide(); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Partner No " + empNO + " already Exists. Please try with different number.');", true); ModalPopupExtender2.Show(); } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); BusinessLogic bl = new BusinessLogic(sDataSource); int empNO = 0; string TSEDate = string.Empty; string Before8 = string.Empty; string _8to9 = string.Empty; string _9to10 = string.Empty; string _10to11 = string.Empty; string _11to12 = string.Empty; string _12to1 = string.Empty; string _1pmto2 = string.Empty; string _2pmto3 = string.Empty; string _3pmto4 = string.Empty; string _4pmto5 = string.Empty; string _5pmto6 = string.Empty; string _6pmto7 = string.Empty; string _7pmto8 = string.Empty; string _8pmto9 = string.Empty; string _9pmto10 = string.Empty; string After10 = string.Empty; string _Approved = string.Empty; if (Page.IsValid) { if (drpIncharge.Text.Trim() != string.Empty) { empNO = Convert.ToInt32(drpIncharge.Text.Trim()); } if (txtDate.Text.Trim() != string.Empty) { TSEDate = txtDate.Text.Trim(); } if (txtBefore8.Text.Trim() != string.Empty) { Before8 = txtBefore8.Text.Trim(); } if (txt8to9.Text.Trim() != string.Empty) { _8to9 = txt8to9.Text.Trim(); } if (txt9to10.Text.Trim() != string.Empty) { _9to10 = txt9to10.Text.Trim(); } if (txt10to11.Text.Trim() != string.Empty) { _10to11 = txt10to11.Text.Trim(); } if (txt11to12.Text.Trim() != string.Empty) { _11to12 = txt11to12.Text.Trim(); } if (txt12to1.Text.Trim() != string.Empty) { _12to1 = txt12to1.Text.Trim(); } if (txtPM1to2.Text.Trim() != string.Empty) { _1pmto2 = txtPM1to2.Text.Trim(); } if (txtPM2to3.Text.Trim() != string.Empty) { _2pmto3 = txtPM2to3.Text.Trim(); } if (txtPM3to4.Text.Trim() != string.Empty) { _3pmto4 = txtPM3to4.Text.Trim(); } if (txtPM4to5.Text.Trim() != string.Empty) { _4pmto5 = txtPM4to5.Text.Trim(); } if (txtPM5to6.Text.Trim() != string.Empty) { _5pmto6 = txtPM5to6.Text.Trim(); } if (txtPM6to7.Text.Trim() != string.Empty) { _6pmto7 = txtPM6to7.Text.Trim(); } if (txtPM7to8.Text.Trim() != string.Empty) { _7pmto8 = txtPM7to8.Text.Trim(); } if (txtPM8to9.Text.Trim() != string.Empty) { _8pmto9 = txtPM8to9.Text.Trim(); } if (txtPM9to10.Text.Trim() != string.Empty) { _9pmto10 = txtPM9to10.Text.Trim(); } if (txtPMafter10.Text.Trim() != string.Empty) { After10 = txtPMafter10.Text.Trim(); } if (drpapproved.Text.Trim() != string.Empty) { _Approved = drpapproved.Text.Trim(); } //_Approved = Convert.ToInt32(drpapproved.Text.Trim()); bl.UpdateTSEDetails(empNO, TSEDate, Before8, _8to9, _9to10, _10to11, _11to12, _12to1, _1pmto2, _2pmto3, _3pmto4, _4pmto5, _5pmto6, _6pmto7, _7pmto8, _8pmto9, _9pmto10, After10, _Approved); GrdTse.Visible = true; tbMain.Visible = false; ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Time Sheet Entry Details Updated Successfully. Employee No " + empNO + " TSEDate=" + TSEDate + "');", true); Reset(); ResetSearch(); BindTse(); //MyAccordion.Visible = true; ModalPopupExtender1.Hide(); UpdatePanelPage.Update(); } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void AddButton_Click(object sender, EventArgs e) { DateTime creationDate; int LeadID = 0; string prospectCustomer = string.Empty; string address = string.Empty; string mobile = string.Empty; string landline = string.Empty; string email = string.Empty; string modeOfContact = string.Empty; string personalResponsible = string.Empty; string businessType = string.Empty; string branch = string.Empty; string status = string.Empty; string LastCompletedAction = string.Empty; //string creationDate = string.Empty; string nextAction = string.Empty; string category = string.Empty; DataSet dsContact; string info1 = string.Empty; string info2 = string.Empty; string info3 = string.Empty; string info4 = string.Empty; string info5 = string.Empty; try { if (Session["contactDs"] == null || ((DataSet)Session["contactDs"]).Tables[0].Rows.Count < 1) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Please enter atleast one Lead Contact and try again.')", true); return; } if (Page.IsValid) { //if(txtLeadNo.Text != string.Empty) //LeadID = int.Parse(txtLeadNo.Text); creationDate = DateTime.Parse(txtCreationDate.Text); //creationDate = txtCreationDate.Text.Trim(); prospectCustomer = txtProspCustName.Text; address = txtAddress.Text; mobile = txtMobile.Text; landline = txtLandline.Text; email = txtEmail.Text; modeOfContact = cmbModeOfContact.SelectedValue; personalResponsible = cmbPersonalResp.Text; businessType = cmbBussType.SelectedValue; branch = cmbBranch.SelectedValue; if (cmbnewstatus.SelectedValue == "0") { status = cmbStatus.SelectedValue; } else { status = cmbnewstatus.SelectedValue; } if (cmblastaction.SelectedValue == "0") { LastCompletedAction = cmbLastCompAction.SelectedValue; } else { LastCompletedAction = cmblastaction.SelectedValue; } if (cmbnxtaction.SelectedValue == "0") { nextAction = cmbNextAction.SelectedValue; } else { nextAction = cmbnxtaction.SelectedValue; } category = cmbCategory.SelectedValue; info1 = txtInfo1.Text; info2 = txtInfo2.Text; info3 = ddlinfo3.SelectedValue; info4 = ddlinfo4.SelectedValue; info5 = ddlinfo5.SelectedValue; string callbackflag = DropDownList1.SelectedItem.Text; string callbackdate = TextBox1.Text; dsContact = (DataSet)Session["contactDs"]; string connStr = GetConnectionString(); LeadBusinessLogic bl = new LeadBusinessLogic(connStr); //bl.AddUpdateLeadMaster(LeadID, creationDate, prospectCustomer, address, mobile, landline, email, modeOfContact, personalResponsible, businessType, branch, status, LastCompletedAction, nextAction, category, dsContact, info1, info2, info3, info4, info5); bl.AddUpdateLeadMaster(LeadID, creationDate, prospectCustomer, address, mobile, landline, email, modeOfContact, personalResponsible, businessType, branch, status, LastCompletedAction, nextAction, category, dsContact, info1, info2, info3, info4, info5, callbackflag, callbackdate); GrdViewLead.DataBind(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Lead Details saved successfully.')", true); BindGrid("", ""); UpdatePanelPage.Update(); ModalPopupExtender2.Hide(); //return; } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); return; } }
protected void cmdSave_Click(object sender, EventArgs e) { try { DataSet ds; DataTable dt; DataRow drNew; DataColumn dc; ds = new DataSet(); dt = new DataTable(); dc = new DataColumn("UserName"); dt.Columns.Add(dc); dc = new DataColumn("Role"); dt.Columns.Add(dc); dc = new DataColumn("RoleDesc"); dt.Columns.Add(dc); dc = new DataColumn("Section"); dt.Columns.Add(dc); dc = new DataColumn("Area"); dt.Columns.Add(dc); dc = new DataColumn("Orderno"); dt.Columns.Add(dc); dc = new DataColumn("Add"); dt.Columns.Add(dc); dc = new DataColumn("Edit"); dt.Columns.Add(dc); dc = new DataColumn("Delete"); dt.Columns.Add(dc); dc = new DataColumn("View"); dt.Columns.Add(dc); ds.Tables.Add(dt); bool Add = false; bool Edit = false; bool Delete = false; bool Views = false; Label lblDebtorID = null; for (int vLoop = 0; vLoop < GrdViewItem.Rows.Count; vLoop++) { CheckBox txt = (CheckBox)GrdViewItem.Rows[vLoop].FindControl("chkboxAdd"); if (txt.Checked) { Add = txt.Checked; } else { Add = false; } CheckBox txttt = (CheckBox)GrdViewItem.Rows[vLoop].FindControl("chkboxEdit"); if (txttt.Checked) { Edit = txttt.Checked; } else { Edit = false; } CheckBox txth = (CheckBox)GrdViewItem.Rows[vLoop].FindControl("chkboxDel"); if (txth.Checked) { Delete = txth.Checked; } else { Delete = false; } CheckBox txthh = (CheckBox)GrdViewItem.Rows[vLoop].FindControl("chkboxView"); if (txthh.Checked) { Views = txthh.Checked; } else { Views = false; } drNew = dt.NewRow(); drNew["UserName"] = txtUser.Text; drNew["Role"] = GrdViewItem.Rows[vLoop].Cells[3].Text; drNew["RoleDesc"] = GrdViewItem.Rows[vLoop].Cells[2].Text; drNew["Section"] = GrdViewItem.Rows[vLoop].Cells[1].Text; drNew["Area"] = GrdViewItem.Rows[vLoop].Cells[0].Text; lblDebtorID = (Label)GrdViewItem.Rows[vLoop].FindControl("lblDebtorID"); drNew["Orderno"] = lblDebtorID.Text; drNew["Add"] = Add; drNew["Edit"] = Edit; drNew["Delete"] = Delete; drNew["View"] = Views; ds.Tables[0].Rows.Add(drNew); } string Userna = Request.Cookies["LoggedUserName"].Value; string userName = string.Empty; string Email = string.Empty; string connection = string.Empty; bool Locked = chkAccLocked.Checked; bool DateLock = chkboxdatelock.Checked; if (txtUser.Text != string.Empty) { userName = txtUser.Text; } if (txtEmail.Text != string.Empty) { Email = txtEmail.Text; } if (Request.Cookies["Company"] != null) { connection = Request.Cookies["Company"].Value; } string UserGroup = string.Empty; bool DateLoc = true; DataSet dsd = new DataSet(); DataSet dsbranch = new DataSet(); int EmpNo = 0; if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { BusinessLogic objBL = new BusinessLogic(); objBL = new BusinessLogic(ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString()); if (Session["Show"] == "Add New") { if (objBL.InsertUserOptions(ds, Userna, userName, Email, Locked, DateLock, dsd, "", EmpNo, UserGroup, DateLoc, dsbranch, false, "", false, "")) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('User And their Options Saved Successfully');", true); //BindGrid(); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('User already exists. Please try again.');", true); return; } } else if (Session["Show"] == "Edit") { objBL.UpdateUserOptions(connection, ds, Userna, userName, Email, Locked, DateLock, dsd, "", EmpNo, UserGroup, DateLoc, dsbranch, false, "", false, ""); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('User And their Options Updated Successfully');", true); //BindGrid(); } } else { } } ModalPopupGet.Hide(); GrdViewCust.DataBind(); UpdatePanelPage.Update(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }