public static int DeleteCustomer(Customer customer) { int result; TMSDataLibrary.Customer _objcustomer = new TMSDataLibrary.Customer(); result = _objcustomer.DeleteCustomer(customer.UserId); return result; }
/// <summary> /// Add Customer Information To Database In customer /// </summary> /// <param name="customer">Customer</param> /// <returns>status</returns> public static int AddCustomer(Customer customer) { int result; string customerNo = ""; TMSDataLibrary.Customer _objcustomer = new TMSDataLibrary.Customer(); int usertype = (int)CONSTANT.ApplicationUserType.Customer; result = _objcustomer.AddCustomer(customer.Password, customer.FirstName, customer.LastName, customer.Mobile, customer.Email, customer.AddressLine, customer.Pincode, customer.CityId, usertype, customer.ProfilePhoto, out customerNo); customer.CustomerNo = customerNo; return result; }
/// <summary> /// Get Information About customer According Userid /// </summary> /// <param name="userid">User Id</param> /// <returns>Customer</returns> public static Customer GetCustomerInfo(int userid) { DataTable dt = new DataTable(); Customer _customer = new Customer(); TMSDataLibrary.Customer _customerdata = new TMSDataLibrary.Customer(); dt = _customerdata.GetCustomerInfo(userid); if (dt.Rows.Count > 0) { _customer.CustomerId = (int)dt.Rows[0][CONSTS.CustomerColumnIndex.CustomerId]; _customer.UserId = (int)dt.Rows[0][CONSTS.CustomerColumnIndex.UserId]; _customer.FirstName = dt.Rows[0][CONSTS.CustomerColumnIndex.FirstName].ToString(); _customer.LastName = dt.Rows[0][CONSTS.CustomerColumnIndex.LastName].ToString(); _customer.Mobile = dt.Rows[0][CONSTS.CustomerColumnIndex.Mobile].ToString(); _customer.Email = dt.Rows[0][CONSTS.CustomerColumnIndex.Email].ToString(); _customer.AddressLine = dt.Rows[0][CONSTS.CustomerColumnIndex.AddressLine].ToString(); _customer.CityId = Convert.ToInt16(dt.Rows[0][CONSTS.CustomerColumnIndex.CityId]); _customer.CityName = dt.Rows[0][CONSTS.CustomerColumnIndex.CityName].ToString(); _customer.Pincode = dt.Rows[0][CONSTS.CustomerColumnIndex.Pincode].ToString(); //var abc = dt.Rows[0][CONSTS.CustomerColumnIndex.ProfilePhoto].ToString(); if (dt.Rows[0][CONSTS.CustomerColumnIndex.ProfilePhoto].ToString() != "") { _customer.ProfilePhoto = dt.Rows[0][CONSTS.CustomerColumnIndex.ProfilePhoto].ToString(); } if (dt.Rows[0][CONSTS.CustomerColumnIndex.CompanyName].ToString() != "") { _customer.CompanyName = dt.Rows[0][CONSTS.CustomerColumnIndex.CompanyName].ToString(); } if (dt.Rows[0][CONSTS.CustomerColumnIndex.ServieTaxNo].ToString() != "") { _customer.ServieTaxNo = dt.Rows[0][CONSTS.CustomerColumnIndex.ServieTaxNo].ToString(); } if (dt.Rows[0][CONSTS.CustomerColumnIndex.PanNumber].ToString() != "") { _customer.PanNumber = dt.Rows[0][CONSTS.CustomerColumnIndex.PanNumber].ToString(); } if (dt.Rows[0][CONSTS.CustomerColumnIndex.Website].ToString() != "") { _customer.Website = dt.Rows[0][CONSTS.CustomerColumnIndex.Website].ToString(); } if (dt.Rows[0][CONSTS.CustomerColumnIndex.EstablishYear].ToString() != "") { _customer.EstablishYear = dt.Rows[0][CONSTS.CustomerColumnIndex.EstablishYear].ToString(); } if (dt.Rows[0][CONSTS.CustomerColumnIndex.UpdatedAt].ToString() != "") { _customer.UpdatedAt = Convert.ToDateTime(dt.Rows[0][CONSTS.CustomerColumnIndex.UpdatedAt].ToString()); } _customer.CustomerNo = dt.Rows[0][CONSTS.CustomerColumnIndex.CustomerNo].ToString(); } return _customer; }
protected void btnRegister_Click(object sender, EventArgs e) { TMSLibrary.Customer obj = new TMSLibrary.Customer(); if (txtFirstName.Text.Trim() != "") { obj.FirstName = txtFirstName.Text.Trim(); } else { ValidatePopup("Please Enter First Name"); return; } if (txtLastName.Text.Trim() != "") { obj.LastName = txtLastName.Text.Trim(); } else { ValidatePopup("Please Enter Last Name"); return; } if (txtMobile.Text.Trim() != "") { obj.Mobile = txtMobile.Text.Trim(); } else { ValidatePopup("Please Enter Mobile Number"); return; } if (txtEmail.Text.Trim() != "") { obj.Email = txtEmail.Text.Trim(); } else { ValidatePopup("Please Enter Email Id"); return; } if (txtAddress.Text.Trim() != "") { obj.AddressLine = txtAddress.Text.Trim(); } else { ValidatePopup("Please Enter Address Line"); return; } if (txtCityId.Text != "") { obj.CityId = Convert.ToInt32(txtCityId.Text); } else { ValidatePopup("Please Select City"); return; } if (ddlPincode.SelectedIndex != 0) { obj.Pincode = ddlPincode.SelectedValue; } else { ValidatePopup("Please Enter Pincode"); return; } //if (!chkTermsConditions.Checked) //{ // rfvTerms.IsValid = false; // return; //} obj.ProfilePhoto = TMSLibrary.CONSTANT.Password.ImagePath; obj.Password = TMSLibrary.Util.GetRandomPassword(); int result = TMSLibrary.CustomerMethods.AddCustomer(obj); if (result == 2) { ValidatePopup("Mobile Already Registered"); return; } else if (result >= 1) { ValidatePopup(string.Format("Registered Successfully.\\nSMS with your login details will be sent on Registered Number" , obj.CustomerNo)); var sms_result = SMS.SendSMS(txtMobile.Text.Trim(), obj.Password); //Response.Cookies["mobileno"].Value = txtMobile.Text.Trim(); //Response.Cookies["mobileno"].Expires = DateTime.Now.AddMinutes(30); ClearInputs(Page.Controls); Response.Redirect(string.Format("~\\Account\\ThankYou.aspx?ut=3&userNo={0}", obj.CustomerNo)); } else { ValidatePopup("Please try Again"); return; } }
/// <summary> /// Update customer Information To Database In Customer table /// </summary> /// <param name="customer">object of class customer</param> /// <returns>Number of updated row in result</returns> public static int UpdateCustomer(Customer customer) { int result; TMSDataLibrary.Customer _objcutomer = new TMSDataLibrary.Customer(); result = _objcutomer.UpdateCustomer(customer.UserId, customer.AddressLine, customer.Website, customer.ProfilePhoto, customer.PanNumber, customer.Pincode, customer.EstablishYear, customer.ServieTaxNo, customer.CompanyName, customer.CityId); return result; }
/// <summary> /// Get information about Customer /// </summary> private void GetUserInfo() { if (_user.UserId != 0) { customer = TMSLibrary.CustomerMethods.GetCustomerInfo(_user.UserId); if (customer != null) { txtFname.Text = customer.FirstName.ToString(); txtLname.Text = customer.LastName.ToString(); txtMobileno.Text = customer.Mobile.ToString(); txtEmail.Text = customer.Email.ToString(); txtAddress.Text = customer.AddressLine; Fillddl(customer.CityId); CityId.Value = Convert.ToString(customer.CityId); ddlPincode.Enabled = true; ddlPincode.Items.FindByText(customer.Pincode).Selected = true; txtCity.Text = customer.CityName; txtCompanyname.Text = customer.CompanyName; txtServicetextno.Text = customer.ServieTaxNo; txtPanno.Text = customer.PanNumber; txtWebsite.Text = customer.Website; txtYear.Text = customer.EstablishYear; } } }