public static string Delete(int idCus) { CustomerData DCustomer = new CustomerData(); DCustomer.IdCustomer = idCus; return(DCustomer.Delete(DCustomer)); }
public static DataTable FindByNumDoc(string text) { CustomerData DCustomer = new CustomerData(); DCustomer.FindText = text; return(DCustomer.FindByNumDoc(DCustomer)); }
public override void Execute() { Log.Warn("Getting SalesForce activities for customer {0}", this.customerID); CustomerData customerData = new CustomerData(this, this.customerID, DB); customerData.Load(); SalesForceRetier.Execute(ConfigManager.CurrentValues.Instance.SalesForceNumberOfRetries, ConfigManager.CurrentValues.Instance.SalesForceRetryWaitSeconds, this.salesForce, () => { Result = this.salesForce.GetActivity(new GetActivityModel { Email = customerData.Mail, Origin = customerData.Origin }); }); if (this.salesForce.HasError) { DB.ExecuteNonQuery("SalesForceSaveError", CommandSpecies.StoredProcedure, new QueryParameter("Now", DateTime.UtcNow), new QueryParameter("CustomerID", this.customerID), new QueryParameter("Type", this.Name), new QueryParameter("Model", this.salesForce.Model), new QueryParameter("Error", this.salesForce.Error)); } }
static int AddCustomer(CustomerData customerData, DateTime CreatedDate) { Customer newCustomer = new Customer { FirstName = customerData.FirstName, LastName = customerData.LastName, Company = customerData.Company, EmailAddress = customerData.EmailAddress, WorkPhone = customerData.WorkPhone, HomePhone = customerData.HomePhone, Address = customerData.Address, City = customerData.City, State = customerData.State, ZipCode = customerData.ZipCode, Gender = customerData.Gender, BirthDate = customerData.BirthDate, FirstPurchaseDate = CreatedDate, LastPurchaseDate = CreatedDate }; SalesDbContext.Customers.Add(newCustomer); SalesDbContext.SaveChanges(); int newCustomerId = newCustomer.CustomerId; Console.Write("."); AddInvoice(newCustomerId, customerData.FirstInvoice, CreatedDate); return(newCustomerId); }
protected void CompleteOrderButton_Click(Object sender, System.EventArgs e) { // Get the current customer User user = (User)Session["User"]; Customer customer = CustomerData.FindCustomerByUserName(user.UserName); // Create the new order int orderID = OrderData.InsertOrder(customer); // Do order Completion Stuff and redirect to OrderConfirmation Page cart = (ShoppingCart)Session["cart"]; cartEnumerator = cart.GetCartContents(); while (cartEnumerator.MoveNext()) { LineItem lineItem = (LineItem)cartEnumerator.Value; OrderDetailData.InsertLineItem(orderID, lineItem); lineItem.Item.Quantity -= lineItem.Quantity; ProductData.UpdateQuantity(lineItem.Item); } // Empty the cart Session["cart"] = null; Response.Redirect("OrderConfirmation.aspx?orderID=" + orderID, true); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (storeData) { CustomerData.WriteXml <ObservableCollection <Customer> >(customers, "CustomersInfo.xml"); } }
public string SubmitCreateCustomerData(CustomerData CustomerData) { var User = System.Web.HttpContext.Current.User.Identity.Name; FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; string userData = ticket.UserData; string[] roles = userData.Split(','); string userRole = roles[0]; UserOpMap userOpMap = new UserOpMap(); BAL.BAL_Common bAL_Common = new BAL.BAL_Common(); userOpMap = bAL_Common.GetUserOperationMapping(HttpContext.Current.User.Identity.Name, userRole); EntitySubmittedResponse entitySubmittedResponse = new EntitySubmittedResponse(); System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); try { BAL.BAL_Customer bAL_Customer = new BAL.BAL_Customer(); long customerID = bAL_Customer.CreateCustomer(CustomerData, userOpMap); entitySubmittedResponse.submited = true; entitySubmittedResponse.message = "Customer Created!"; return js.Serialize("Customer Created!"); } catch (Exception ex) { entitySubmittedResponse.submited = false; entitySubmittedResponse.message = string.Format("Error occured while creating Customer with message:{0}", ex.Message); //return js.Serialize(entitySubmittedResponse); return js.Serialize(string.Format("Error occured while creating Customer with message:{0}", ex.Message)); } }
public List<CustomerData> GetCustomerList() { List<CustomerData> list = new List<CustomerData>(); List<Customer> customerList = new List<Customer>(); List<CustomerType> customerTypeList = new List<CustomerType>(); BAL.BAL_Customer bAL_Customer = new BAL.BAL_Customer(); customerList = bAL_Customer.GetCustomerList(); customerTypeList = bAL_Customer.GetCustomerType(); foreach (Customer customer in customerList) { CustomerData customerData = new CustomerData(); customerData.Id = customer.Id; customerData.Name = customer.Name; customerData.Addr1 = customer.AddressLineOne; customerData.Addr2 = customer.AddressLineTwo; customerData.City = customer.City; customerData.State = customer.State; customerData.EmailID = customer.EmailId; customerData.ContactNumber = Convert.ToString(customer.ContactNumber); foreach (CustomerType customerType in customerTypeList) { if (customer.CustomerTypeId == customerType.Id) { customerData.Type = customerType.TypeName; break; } else { continue; } } list.Add(customerData); } return list; }
private void PopulateResults(ListBox ResultList) { var Result = new List <CustomerData>(); foreach (CustomerDTO c in CustomersList) { var Customer = new CustomerData { Email = c.Email, Fullname = c.FullName, Id = c.Id }; Result.Add(Customer); } LoadingHolder.Visibility = System.Windows.Visibility.Collapsed; if (Result.Count == 0) { NoResults.Visibility = System.Windows.Visibility.Visible; } else { NoResults.Visibility = System.Windows.Visibility.Collapsed; } ResultList.ItemsSource = Result; FilterHolder.Visibility = System.Windows.Visibility.Visible; LoadingHolder.Visibility = System.Windows.Visibility.Collapsed; }
protected void OnClickUpdateCustomer(object sender, EventArgs e) { Customer customer = new Customer { Email = CustomerUpdate_Email.Text.Trim(), AccountCode = CustomerUpdate_AccountCode.Text.Trim(), FirstName = CustomerUpdate_FirstName.Text.Trim(), LastName = CustomerUpdate_LastName.Text.Trim(), FirstAddress = CustomerUpdate_FirstAddress.Text.Trim(), City = CustomerUpdate_City.Text.Trim(), Country = CustomerUpdate_Country.Text.Trim(), ZipCode = CustomerUpdate_ZipCode.Text.Trim(), Website = CustomerUpdate_Website.Text.Trim(), Active = CustomerUpdate_Active.Checked, PhoneNumber = CustomerUpdate_PhoneNumber.Text.Trim(), MobileNumber = CustomerUpdate_MobileNumber.Text.Trim(), FaxNumber = CustomerUpdate_FaxNumber.Text.Trim(), CustomerId = int.Parse(Request.QueryString["customerId"]) }; try { CustomerData.UpdateCustomer(customer); Response.Redirect("Admin.aspx", true); } catch (Exception) { lblMessageUpdate.Text = "It was not possible to update the customer"; dvMessageUpdate.CssClass = "alert alert-error"; dvMessageUpdate.Visible = true; } }
protected void BtnLoginSave_Click(object sender, EventArgs e) { Users ObjUser = new Users(); if (Page.IsPostBack) { Users.UserName = TextUserName.Text.Trim(); Users.UserPassword = TextPassword.Text.Trim(); CustomerData CusData = new CustomerData(); if (CusData.IsLoggedIn() > 0) { Session.Clear(); Session.RemoveAll(); Session["login_user"] = TextUserName.Text.Trim(); string CustomerId = Convert.ToString(Users.CustomerId); Session["_CustomerId"] = CustomerId; Response.Redirect("~/Customer.aspx"); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "alert('" + "Invalid User Name or Password" + "');", true); } } }
public void InsertCustomerData(CustomerData newData) { this.ConnectToDB(); try { String sqlCommand = @"INSERT INTO customer VALUES (@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10)"; using (SqlCommand cmd = new SqlCommand(sqlCommand, connection)) { String[] data = newData.GetData(); cmd.Parameters.AddWithValue("@p1", Int32.Parse(data[0])); cmd.Parameters.AddWithValue("@p2", data[1]); cmd.Parameters.AddWithValue("@p3", data[2]); cmd.Parameters.AddWithValue("@p4", data[3]); cmd.Parameters.AddWithValue("@p5", data[4]); cmd.Parameters.AddWithValue("@p6", data[5]); cmd.Parameters.AddWithValue("@p7", data[6]); cmd.Parameters.AddWithValue("@p8", data[7]); cmd.Parameters.AddWithValue("@p9", data[8]); cmd.Parameters.AddWithValue("@p10", data[9]); cmd.ExecuteNonQuery(); } } catch (Exception e) { Console.WriteLine(e.Message); this.CloseConnection(); } this.CloseConnection(); }
public async Task <ActionResult> GetCustomer() { CustomerData customerData = null; if (Request.Cookies["access"] != null) { Claim claim = User.FindFirst(ClaimTypes.NameIdentifier); if (claim != null) { Customer customer = await userManager.FindByIdAsync(claim.Value); if (customer != null) { customerData = new CustomerData { FirstName = customer.FirstName, LastName = customer.LastName, Email = customer.Email, Image = customer.Image }; } } } if (customerData != null) { return(Ok(customerData)); } return(Ok()); }
public CustomersData GetCustomers() { IEnumerable <Customer> customers = _raceService.GetCustomers(); IEnumerable <Bet> bets = _raceService.GetBets(); if (customers == null) { return(new CustomersData()); } IList <CustomerData> customersData = new List <CustomerData>(); foreach (Customer customer in customers) { CustomerData customerData = CreateCustomerData(customer, bets); customersData.Add(customerData); } decimal totalAmountForAllCustomers = Math.Round(customersData.Sum(c => c.TotalAmountOnBets), 2); return(new CustomersData { Customers = customersData, TotalAmountOnBetsForAll = totalAmountForAllCustomers }); }
public async Task <object> Info(AccountInformationModel request) { try { acc.REST_KeepLogRequest("", func.JsonSerialize(request)); CustomerData result = new CustomerData(); data = new List <CustomerData>(); data = cus.REST_GetAccountInformation(request.IDCard, request.BirthDay, ""); if (data.Count == 0) { return(NotFound(data)); } // profile = api.GetUserProfile(request.UserId); // if(profile.Result != null) // { // action.SP_InsertUserFollow( // request.UserId, // profile.Result.displayName, // profile.Result.pictureUrl, // profile.Result.statusMessage, // profile.Result.language // ); // } // result = data[0]; return(Ok(data)); } catch (Exception e) { acc.REST_KeepLogRequest(e.Message, func.JsonSerialize(request)); return(BadRequest(e.Message)); } }
protected override void Seed(MIS333K_Team11_FinalProjectV2.Models.AppUser.AppDbContext context) { // This method will be called after migrating to the latest version. GenreData AddGenres = new GenreData(); AddGenres.SeedGenres(context); MovieData AddMovies = new MovieData(); AddMovies.SeedMovies(context); ManagerData md = new ManagerData(); md.AddManager(context); CustomerData cd = new CustomerData(); cd.AddCustomer(context); EmployeeData ed = new EmployeeData(); ed.AddEmployee(context); // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != null) { try { string CustomerName, Phone, Address, City, PostalCode, Country; int Customer_Id; Customer_Id = Convert.ToInt32(textBox1.Text); CustomerName = textBox2.Text; Phone = textBox3.Text; Address = textBox4.Text; City = textBox5.Text; PostalCode = textBox6.Text; Country = textBox7.Text; CustomerData.InsertCustomerData(Customer_Id, CustomerName, Phone, Address, City, PostalCode, Country); MessageBox.Show("Customer Added Successful"); this.Hide(); } catch (Exception) { MessageBox.Show("Please fill the form"); } } else { MessageBox.Show("Id must be Needed"); } }
public void Get(Trade trade) { //获取店铺的基础数据 ShopData data = new ShopData(); ShopInfo shop = data.ShopInfoGetByNick(trade.Nick); //通过TOP接口查询该会员的详细数据并记录到数据库中 TopApiHaoping api = new TopApiHaoping(shop.Session); Customer customer = api.GetUserInfoByNick(trade); //先判断数据库里面是否该会员数据 CustomerData cdata = new CustomerData(); //把好评有礼的评价和优惠券数据加入顾客表 customer = cdata.InitHaopingData(customer); if (!cdata.IsHaveThisCustomer(trade)) { //如果有则通过会员接口插入会员基础数据 cdata.InsertCustomerData(trade, customer); } else { //根据订单数据更新会员数据 cdata.UpdateCustomerData(trade, customer); } }
public async Task <IActionResult> AddUserFeedBack([FromBody] FeedBackDto feedbackDto) { string CustomerData; try { string userId = null; userId = User.FindFirst("userId").Value; if (userId == null) { return(this.Ok(new ResponseEntity(HttpStatusCode.OK, "Invalid Token", userId, ""))); } CustomerData = await Task.FromResult(CustomerService.AddUserFeedBack(feedbackDto, userId)); if (!CustomerData.Contains("Not") && CustomerData != null) { return(this.Ok(new ResponseEntity(HttpStatusCode.OK, CustomerData, feedbackDto, ""))); } } catch { return(this.BadRequest(new ResponseEntity(HttpStatusCode.BadRequest, "Bad Request", null, ""))); } return(this.Ok(new ResponseEntity(HttpStatusCode.NoContent, CustomerData, null, ""))); }
public async Task <IActionResult> ModifyCustomer(int id, CustomerData CustData) { User user = await _auth.GetUser(this.User.Identity.Name); Permissions permissions = await _auth.GetPermissions(user.Id); if (permissions.UpdateCustomer == false) { return(Unauthorized()); } var custToPass = new Customer { FirstName = CustData.FirstName, LastName = CustData.LastName, CompanyName = CustData.CompanyName, PhoneNumber = CustData.PhoneNumber, Email = CustData.Email }; if (await _repo.ModifyCustomer(id, custToPass, CustData.CustAddressId)) { return(StatusCode(201)); } return(BadRequest("Could not find Customer")); }
// GET: Login public ActionResult Index(string Username, string Password) { //checks username if (Username == null) { return(View()); } //Convert Human Password to MD5 Hash value to match the database var md5 = MD5.Create(); Byte[] data = md5.ComputeHash(Encoding.ASCII.GetBytes(Password)); System.Text.StringBuilder s = new System.Text.StringBuilder(); foreach (byte b in data) { s.Append(b.ToString("x2").ToLower()); } string pass = s.ToString(); Debug.WriteLine(pass); //compare human and database password values Customer customer = CustomerData.GetCustomerByUsername(Username); if (customer == null || customer.Password.ToLower() != pass) { string flag = "true"; ViewBag.flag = flag; ViewBag.Message = "Username/Password is incorrect."; return(View()); } //create SessionId for the customer string sessionId = SessionData.CreateSession(customer.CustomerId); return(RedirectToAction("ViewGallery", "Gallery", new { sessionId })); }
public ActionResult Show(int?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var viewModel = new CustomerData(); var customer = db.Customers .Include(c => c.Owner) .Include(c => c.Locations) .Include(c => c.Contacts) .SingleOrDefault(c => c.Id == Id); if (customer == null) { return(new HttpNotFoundResult()); } PopulateCustomer(customer, viewModel); viewModel.Locations = customer.Locations; viewModel.Contacts = customer.Contacts; return(View(viewModel)); }
public EmailProgram(CustomerData customerData, string firstName, string lastName, string email) { Type = customerData; FirstName = firstName; LastName = lastName; Email = email; }
public ActionResult CheckOut(int CustomerId) { int P_ID, Qty; //create New Purchase Record PurchaseData.CreateNewPurchase(CustomerId); foreach (string key in Request.Form.AllKeys) { //Debug.WriteLine("Keys : : : " + key); //Debug.WriteLine("Value : : : " + Request[key]); if (key != "CheckOut") { P_ID = Convert.ToInt32(key); Qty = Convert.ToInt32(Request[key]); for (int i = 0; i < Qty; i++) { PurchaseData.InsertNewPurchses(P_ID); } } } //delete form Cart CartData.ClearCart(CustomerId); Customer customer_data = CustomerData.GetCustomerByCustomerId(CustomerId); string session = customer_data.SessionId; return(RedirectToAction("Index", "Purchases", new { sessionId = @session })); }
/// <summary> /// Default ctor needed for Xml and CodeDom serialization of strong-typed collections and /// for Essential Grid to be able to detect properties of items in strong-typed collections. /// </summary> public Customer() { this.custData = new CustomerData(); this.custData.id = ""; this.custData.firstName = ""; this.custData.lastName = ""; }
/// <summary> /// Specialized ctor /// </summary> /// <param name="ID"></param> public Customer(string ID) { this.custData = new CustomerData(); this.custData.id = ID; this.custData.firstName = ""; this.custData.lastName = ""; }
// GET: Cart public ActionResult ViewCart(string sessionId) { if (sessionId == null) { return(RedirectToAction("Index", "Login")); } // get cust id to match cust id w cart id Customer customer = CustomerData.GetCustomerBySessionId(sessionId); List <CartDetail> cart = CartData.GetCart(customer.CustomerId); ProductData pd = new ProductData(); List <Product> products = pd.GetAllProducts(); foreach (var cartitem in cart) { cartitem.Product = CartData.GetProductByProductId(cartitem.ProductId); } int cartQuantity = CartData.GetCartQuantity(customer.CustomerId); ViewData["SessionId"] = sessionId; ViewData["cart"] = cart; ViewData["products"] = products; ViewData["cartQuantity"] = cartQuantity; ViewData["cid"] = customer.CustomerId; return(View()); }
private void RefreshUI() { //刷新前先把之前的先删除 for (int i = 0; i < scrollTransBybtnCustomer.childCount; i++) { Destroy(scrollTransBybtnCustomer.GetChild(i).gameObject); } for (int i = 0; i < customerDataLst.Count; i++) { GameObject btnDetailDataPrefab = resSvc.LoadPrefab(PathDefine.btnCustomerPrefab, true); btnDetailDataPrefab.transform.SetParent(scrollTransBybtnCustomer); btnDetailDataPrefab.name += "_" + i; CustomerData customerData = customerDataLst[i]; SetText(GetTrans(btnDetailDataPrefab.transform, "txtCompanyName"), customerData.name); Button btnDetailData = btnDetailDataPrefab.GetComponent <Button>(); btnDetailData.onClick.AddListener(() => { ClickCustomerBtn(customerData); }); } }
public CustomerData AddCustomer(CustomerData customerData) { Customer customer = CustomerMapper.Convert(customerData); customerRepository.Add(customer); return(CustomerMapper.Convert(customer)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!Page.User.Identity.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } var customerId = Request.QueryString["customerId"]; if (string.IsNullOrEmpty(customerId)) { Response.Redirect("Admin.aspx", true); } var customer = CustomerData.GetCustomerById(int.Parse(customerId)); if (customer == null) { Response.Redirect("Admin.aspx", true); } FillFields(customer); dvMessageUpdate.Visible = false; lblMessageUpdate.Text = string.Empty; } }
public CustomerVM(IDataRepository repository) { this.repository = repository; if (repository == null) throw new ArgumentNullException(ExceptionMessages.RepositoryNull, (Exception)null); currentCustomer = new CustomerData(); cleanCustomer = new CustomerData(); currentCustomer.AddressChanged += UpdateIsDirty; BackingCustomer = new Customer(); saveHelper = new SaveHelper(repository, currentCustomer); }
public string Util_ShowCustomer(CustomerData Customer) { string sRet = ""; // sRet &= cCustomer.CustomerId & "<br/>" sRet += (string)("<a href=\"customers.aspx?action=view&id=" + Customer.Id); sRet += (string)("<br/>Value: " + FormatCurrency(Customer.TotalOrderValue, "")); return sRet; }
protected void Display_View() { pnl_viewall.Visible = false; List<OrderData> orderList = new List<OrderData>(); List<AddressData> aAddreses = new List<AddressData>(); List<Ektron.Cms.Commerce.Basket> basketList; OrderApi orderApi = new OrderApi(); BasketApi basketApi = new BasketApi(); // customer cCustomer = CustomerManager.GetItem(this.m_iID); m_iCustomerId = cCustomer.Id; this.ltr_id.Text = cCustomer.Id.ToString(); this.ltr_uname.Text = cCustomer.UserName; this.ltr_fname.Text = cCustomer.FirstName; this.ltr_lname.Text = cCustomer.LastName; this.ltr_dname.Text = cCustomer.DisplayName; this.ltr_ordertotal.Text = cCustomer.TotalOrders.ToString(); this.ltr_orderval.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.TotalOrderValue, defaultCurrency.CultureCode); this.ltr_pervalue.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.AverageOrderValue, defaultCurrency.CultureCode); // customer // orders Criteria<OrderProperty> orderCriteria = new Criteria<OrderProperty>(); orderCriteria.AddFilter(OrderProperty.CustomerId, CriteriaFilterOperator.EqualTo, m_iID); orderList = orderApi.GetList(orderCriteria); if (orderList.Count == 0) { ltr_orders.Text = this.GetMessage("lbl no orders"); } dg_orders.DataSource = orderList; dg_orders.DataBind(); // orders // addresses aAddreses = AddressManager.GetList(m_iID); if (aAddreses.Count == 0) { ltr_address.Text = this.GetMessage("lbl no addresses"); } dg_address.DataSource = aAddreses; dg_address.DataBind(); // addresses // baskets if (this.m_iID > 0) { basketList = basketApi.GetList(this.m_iID); if (basketList.Count == 0) { ltr_baskets.Text = this.GetMessage("lbl no baskets"); } dg_baskets.DataSource = basketList; dg_baskets.DataBind(); } }
public DataSet getAllCustomers() { try { CustomerData oCustomerData = new CustomerData(); return oCustomerData.getAllCustomer(); } catch (Exception ex) { throw ex; } }
public CustomerData Get() { string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("SELECT Customer_name, Cryptobank_iban FROM Customer")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { CustomerData customers = new CustomerData(); sda.Fill(customers.CustomersTable); return customers; } } } } }
public bool changePwd(CustomerBiz oCustomerBiz) { try { CustomerData oCustomerData = new CustomerData(); //Todo encrypt String pwdEncrypt = SHA256Encrypt(oCustomerBiz.Pwd); oCustomerBiz.Pwd = pwdEncrypt; return oCustomerData.changePwd(oCustomerBiz); } catch (Exception ex) { throw ex; } }
public void Add(Customer customer) { try { CustomerData cd = new CustomerData(); cd.FirstName = customer.FirstName; cd.LastName = customer.LastName; cd.MobileNumber = customer.MobileNumber; cd.Email = customer.Email; cd.Address = customer.Address; cd.cardId = customer.CardId; client.AddCustomer(cd); } catch (Exception ex) { throw ex; } }
public CustomerData GetCustomerCollection(string companyid,string customerid) { CustomerData tempitem = new CustomerData(); tempitem = GetCustomerCollection(companyid).Where(m => m.customer.id == customerid).Single(); return tempitem; }
public int insertShippingAddress(CustomerBiz oCustomerBiz) { try { CustomerData oCustomerData = new CustomerData(); return oCustomerData.insertShippingAddress(oCustomerBiz); } catch (Exception ex) { throw ex; } }
public int insertCustomer(CustomerBiz oCustomerBiz) { try { CustomerData oCustomerData = new CustomerData(); // Todo encryption String pwdEncrypt = SHA256Encrypt(oCustomerBiz.Pwd); oCustomerBiz.Pwd = pwdEncrypt; int iCheck=0; bool isUserExist = oCustomerData.isEmailExist(oCustomerBiz); if (isUserExist) { iCheck=1; } else { bool isSucc = oCustomerData.customerSignUp(oCustomerBiz); if (isSucc) iCheck=2; } return iCheck; } catch (Exception ex) { throw ex; } }
public DataSet getCustomerSavedAddress(CustomerBiz oCustomerBiz) { try { CustomerData oCustomerData = new CustomerData(); DataSet dsCustomerAdd = new DataSet(); dsCustomerAdd = oCustomerData.getCustomerSavedAddress(oCustomerBiz); return dsCustomerAdd; } catch (Exception ex) { throw ex; } }
private void InsertData() { bool ret = true; CustomerFlow cusFlow = new CustomerFlow(); CustomerData cusData = new CustomerData(); //cusData.CODE = CustomerFlow.GenerateCusCode(); cusData.CODE = txtCusCode.Text.Trim(); GetData(cusData); ret = cusFlow.InsertData(Authz.CurrentUserInfo.UserID, cusData); if (ret == false) Appz.ClientAlert(Page, cusFlow.ErrorMessage); else { ClearControls(); double LOID = cusFlow.GetLOID(cusData.CODE); LoadData(LOID.ToString()); Appz.ClientAlert(Page, "·Ó¡ÒèѴà¡çº¢éÍÁÙÅÅÙ¡¤éÒàÃÕºÃéÍÂ"); } }
private void UpdateData() { bool ret = true; CustomerFlow cusFlow = new CustomerFlow(); CustomerData cusData = new CustomerData(); cusData.CODE = txtCusCode.Text.Trim(); GetData(cusData); ret = cusFlow.UpdateData(Authz.CurrentUserInfo.UserID, cusData); if (ret == false) Appz.ClientAlert(Page, cusFlow.ErrorMessage); else { ClearControls(); LoadData(cusData.LOID.ToString()); Appz.ClientAlert(Page, "·Ó¡ÒÃá¡é䢢éÍÁÙÅÅÙ¡¤éÒàÃÕºÃéÍÂ"); } }
private void GetData(CustomerData cusData) { cusData.LOID = Convert.ToDouble(txtLOID.Text == "" ? "0" : txtLOID.Text); //-------------------- ª×èͺÃÔÉÑ·/ÅÙ¡¤éÒ --------------------------------------- if (radPersonal.Checked == true) { cusData.CUSTOMERTYPE = Constz.CustomerType.Personal.Code; cusData.IDENTITY = txtPersonID.Text.Trim(); cusData.TITLE = Convert.ToDouble(cmbTitle.SelectedItem.Value); cusData.NAME = txtFirstname.Text.Trim(); cusData.LASTNAME = txtLastname.Text.Trim(); } else if (radPrivate.Checked == true) { cusData.CUSTOMERTYPE = Constz.CustomerType.Company.Code; cusData.IDENTITY = txtTaxNumber.Text.Trim(); cusData.NAME = txtPrivateName.Text.Trim(); } else if (radOrganize.Checked == true) { cusData.CUSTOMERTYPE = Constz.CustomerType.Government.Code; cusData.NAME = txtOrganizeName.Text.Trim(); } cusData.MEMBERTYPE = Convert.ToDouble(cmbMemberType.SelectedItem.Value); cusData.EFDATE = dtpEFDate.DateValue; cusData.EPDATE = dtpEPDate.DateValue; //-------------------- à§×è͹䢡ÒêÓÃÐà§Ô¹ --------------------------------------- cusData.PAYMENT = cmbPaymentCondition.SelectedItem.Value; if (txtCreditPeriod.Text.Trim() != "") cusData.CREDITDAY = Convert.ToDouble(txtCreditPeriod.Text.Trim()); if (txtCreditAmount.Text.Trim() != "") cusData.CREDITAMOUNT = Convert.ToDouble(txtCreditAmount.Text.Trim()); //-------------------- ·ÕèÍÂÙèºÃÔÉÑ·/ÅÙ¡¤éÒ/ÊÁÒªÔ¡ --------------------------------------- cusData.BILLADDRESS = txtCusAddress.Text.Trim(); cusData.BILLROAD = txtCusRoad.Text.Trim(); cusData.BILLPROVINCE = Convert.ToDouble(cmbCusProvince.SelectedItem.Value); cusData.BILLAMPHUR = Convert.ToDouble(cmbCusAmphur.SelectedItem.Value); cusData.BILLTAMBOL = Convert.ToDouble(cmbCusDistrict.SelectedItem.Value); cusData.BILLZIPCODE = txtCusZipCode.Text.Trim(); cusData.BILLTEL = txtCusTel.Text.Trim(); cusData.BILLFAX = txtCusFax.Text.Trim(); cusData.BILLEMAIL = txtCusEmail.Text.Trim(); //-------------------- ª×èͼÙéµÔ´µèÍ --------------------------------------- cusData.CTITLE = Convert.ToDouble(cmbCTitle.SelectedItem.Value); cusData.CNAME = txtContactFirstname.Text.Trim(); cusData.CLASTNAME = txtContactLastname.Text.Trim(); cusData.CTEL = txtContactTel.Text.Trim(); cusData.CMOBILE = txtContactMobile.Text.Trim(); cusData.CEMAIL = txtContactEmail.Text.Trim(); cusData.CADDRESS = txtContactAddress.Text.Trim(); cusData.CROAD = txtContactRoad.Text.Trim(); cusData.CPROVINCE = Convert.ToDouble(cmbContactProvince.SelectedItem.Value); cusData.CAMPHUR = Convert.ToDouble(cmbContactAmphur.SelectedItem.Value); cusData.CTAMBOL = Convert.ToDouble(cmbContactDistrict.SelectedItem.Value); cusData.CZIPCODE = txtContactZipCode.Text.Trim(); //-------------------- ʶҹ·ÕèÊè§ÊÔ¹¤éÒ --------------------------------------- cusData.SENDPLACE = txtDeliveryPlace.Text.Trim(); cusData.DELIVERTYPE = cmbDeliveryBy.SelectedItem.Value; cusData.SENDADDRESS = txtDeliveryAddress.Text.Trim(); cusData.SENDROAD = txtDeliveryRoad.Text.Trim(); cusData.SENDPROVINCE = Convert.ToDouble(cmbDeliveryProvince.SelectedItem.Value); cusData.SENDAMPHUR = Convert.ToDouble(cmbDeliveryAmphur.SelectedItem.Value); cusData.SENDTAMBOL = Convert.ToDouble(cmbDeliveryDistrict.SelectedItem.Value); cusData.SENDZIPCODE = txtDeliveryZipCode.Text.Trim(); cusData.SENDTEL = txtDeliveryTel.Text.Trim(); cusData.SENDFAX = txtDeliveryFax.Text.Trim(); cusData.SENDEMAIL = txtDeliveryEmail.Text.Trim(); //-------------------- ËÁÒÂà赯 --------------------------------------- cusData.REMARK = txtRemark.Text.Trim(); }
public DataSet getCustomer(CustomerBiz oCustomerBiz,out string custStatus) { try { //Todo encryption String pwdEncrypt = SHA256Encrypt(oCustomerBiz.Pwd); oCustomerBiz.Pwd = pwdEncrypt; CustomerData oCustomerData = new CustomerData(); bool isStatus = false; bool isUserExist = oCustomerData.isUserExist(oCustomerBiz); DataSet dsCustomer = null; if (isUserExist) { dsCustomer = new DataSet(); dsCustomer = oCustomerData.getCustomer(oCustomerBiz); } if (dsCustomer!=null && dsCustomer.Tables.Count > 0) isStatus = true; if (isStatus) custStatus = "Inactive"; else custStatus = ""; return dsCustomer; } catch (Exception ex) { throw ex; } }
public SaveHelper(IDataRepository repository, CustomerData customerData) { this.customerData = customerData; this.repository = repository; }
protected void Process_ViewAddress() { AddressData aAddress = null; long originalAddressId = this.m_iID; //need to get customer before address update to see if default addresses have changed. cCustomer = CustomerManager.GetItem(m_iCustomerId); aAddress = this.m_iID > 0 ? (AddressManager.GetItem(this.m_iID)) : (new AddressData()); aAddress.Name = (string)txt_address_name.Text; aAddress.Company = (string)txt_address_company.Text; aAddress.AddressLine1 = (string)txt_address_line1.Text; aAddress.AddressLine2 = (string)txt_address_line2.Text; aAddress.City = (string)txt_address_city.Text; RegionData rData = new RegionData(); rData.Id = Convert.ToInt64(drp_address_region.SelectedValue); aAddress.Region = rData; aAddress.PostalCode = (string)txt_address_postal.Text; CountryData cData = new CountryData(); cData.Id = System.Convert.ToInt32(drp_address_country.SelectedValue); aAddress.Country = cData; aAddress.Phone = (string)txt_address_phone.Text; if (this.m_iID > 0) { AddressManager.Update(aAddress); } else { AddressManager.Add(aAddress, m_iCustomerId); } this.m_iID = aAddress.Id; bool updateBilling = false; bool updateShipping = false; if (chk_default_billing.Checked) { cCustomer.BillingAddressId = aAddress.Id; updateBilling = true; } if (chk_default_shipping.Checked) { cCustomer.ShippingAddressId = aAddress.Id; updateShipping = true; } //if the default addresses have been unchecked - need to reset them to 0. if (!chk_default_billing.Checked && cCustomer.BillingAddressId == originalAddressId) { cCustomer.BillingAddressId = 0; updateBilling = true; } if (!chk_default_shipping.Checked && cCustomer.ShippingAddressId == originalAddressId) { cCustomer.ShippingAddressId = 0; updateShipping = true; } if (updateBilling) { CustomerManager.ChangeBillingAddress(m_iCustomerId, cCustomer.BillingAddressId); } if (updateShipping) { CustomerManager.ChangeShippingAddress(m_iCustomerId, cCustomer.ShippingAddressId); } string pagemode = (string)("&page=" + Request.QueryString["page"]); Response.Redirect(this.m_sPageName + "?action=viewaddress&id=" + this.m_iID.ToString() + "&customerid=" + this.m_iCustomerId.ToString() + pagemode, false); }
public List<CustomerData> GetCustomerCollection(string companyid) { List<CustomerData> collection = new List<CustomerData>(); AppCustomer[] customers = GetAllCustomers(companyid); foreach (AppCustomer item in customers) { CustomerData tempitem = new CustomerData(); tempitem.customer = item; tempitem.address = GetAddress("",companyid, item.id); tempitem.contact = GetContact("",companyid, item.id); collection.Add(tempitem); } return collection; }
/// <summary> /// Indicates that the contact will undergo a cancellable edit. /// </summary> public void BeginEdit() { if (!this._editing) { this._backupData = this._data; this._editing = true; } }
/// <summary> /// Indicates that the contact will undergo a cancellable edit. /// </summary> public void BeginEdit() { if (!_editing) { _backupData = _data; _editing = true; } }
public string Util_ShowCustomer(CustomerData Customer) { string sRet = ""; sRet += "<a style=\"text-decoration:underline;\" href=\"customers.aspx?action=view&id=" + Customer.Id + "\">" + Customer.FirstName + " " + Customer.LastName + " (" + Customer.DisplayName + ")</a>"; sRet += (string)("<br/>Orders: " + Customer.TotalOrders); sRet += (string)("<br/>Value: " + defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(Customer.TotalOrderValue, defaultCurrency.CultureCode)); sRet += (string)("<br/>Avg Value: " + defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(Customer.AverageOrderValue, defaultCurrency.CultureCode)); return sRet; }
/// <summary> /// Initializes a customer object. /// </summary> public Customer() { this._delayPropertyChangeNotifications = true; this._data = new CustomerData(); this._data.RenewalDate = DateTime.Today; }
protected void Display_ViewAddress(bool WithEdit) { pnl_view.Visible = false; pnl_viewall.Visible = false; AddressData aAddress = null; RegionManager = new RegionApi(); Ektron.Cms.Common.Criteria<RegionProperty> regioncriteria = new Ektron.Cms.Common.Criteria<RegionProperty>(RegionProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending); if (!(this.m_iID > 0)) { regioncriteria.AddFilter(RegionProperty.CountryId, CriteriaFilterOperator.EqualTo, drp_address_country.SelectedIndex); } regioncriteria.PagingInfo.RecordsPerPage = 1000; drp_address_region.DataTextField = "Name"; drp_address_region.DataValueField = "Id"; drp_address_region.DataSource = RegionManager.GetList(regioncriteria); drp_address_region.DataBind(); Ektron.Cms.Common.Criteria<CountryProperty> addresscriteria = new Ektron.Cms.Common.Criteria<CountryProperty>(CountryProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending); addresscriteria.PagingInfo.RecordsPerPage = 1000; drp_address_country.DataTextField = "Name"; drp_address_country.DataValueField = "Id"; drp_address_country.DataSource = CountryManager.GetList(addresscriteria); drp_address_country.DataBind(); if (this.m_iID > 0) { cCustomer = CustomerManager.GetItem(this.m_iCustomerId); aAddress = AddressManager.GetItem(this.m_iID); regioncriteria.AddFilter(RegionProperty.CountryId, CriteriaFilterOperator.EqualTo, aAddress.Country.Id); drp_address_region.DataSource = RegionManager.GetList(regioncriteria); ltr_address_id.Text = aAddress.Id.ToString(); txt_address_name.Text = aAddress.Name; txt_address_company.Text = aAddress.Company; txt_address_line1.Text = aAddress.AddressLine1; txt_address_line2.Text = aAddress.AddressLine2; txt_address_city.Text = aAddress.City; drp_address_country.SelectedIndex = FindItem(aAddress.Country.Id, "country"); Util_BindRegions(aAddress.Country.Id); drp_address_region.SelectedValue = aAddress.Region.Id.ToString(); txt_address_postal.Text = aAddress.PostalCode; txt_address_phone.Text = aAddress.Phone; chk_default_billing.Checked = aAddress.Id == cCustomer.BillingAddressId; chk_default_shipping.Checked = aAddress.Id == cCustomer.ShippingAddressId; } ToggleAddressFields(WithEdit); }
/// <summary> /// Indicates that the edit completed and that changed fields should be committed. /// </summary> public void EndEdit() { if (this._editing) { if (this._delayPropertyChangeNotifications) { if (string.Compare(this._data.FirstName, this._backupData.FirstName, StringComparison.CurrentCulture) != 0) { RaisePropertyChanged("FirstName"); } if (string.Compare(this._data.LastName, this._backupData.LastName, StringComparison.CurrentCulture) != 0) { RaisePropertyChanged("LastName"); } if (this._data.Rating != this._backupData.Rating) { RaisePropertyChanged("Rating"); } if (this._data.RenewalDate != this._backupData.RenewalDate) { RaisePropertyChanged("RenewalDate"); } if (string.Compare(this._data.FullAddress, this._backupData.FullAddress, StringComparison.CurrentCulture) != 0) { RaisePropertyChanged("FullAddress"); } if (this._data.YearlyFees != this._backupData.YearlyFees) { RaisePropertyChanged("YearlyFees"); } if (this._data.IsRegistered != this._backupData.IsRegistered) { RaisePropertyChanged("IsRegistered"); } if (this._data.IsValid != this._backupData.IsValid) { RaisePropertyChanged("IsValid"); } if (this._data.Payment != this._backupData.Payment) { RaisePropertyChanged("Payment"); } if (this._data.Complaint != this._backupData.Complaint) { RaisePropertyChanged("Complaint"); } } this._backupData = new CustomerData(); this._editing = false; } }
public void Util_PopulateCustomer(CustomerData Customer) { ltr_customername.Text = "<a href=\"customers.aspx?action=view&id=" + Customer.Id + "\">" + Customer.FirstName + " " + Customer.LastName + " (" + Customer.DisplayName + ")</a>"; if (!(Customer.IsDeleted)) { ltr_customername.Text += " <a href=\"#\" onclick=\"$ektron('" + uxEmailDialog.Selector + "').dialog('open');EktronUiDialogInit('email'," + Customer.Id.ToString() + ") \"><img alt=\"" + GetMessage("btn email") + "\" title=\"" + GetMessage("btn email") + "\" src=\"" + m_refContentApi.AppPath + "Images/ui/icons/email.png\" /></a>"; HttpBrowserCapabilities browser = Request.Browser; Ektron.Cms.Framework.Context.CmsContextService context = new Ektron.Cms.Framework.Context.CmsContextService(); if (browser.Type.Contains("IE") && browser.MajorVersion >= 9) { // work around to prevent errors in IE9 when it destroys native JS objects // see http://msdn.microsoft.com/en-us/library/gg622929%28v=VS.85%29.aspx uxEmailIframe.Attributes.Add("src", "about:blank"); uxCouponIframe.Attributes.Add("src", "about:blank"); } //else //{ // uxEmailIframe.Attributes.Add("src", context.SitePath + "../email.aspx?userarray=" + Customer.Id.ToString() + "&fromModal=true&width=500&height=620&scrolling=true&modal=true"); //} //uxEmailDialog.Title = m_refMsg.GetMessage("btn email"); jsUxDialogSelectorTxt.Text = uxEmailDialog.Selector.ToString(); jsUxCouponDlgSelectorTxt.Text = uxCouponDialog.Selector.ToString(); } ltr_customerorders.Text = Customer.TotalOrders.ToString(); ltr_customertotal.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(Customer.TotalOrderValue, defaultCurrency.CultureCode); ltr_customeravg.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(Customer.AverageOrderValue, defaultCurrency.CultureCode); }