public object HelloWorld(Customer formData, params object[] parameters) { var request = new Customer(); request.AccountNumber = "49468-9"; request.CustomerId = 10; request.Bank = new Bank { BankId = 1, Name = "Itau" }; return request; }
/// <summary> /// This method creates an user for an existing customer /// </summary> public MembershipCreateStatus InsertUserForCustomer(Customer originalCustomer, User user) { var membershipManager = new MembershipManager(this); MembershipCreateStatus status; membershipManager.Insert(user, out status, true); if (status == MembershipCreateStatus.Success) { originalCustomer.UserId = user.UserId; DbContext.SubmitChanges(); return MembershipCreateStatus.Success; } return status; }
/// <summary> /// This method just change the username of user attached with customer /// </summary> /// <param name="originalCutomer"></param> /// <param name="newUserName"></param> /// <returns></returns> public void UpdateUserNameOfCustomer(Customer originalCutomer, String newUserName) { originalCutomer.User.UserName = newUserName; DbContext.SubmitChanges(); }
public void Update(Customer original_entity, Customer entity) { original_entity.CopyPropertiesFrom(entity); original_entity.ModifiedDate = DateTime.Now; DbContext.SubmitChanges(); }
/// <summary> /// This method insert an customer and an user atached /// this method return true when customer and user inserted /// </summary> public MembershipCreateStatus Insert(Customer customer, User user) { MembershipCreateStatus status; var companyManager = new CompanyManager(this); var membershipManager = new MembershipManager(this); membershipManager.Insert(user, out status, true); // // creates an new user // if (status == MembershipCreateStatus.Success) { customer.UserId = user.UserId; customer.CreatedDate = customer.ModifiedDate = DateTime.Now; Insert(customer); return MembershipCreateStatus.Success; } return status; }
public void Insert(Customer entity) { /* * if this customer is already company's customer don't register him * To validate the best method is search customers by cpf or cnpj */ if (entity != null && ExistCustomer(entity)) return; if (entity != null) { entity.CreatedDate = entity.ModifiedDate = DateTime.Now; DbContext.Customers.InsertOnSubmit(entity); DbContext.SubmitChanges(); } }
public bool ExistCustomer(Customer customer) { return CheckExistCustomer(customer).CustomerId != 0; }
/// <summary> /// This method returns true if the customer already exists /// </summary> /// <param name="customer">Can't be null</param> /// <returns>a boolean that indicates if the customer exists</returns> public Customer CheckExistCustomer(Customer customer) { if (customer.LegalEntityProfileId.HasValue) customer = GetCustomerByLegalEntityProfile(customer.CompanyId, customer.LegalEntityProfileId.Value) ?? customer; else if (customer.ProfileId.HasValue) customer = GetCustomerByProfile(customer.CompanyId, customer.ProfileId.Value) ?? customer; return (customer); }
/// <summary> /// Method to add a new COMPANY in a CUSTOMER of the HOST COMPANY /// </summary> /// <param name="newCompany"></param> private Int32 AddCompanyAsCustomer(Company newCompany) { var customerManager = new CustomerManager(this); var customer = new Customer(); customer.CompanyId = GetHostCompany().CompanyId; customer.LegalEntityProfileId = newCompany.LegalEntityProfileId; if (customerManager.ExistCustomer(customer)) customer = customerManager.GetCustomerByLegalEntityProfile(customer.CompanyId, Convert.ToInt32(customer.LegalEntityProfileId)); else customerManager.Insert(customer); return customer.CustomerId; }
public void Add(Customer customer) { this.customer = customer; }