protected void LoadCustomerPurchaseList() { Business.Customer.Customer objCustomerMaster = new Business.Customer.Customer(); Entity.Customer.Customer customerMaster = new Entity.Customer.Customer(); gvMachineList.DataSource = objCustomerMaster.CustomerPurchase_GetByCustomerId(CustomerMasterId); gvMachineList.DataBind(); }
private void CustomerLogin() { Business.Customer.Customer ObjUser = new Business.Customer.Customer(); DataTable dt = ObjUser.CustomerAuthentication(txtCustomerEmail.Text, txtMobileNumber.Text); if (dt != null && dt.Rows.Count > 0) { if (dt.Rows[0]["STATUS"].ToString() == "1") { string UserId = dt.Rows[0]["CustomerId"].ToString() + "|" + dt.Rows[0]["CustomerName"].ToString(); string roles = ""; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket( 1, UserId, DateTime.Now, DateTime.Now.AddHours(2), false, roles, "/"); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket)); Response.Cookies.Add(cookie); Response.Redirect("CustomerDashboard.aspx"); } } else { lblCustomerMessage.InnerHtml = "Invalid Email/Mobile Number"; } }
protected void btnFind_Click(object sender, EventArgs e) { try { hdnOpenForm.Value = "true"; Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer(); customer.CustomerMasterId = GetCustomerIdByName(txtCustomerName.Text); DataTable dt = objCustomer.FetchCustomerDetailsById(customer); if (dt.Rows.Count > 0) { txtName.Text = dt.Rows[0]["CustomerName"].ToString(); //ddlCustomerType.SelectedValue = dt.Rows[0]["CustomerType"].ToString(); txtOfficePhone.Text = dt.Rows[0]["PhoneNo"].ToString(); } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
protected void btnSaveAssignment_Click(object sender, EventArgs e) { try { if (ValidateAssignment()) { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); foreach (GridViewRow gvr in gvCustomerPurchase.Rows) { if (((CheckBox)gvr.FindControl("chkSelect")).Checked) { long customerPurchaseId = (long)gvCustomerPurchase.DataKeys[gvr.RowIndex]["CustomerPurchaseId"]; DropDownList ddlAssignEngineer = (DropDownList)gvr.FindControl("ddlAssignedEngineer"); int assignedEngineerId = Convert.ToInt32(ddlAssignEngineer.SelectedValue); objCustomer.Customer_CustomerPurchaseAssignEngineer_Save(customerPurchaseId, assignedEngineerId); } } LoadCustomerPurchase(); ClearControls(); Message.IsSuccess = true; Message.Text = "Engineers are assigned successfully."; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; } Message.Show = true; }
protected void LoadCustomerPurchaseList() { Business.Customer.Customer objCustomerMaster = new Business.Customer.Customer(); Entity.Customer.Customer customerMaster = new Entity.Customer.Customer(); gvPurchase.DataSource = objCustomerMaster.CustomerPurchase_GetByCustomerId(int.Parse(HttpContext.Current.User.Identity.Name.Split('|')[(int)Constants.Customer.ID])); gvPurchase.DataBind(); }
private void Customer_Customer_GetByAssignEngineerId() { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer(); if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL)) { customer.AssignEngineer = 0; } else { customer.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name); } customer.CustomerName = txtName.Text.Trim(); customer.PageIndex = gvCustomerMaster.PageIndex; customer.PageSize = gvCustomerMaster.PageSize; DataSet ds = objCustomer.Customer_CustomerMaster_GetByAssignEngineerIdWithPaging(customer); if (ds.Tables.Count > 0) { gvCustomerMaster.DataSource = ds.Tables[0]; gvCustomerMaster.VirtualItemCount = (ds.Tables[1].Rows.Count > 0) ? Convert.ToInt32(ds.Tables[1].Rows[0]["TotalCount"].ToString()) : 10; gvCustomerMaster.DataBind(); } else { gvCustomerMaster.DataSource = null; gvCustomerMaster.DataBind(); } }
protected void gvCustomerMaster_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "E") { CustomerId = Convert.ToInt64(e.CommandArgument.ToString()); FetchCustomerDetailsById(CustomerId); } else if (e.CommandName == "D") { CustomerId = Convert.ToInt64(e.CommandArgument.ToString()); Business.Customer.Customer ObjBelCustomer = new Business.Customer.Customer(); Entity.Customer.Customer ObjElCustomer = new Entity.Customer.Customer(); ObjElCustomer.CustomerMasterId = CustomerId; int i = 0; i = ObjBelCustomer.DeleteCustomer(ObjElCustomer); if (i > 0) { GlobalCache.RemoveAll(); CleartextBoxes(this); ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Data Delete Succesfully....');", true); CustomerId = 0; GetAllCustomer(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "mmsg", "alert('Data Can not Delete!!!....');", true); } } else if (e.CommandName == "Address") { CustomerId = Convert.ToInt64(e.CommandArgument.ToString()); GetAllAddress(Convert.ToInt64(e.CommandArgument.ToString())); TabContainer2.ActiveTab = AddressList; ModalPopupExtender2.Show(); } else if (e.CommandName == "Contact") { CustomerId = Convert.ToInt64(e.CommandArgument.ToString()); GetAllACustomerContactDetails(Convert.ToInt64(e.CommandArgument.ToString())); TabContainer1.ActiveTab = ContactDetails; ModalPopupExtender1.Show(); } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
protected void LoadPieChart() { decimal upTime = 100; Business.Customer.Customer objCustomerMaster = new Business.Customer.Customer(); DataTable dt = objCustomerMaster.CustomerPurchase_GetByCustomerId(CustomerMasterId); if (dt.Rows.Count > 0) { upTime = Convert.ToDecimal(dt.AsEnumerable().Average(row => row.Field <decimal>("UpTime"))); } ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "script", "PieData(" + upTime.ToString() + "," + (100 - upTime).ToString() + ")", true); }
public List <MachineResponseTime> ColumnChartData() { Business.Customer.Customer objCustomerMaster = new Business.Customer.Customer(); int customerMasterId = int.Parse(HttpContext.Current.User.Identity.Name.Split('|')[(int)Constants.Customer.ID]); DataTable dt = objCustomerMaster.CustomerPurchase_GetByCustomerId(customerMasterId); List <MachineResponseTime> chartList = new List <MachineResponseTime>(); foreach (DataRow dr in dt.Rows) { chartList.Add(new MachineResponseTime { MachineId = dr["MachineId"].ToString(), Avg_Response_Time = Convert.ToDecimal(dr["AVG_Response_Time"].ToString()) }); } return(chartList); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer(); customer.CompanyMasterId_FK = 1; customer.CustomerMasterId = CustomerId; customer.CustomerName = txtCustomerName.Text; customer.CustomerType = Convert.ToInt16(ddlCustomerType.SelectedValue); customer.EmailId = txtEmailId.Text; customer.MobileNo = txtMobileNo.Text; customer.PAddress = txtpAddress.Text; customer.PhoneNo = txtPhoneNo.Text; customer.Pin = txtPin.Text; customer.PStreet = txtpStreet.Text; customer.ReferenceName = txtrefferenceName.Text; customer.UserId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); long i = objCustomer.Save(customer); if (i > 0) { GlobalCache.RemoveAll(); CleartextBoxes(this); GetAllCustomer(); CustomerId = 0; Message.IsSuccess = true; Message.Text = "Customer information saved successfully..."; } else { Message.IsSuccess = false; Message.Text = "Can not save!!!"; } Message.Show = true; } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private void FetchCustomerDetailsById(long Id) { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer(); customer.CustomerMasterId = Id; DataTable dt = objCustomer.FetchCustomerDetailsById(customer); if (dt.Rows.Count > 0) { txtCustomerName.Text = dt.Rows[0]["CustomerName"].ToString(); ddlCustomerType.SelectedValue = dt.Rows[0]["CustomerType"].ToString(); txtEmailId.Text = dt.Rows[0]["EmailId"].ToString(); txtMobileNo.Text = dt.Rows[0]["MobileNo"].ToString(); txtpAddress.Text = dt.Rows[0]["pAddress"].ToString(); txtPhoneNo.Text = dt.Rows[0]["PhoneNo"].ToString(); txtPin.Text = dt.Rows[0]["Pin"].ToString(); txtpStreet.Text = dt.Rows[0]["pStreet"].ToString(); txtrefferenceName.Text = dt.Rows[0]["ReferenceName"].ToString(); } }
private void LoadCustomerPurchase() { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer() { CustomerName = txtCustomerName.Text.Trim(), SerialNo = txtSerialNo.Text.Trim(), AssignEngineer = Convert.ToInt32(ddlAssignedEngineer.SelectedValue), PageIndex = gvCustomerPurchase.PageIndex, PageSize = gvCustomerPurchase.PageSize, }; DataSet dsPurchase = objCustomer.Customer_CustomerPurchase_GetAll(customer); if (dsPurchase.Tables.Count > 1) { gvCustomerPurchase.DataSource = dsPurchase.Tables[0]; gvCustomerPurchase.VirtualItemCount = (dsPurchase.Tables[1].Rows.Count > 0) ? Convert.ToInt32(dsPurchase.Tables[1].Rows[0]["TotalCount"].ToString()) : 10; gvCustomerPurchase.DataBind(); } }
protected void gvCustomerMaster_RowCommand(object sender, GridViewCommandEventArgs e) { try { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer(); if (e.CommandName == "PurchaseDetails") { CustomerMasterId = int.Parse(e.CommandArgument.ToString()); customer.CustomerMasterId = CustomerMasterId; DataTable dr = objCustomer.FetchCustomerDetailsById(customer); popupHeader1.InnerHtml = (objCustomer.FetchCustomerDetailsById(customer) == null) ? "" : dr.Rows[0]["CustomerName"].ToString(); LoadCustomerPurchaseList(); ClearControl(); ModalPopupExtender1.Show(); } else if (e.CommandName == "ContractDetails") { CustomerMasterId = int.Parse(e.CommandArgument.ToString()); customer.CustomerMasterId = CustomerMasterId; DataTable dr = objCustomer.FetchCustomerDetailsById(customer); popupHeader2.InnerHtml = (objCustomer.FetchCustomerDetailsById(customer) == null) ? "" : dr.Rows[0]["CustomerName"].ToString(); LoadCustomerPurchaseListForContract(); LoadContractList(); ClearControlForContract(); ModalPopupExtender2.Show(); } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private void GetAllCustomer() { Business.Customer.Customer objCustomer = new Business.Customer.Customer(); Entity.Customer.Customer customer = new Entity.Customer.Customer(); customer.CompanyMasterId_FK = 1; customer.CustomerName = txtName.Text.Trim(); customer.PageIndex = gvCustomerMaster.PageIndex; customer.PageSize = gvCustomerMaster.PageSize; DataSet ds = objCustomer.GetAllCustomer(customer); if (ds.Tables.Count > 0) { gvCustomerMaster.DataSource = ds.Tables[0]; gvCustomerMaster.VirtualItemCount = (ds.Tables[1].Rows.Count > 0) ? Convert.ToInt32(ds.Tables[1].Rows[0]["TotalCount"].ToString()) : 10; gvCustomerMaster.DataBind(); } else { gvCustomerMaster.DataSource = null; gvCustomerMaster.DataBind(); } }