public ActionResult Index() { try { var customerId = CustomerId(); if (customerId == 0) { return(Redirect("/Me/JoinUs/Index")); } ViewData["CustomerName"] = CustomerName(); ViewData["WeixinUser"] = WeiXinUser(); LogManager.GetLogger().Info("customerId:" + customerId); ViewData["CustoemrBase"] = CustomerBase.FindById(customerId); var customerCards = CustomerCard.FindByList(customerId: customerId); ViewData["CustomerCards"] = customerCards; var orderBases = OrderBaseInfo.FindByList(customerId: customerId); ViewData["OrderBases"] = orderBases; ViewData["CustomerBases"] = CustomerBase.FindByList(parentId: customerId); } catch (Exception ex) { LogManager.GetLogger().Error(ex); } return(View()); }
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static void BindService(grpc::ServiceBinderBase serviceBinder, CustomerBase serviceImpl) { serviceBinder.AddMethod(__Method_GetCustomer, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcGreeter.CustomerRequest, global::GrpcGreeter.CustomerModel>(serviceImpl.GetCustomer)); serviceBinder.AddMethod(__Method_GetAllCustomers, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod <global::GrpcGreeter.CustomerRequest, global::GrpcGreeter.CustomerModel>(serviceImpl.GetAllCustomers)); serviceBinder.AddMethod(__Method_AddCustomer, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcGreeter.CustomerModel, global::GrpcGreeter.CustomerAddedResult>(serviceImpl.AddCustomer)); serviceBinder.AddMethod(__Method_AddCustomers, serviceImpl == null ? null : new grpc::ClientStreamingServerMethod <global::GrpcGreeter.CustomerModel, global::GrpcGreeter.CustomerAddedResult>(serviceImpl.AddCustomers)); }
/// <summary> /// 我的提成 /// </summary> /// <returns></returns> public ActionResult SalesCommissions() { try { var customerId = CustomerId(); ViewData["CustomerName"] = CustomerName(); ViewData["WeixinUser"] = WeiXinUser(); ViewData["CustomerBase"] = CustomerBase.FindById(customerId); var customerBases = CustomerBase.FindByList(parentId: customerId); var orderBases = OrderBaseInfo.FindByList(); orderBases = orderBases.Where(p => customerBases.Any(c => c.Id == p.CustomerId)).ToList(); ViewData["OrderBases"] = orderBases; ViewData["CustomerOrderCommissions"] = CustomerOrderCommission.FindByList(customerId: customerId); ViewData["CustomerWithdrawalRecords"] = CustomerWithdrawalRecord.FindByList(customerId: customerId); } catch (Exception ex) { LogManager.GetLogger().Error(ex); } return(View()); }
private void btnDelete_Click(object sender, EventArgs e) { try { cust = Fac.GetCustomer(txtCustomerName.Text); if (cust != null) { string returnMessage = Fac.DeleteCustomer(cust); if (returnMessage == "SUCCESS") { MessageBox.Show("Customer renoved successfully"); } else if (returnMessage == "FAILED") { MessageBox.Show("Unable to remove custome right now ,pleas try later"); } else { MessageBox.Show(returnMessage); } } ClearForm(); } catch (Exception ex) { } }
private void cmbCustomerType_SelectedIndexChanged(object sender, EventArgs e) { cust = Factory.Create(cmbCustomerType.Text); txtBillingDate.Text = DateTime.Now.ToString(); txtBillingAmount.Text = "0"; Clear(); }
private void btnUOW_Click(object sender, EventArgs e) { IUow uow = FactoryDalLayer <IUow> .Create("EfUOW"); try { CustomerBase cust1 = new CustomerBase(); cust1.CustomerType = "Admin"; cust1.CustomerName = "Cust1"; // Unit of work Idal.SetUnitWork(uow); Idal.Add(cust1); // In memory cust1 = new CustomerBase(); cust1.CustomerType = "Admin"; cust1.CustomerName = "Cust2"; cust1.Email = "*****@*****.**"; IRepository <CustomerBase> dal1 = FactoryDalLayer <IRepository <CustomerBase> > .Create(DalLayer.Text); // Unit dal1.SetUnitWork(uow); dal1.Add(cust1); // In memory uow.Committ(); } catch (Exception ex) { uow.RollBack(); MessageBox.Show(ex.Message.ToString()); } }
public void SaveAll() { AdoEFUOW.ADoEFUow o = new AdoEFUOW.ADoEFUow(); o.CustomerDal = CustomerDal; o.AddressDal = AddressDal; o.PhoneDal = PhoneDal; CustomerBase y = Factory <CustomerBase> .Create(cust.Type); y.Id = cust.Id; y.CustomerName = cust.CustomerName; y.PhoneNumber = cust.PhoneNumber; y.Address = cust.Address; y.BillAmount = cust.BillAmount; y.BillDate = cust.BillDate; CustomerDal.AddInMemory(y); foreach (AddressPhone a in cust.Addresses) { AddressBase a1 = Factory <AddressBase> .Create("Address"); a1.Address1 = a.Address1; AddressDal.AddInMemory((AddressBase)a); foreach (PhoneBase i in a.Phones) { PhoneDal.AddInMemory((PhoneBase)i); } } o.Committ(); }
protected override void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { base.CommonControl_BindingComplete(sender, e); if (this.EditableMode) { if (sender.Equals(this.bindingSalespersonID) && this.combexSalespersonID.SelectedItem != null) { EmployeeBase customerBase = (EmployeeBase)this.combexSalespersonID.SelectedItem; this.deliveryAdviceViewModel.TeamID = customerBase.TeamID; } if (sender.Equals(this.bindingCustomerID) && this.combexCustomerID.SelectedItem != null) { CustomerBase customerBase = (CustomerBase)this.combexCustomerID.SelectedItem; this.deliveryAdviceViewModel.CustomerName = customerBase.Name; //HERE: CHANGE => DONT SET setDirty: SEE ApplyPropertyChange FOR MORE INFO //THIS CommonControl_BindingComplete WILL BE RAISED FOR EVERY BINDING => SO WE CAN NOT UPDATE RELATIVE PROPERTY BY THIS WAY. SHOULD THINK OF NEW WAY FOR UPDATE SUCH RELATIVE PROPERTY (SUCH AS: ContactInfo, ShippingAddress OF Customer) //this.deliveryAdviceViewModel.ContactInfo = customerBase.ContactInfo; //this.deliveryAdviceViewModel.ShippingAddress = customerBase.ShippingAddress; } if (sender.Equals(this.bindingReceiverID) && this.combexReceiverID.SelectedItem != null) { CustomerBase receiverBase = (CustomerBase)this.combexReceiverID.SelectedItem; this.deliveryAdviceViewModel.ReceiverName = receiverBase.Name; //THIS CommonControl_BindingComplete WILL BE RAISED FOR EVERY BINDING => SO WE CAN NOT UPDATE RELATIVE PROPERTY BY THIS WAY. SHOULD THINK OF NEW WAY FOR UPDATE SUCH RELATIVE PROPERTY (SUCH AS: ContactInfo, ShippingAddress OF Receiver) //this.deliveryAdviceViewModel.ContactInfo = receiverBase.ContactInfo; //this.deliveryAdviceViewModel.ShippingAddress = receiverBase.ShippingAddress; } } }
public static CustomerBase GetCustomer(string customerID) { CustomerBase customer = new CustomerBase(); DataTable dtCustomers = new DataTable(); string sql = $"Select * From Customers Where CustomerID= '{customerID}'"; SqlDataAdapter da; OpenDB(); da = new SqlDataAdapter(sql, con); da.FillSchema(dtCustomers, SchemaType.Source); da.Fill(dtCustomers); CloseDB(); DataRow CurrentRow = dtCustomers.Rows[0]; customer.CustomerID = CurrentRow["CustomerID"].ToString(); customer.CompanyName = CurrentRow["CompanyName"].ToString(); customer.ContactName = CurrentRow["ContactName"].ToString(); customer.ContactTitle = CurrentRow["ContactTitle"].ToString(); customer.Address = CurrentRow["Address"].ToString(); customer.City = CurrentRow["City"].ToString(); customer.Region = CurrentRow["Region"].ToString(); customer.PostalCode = CurrentRow["PostalCode"].ToString(); customer.Country = CurrentRow["Country"].ToString(); customer.Phone = CurrentRow["Phone"].ToString(); customer.Fax = CurrentRow["Fax"].ToString(); return(customer); }
private void btnAdd_Click(object sender, EventArgs e) { try { cust = Factory.Create(cmbCustomerType.Text); cust.CustomerName = txtCustomerName.Text; cust.Address = txtAddress.Text; cust.PhoneNumber = txtPhoneNumber.Text; if (cust.GetType() != typeof(LeadCustomer)) { cust.BillDate = Convert.ToDateTime(txtBillingDate.Text); cust.BillAmount = Convert.ToDecimal(txtBillingAmount.Text); } cust.CustomerType = cmbCustomerType.Text; string returnMessage = Fac.AddCustomer(cust); if (returnMessage == "SUCCESS") { MessageBox.Show("Customer saved successfully"); } else if (returnMessage == "FAILED") { MessageBox.Show("Unable to save custome right now ,pleas try later"); } else { MessageBox.Show(returnMessage); } Clear(); LoadGridView(); } catch (Exception ex) { } }
private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e) { if (e.BindingCompleteState == BindingCompleteState.Exception) { ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true; } if (sender.Equals(this.bindingCustomerID)) { if (this.combexCustomerID.SelectedItem != null) { CustomerBase customerBase = (CustomerBase)this.combexCustomerID.SelectedItem; this.salesOrderViewModel.CustomerName = customerBase.Name; this.salesOrderViewModel.ContactInfo = customerBase.ContactInfo; this.salesOrderViewModel.SalespersonID = customerBase.SalespersonID; //this.salesOrderViewModel.ReceiverID = customerBase.CustomerID; } } if (sender.Equals(this.bindingReceiverID)) { if (this.combexReceiverID.SelectedItem != null) { CustomerBase customerBase = (CustomerBase)this.combexReceiverID.SelectedItem; this.salesOrderViewModel.ReceiverName = customerBase.Name; this.salesOrderViewModel.ShippingAddress = customerBase.ShippingAddress; } } }
private void cmbCustomerType_SelectedIndexChanged(object sender, EventArgs e) { if (cust == null) { cust = Factory <CustomerBase> .Create(cmbCustomerType.Text); } }
static void Main(string[] args) { IDataLayer <CustomerBase> dalcust = FactoryDal <CustomerBase> .getDal("EfCustDal"); IDataLayer <AddressBase> daladd = FactoryDal <AddressBase> .getDal("EfAddDal"); IDataLayer <PhoneBase> dalphone = FactoryDal <PhoneBase> .getDal("EfPhoneDal"); Mediator.Mediator obj = new Mediator.Mediator(dalcust, daladd, dalphone); CustomerBase c = Factory <CustomerBase> .Create("Customer"); c.CustomerName = "tesy123"; c.PhoneNumber = "90909"; c.BillDate = Convert.ToDateTime("1/1/2010"); c.Type = "Customer"; c.BillAmount = 100; obj.Add(c); AddressBase a = Factory <AddressBase> .Create("Address"); a.Address1 = "Mulund"; obj.Add(a); PhoneBase p = Factory <PhoneBase> .Create("Phone"); p.PhoneNumber = "222"; obj.Add(p, 0); obj.SaveAll(); }
/// <summary> /// 新增客户资料数据(包含文件上传) /// </summary> /// <param name="_UA01">实体类</param> /// <returns>影响行数</returns> public int AddCustomerBase(CustomerBase _CustomerBase, Appendix _Appendix) { try { CreateSqlHandler <Appendix> _CreateSqlHandlerAppendix = new CreateSqlHandler <Appendix>(); CreateSqlHandler <CustomerBase> _CreateSqlHandlerCustomerBase = new CreateSqlHandler <CustomerBase>(); //生成CA01Sql语句 string strCA01Sql = _CreateSqlHandlerCustomerBase.Insert(_CustomerBase, "CA01"); //生成GA07Sql语句 string strGA07Sql = _CreateSqlHandlerAppendix.Insert(_Appendix, "GA07"); int num = Math.Abs(Provider.ExecuteNonQuery("PRO_CA01", 1, new SqlParameter[] { new SqlParameter() { ParameterName = @"sqlCA01", Value = strCA01Sql, DbType = DbType.String }, new SqlParameter() { ParameterName = @"sqlGA07", Value = strGA07Sql, DbType = DbType.String }, new SqlParameter() { ParameterName = @"CA01999", Value = _CustomerBase.CA01999, DbType = DbType.String } })); return(num); } catch (Exception ex) { throw ex; } }
private void btnUOW_Click(object sender, EventArgs e) { IUow uow = FactoryDalLayer <IUow> .Create("EfUOW"); try { CustomerBase cust1 = new CustomerBase(); cust1.CustomerType = "Lead"; cust1.CustomerName = "Cust1"; // Unit of work Idal.SetUnitWork(uow); Idal.Add(cust1); // In memory cust1 = new CustomerBase(); cust1.CustomerType = "Lead"; cust1.CustomerName = "Cust2"; cust1.Address = "dzxcczxcxzcxzcsdhksjahdkjsahkdjhsakjdh kjashdkjahsd kjahskjdh kajsdhasd"; IRepository <CustomerBase> dal1 = FactoryDalLayer <IRepository <CustomerBase> > .Create(DalLayer.Text); // Unit dal1.SetUnitWork(uow); dal1.Add(cust1); // In memory uow.Committ(); } catch (Exception ex) { uow.RollBack(); MessageBox.Show(ex.Message.ToString()); } }
private void btnUOW_Click(object sender, EventArgs e) { IUow uow = FactoryDAL <IUow> .Create("EFUow"); try { CustomerBase cust1 = new CustomerBase(); cust1.CustomerType = "Lead"; cust1.CustomerName = "Cust1"; cust1.BillDate = Convert.ToDateTime(txtBillingDate.Text); IRepository <CustomerBase> dal1 = FactoryDAL <IRepository <CustomerBase> > .Create(DalLayer.Text); dal1.SetUnitOfWork(uow); dal1.Add(cust1); CustomerBase cust2 = new CustomerBase(); cust2.CustomerType = "Lead"; cust2.CustomerName = "Cust2"; cust2.BillDate = Convert.ToDateTime(txtBillingDate.Text); cust2.Address = "111111111111111111111111111111111111111111111111111111111111111"; IRepository <CustomerBase> dal2 = FactoryDAL <IRepository <CustomerBase> > .Create(DalLayer.Text); dal2.SetUnitOfWork(uow); dal2.Add(cust2); uow.Commit(); } catch (Exception ex) { uow.RollBack(); MessageBox.Show(ex.Message); } }
public void ReturnNull_WhenCustomerIDIsNotFound() { CustomerBase customerBase = new CustomerBase(); customerBase.Add(new Customer("Jackson", 1234)); customerBase.Add(new Customer("Roger", 5678)); Assert.IsNull(customerBase.Find(3333)); }
public void ReturnFalse_WhenNameIsAnEmptyStringOrNull() //WORKING { CustomerBase customerBase = new CustomerBase(); Assert.IsFalse(customerBase.Add(new Customer("", 4444))); Assert.IsFalse(customerBase.Add(new Customer(null, 2222))); Assert.IsTrue(customerBase.getListSize() == 0); }
public void ReturnTrue_WhenOnlyCustomerIdIsEdited() { CustomerBase customerBase = new CustomerBase(); Customer customer = new Customer("Joey", 5746); customerBase.Add(customer); Assert.IsTrue(customerBase.Edit(customer.PrimaryKey, 4398)); }
public void ReturnTrue_WhenOnlyCustomerNameIsEdited() { CustomerBase customerBase = new CustomerBase(); Customer customer = new Customer("Abraham", 7234); customerBase.Add(customer); Assert.IsTrue(customerBase.Edit(customer.PrimaryKey, 7234, "Isaac")); }
public void ReturnTrue_WhenOneCustomerIsAdded() //WORKING { CustomerBase customerBase = new CustomerBase(); Assert.IsTrue(customerBase.getListSize() == 0); Assert.IsTrue(customerBase.Add(new Customer("John", 1234))); Assert.IsTrue(customerBase.getListSize() == 1); }
private CustomerBase CreateModel(CustomerBaseBindingModel model, CustomerBase custBase) { custBase.Surname = model.Surname; custBase.Name = model.Name; custBase.Lastname = model.Lastname; custBase.DateOfBirthday = model.DateOfBirthday; return(custBase); }
public void ReturnFalse_WhenCustomerIdDoesNotExist() { CustomerBase customerBase = new CustomerBase(); Customer customer = new Customer("Larry", 8855); customerBase.Add(customer); Assert.IsFalse(customerBase.Edit(0090, 4430, "Larry")); }
public static Customer AddCustomer(ICustomerAdapter adapter, CustomerBase customer) { var newCustomer = (Customer)customer; newCustomer.Id = Guid.NewGuid(); return(adapter.AddCustomer(newCustomer)); }
public void ReturnTrue_WhenBothCustomerNameAndIdAreEdited() { CustomerBase customerBase = new CustomerBase(); Customer customer = new Customer("Coby", 72343); customerBase.Add(customer); Assert.IsTrue(customerBase.Edit(customer.PrimaryKey, 8253, "Ryan")); }
/// <summary>Creates service definition that can be registered with a server</summary> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static grpc::ServerServiceDefinition BindService(CustomerBase serviceImpl) { return(grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetCustomer, serviceImpl.GetCustomer) .AddMethod(__Method_GetAllCustomers, serviceImpl.GetAllCustomers) .AddMethod(__Method_AddCustomer, serviceImpl.AddCustomer) .AddMethod(__Method_AddCustomers, serviceImpl.AddCustomers).Build()); }
public void Add(CustomerBase obj) { // Automapper cust.CustomerName = obj.CustomerName; cust.BillAmount = obj.BillAmount; cust.BillDate = obj.BillDate; cust.Address = obj.Address; }
public void ReturnFalse_WhenCustomerIdDoesNotExist() { CustomerBase customerBase = new CustomerBase(); customerBase.Add(new Customer("Abraham", 8734)); customerBase.Add(new Customer("Lincoln", 9010)); Assert.IsFalse(customerBase.Delete(7777)); Assert.IsTrue(customerBase.getListSize() == 2); }
public void ReturnFalse_WhenIDAlreadyExists() //WORKING { CustomerBase customerBase = new CustomerBase(); customerBase.Add(new Customer("Gibran", 1111)); customerBase.Add(new Customer("Cody", 2222)); customerBase.Add(new Customer("James", 3333)); Assert.IsFalse(customerBase.Add(new Customer("Michael", 3333))); }
private void ClearCustomer() { txtCustomerName.Text = ""; txtPhoneNumber.Text = ""; txtBillingDate.Text = DateTime.Now.Date.ToString(); txtBillingAmount.Text = ""; txtAddress.Text = ""; cust = Factory <CustomerBase> .Create(cmbCustomerType.Text); }