/// <summary> /// Get Customer /// </summary> /// <param name="customerID"></param> /// <param name="transaction"></param> /// <returns></returns> public CustomerInformation GetCustomer(int customerID, out TransactionalInformation transaction) { transaction = new TransactionalInformation(); CustomerInformation customerInformation = new CustomerInformation(); try { _customerDataService.CreateSession(); Customer customer = _customerDataService.GetCustomer(customerID); customerInformation = PopulateCustomerInformation(customer); } catch (Exception ex) { transaction.ReturnMessage = new List <string>(); string errorMessage = ex.Message; transaction.ReturnStatus = false; transaction.ReturnMessage.Add(errorMessage); } finally { _customerDataService.CloseSession(); } return(customerInformation); }
/// <inheritdoc/> public async Task <DriveItem> CreateFolder(CustomerInformation customerInfo) { DriveItem folder = null; GraphServiceClient graphServiceClient = await this.GetGraphServiceClient(); var timeStampRemovedSpecialChars = Regex.Replace(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"), "[^a-zA-Z0-9_.]+", string.Empty, RegexOptions.Compiled); try { var driveItem = new DriveItem { Name = $"{customerInfo.FirstName} {customerInfo.LastName} {timeStampRemovedSpecialChars}", Folder = new Folder { }, AdditionalData = new Dictionary <string, object>() { { "@microsoft.graph.conflictBehavior", "rename" }, }, }; if (graphServiceClient != null) { folder = await graphServiceClient.Groups[this.configuration["GroupId"]].Drive.Items[this.configuration["ChannelFilesFolderId"]].Children .Request() .AddAsync(driveItem); } } catch (Exception e) { this.logger.LogError(e.Message + ' ' + e.StackTrace); } return(folder); }
//详细查看客户的方法 public int EditCustomerInformation(CustomerInformation customerInformation) { db.Entry(customerInformation).State = System.Data.Entity.EntityState.Modified; int res = db.SaveChanges(); return(res); }
public void AddCustomerInformation(CustomerInformation customer) { // serialize customer info var stringObject = JsonConvert.SerializeObject(customer); _session.SetString("customer-info", stringObject); }
//新增客户 public ActionResult AddCustomerInformation(CustomerInformation customerInformation) { string IDCard = customerInformation.CustomerIDCard; string BirthDay = ""; string strYear; string strMonth; string strDay; if (IDCard.Length == 15) { strYear = IDCard.Substring(6, 4); strMonth = IDCard.Substring(10, 2); strDay = IDCard.Substring(12, 2); BirthDay = strYear + "-" + strMonth + "-" + strDay; customerInformation.dateOfBirth = BirthDay.AsDateTime(); } if (IDCard.Length == 18) { strYear = IDCard.Substring(6, 4); strMonth = IDCard.Substring(10, 2); strDay = IDCard.Substring(12, 2); BirthDay = strYear + "-" + strMonth + "-" + strDay; customerInformation.dateOfBirth = BirthDay.AsDateTime(); } Bll.AddCustomerInformation(customerInformation); return(RedirectToAction("Customer")); }
private IMessageActivity CreateMessageActivityForTeamsChannel(CustomerInformation customer, string messageText, Attachment attachment) { var replyMessage = Activity.CreateMessageActivity(); var onBehalfOfObj = new[] { new Dictionary <string, object> { ["itemid"] = 0, ["mentionType"] = "person", ["mri"] = "29:orgid:ee6f58c7-631b-4170-aa47-88f0a9164903", // random GUID ["displayName"] = customer.FirstName + " " + customer.LastName, }, }; replyMessage.ChannelData = new Dictionary <string, object> { ["OnBehalfOf"] = onBehalfOfObj, }; replyMessage.Text = messageText; if (attachment != null) { replyMessage.Attachments.Add(attachment); } return(replyMessage); }
//The ActionResult is a return TYPE. //SignIn is the method name. //FormCollection collection is the parameter. public ActionResult GetAllAccounts() { var accounts = CustomerInformation.GetAllCustomerInformationByEmail(User.Identity.GetUserName()); //Prints out the all accounts in the html. return(View(accounts)); }
private void AssignPatchParameters(JsonPatchDocument <CustomerInformation> customerInfo, CustomerInformation customerInformation) { customerInformation.Customer.PatchParameters = new List <string>(); if (customerInformation.Customer.CustomerGeneral.CustomerType.ToString() == Attributes.CustomerType.Customer) { customerInfo.Operations.ForEach(item => { if (item.ParsedPath.Count() > 0) { var path = item.Path; string attributeName = string.Empty; if (parameterService.MapCustomer.TryGetValue(item.Path, out attributeName)) { customerInformation.Customer.PatchParameters.Add(attributeName); } } }); } else if (customerInformation.Customer.CustomerGeneral.CustomerType.ToString() == Attributes.CustomerType.Account) { customerInfo.Operations.ForEach(item => { if (item.ParsedPath.Count() > 0) { var path = item.Path; string attributeName = string.Empty; if (parameterService.MapAccount.TryGetValue(item.Path, out attributeName)) { customerInformation.Customer.PatchParameters.Add(attributeName); } } }); } }
public async Task <bool> Create(CustomerInformation request) { //update the stocks from db var stockOnHold = _db.StocksOnHold.Where(x => x.SessionId == request.SessionId).ToList(); //remove the stock we are holding for this customer _db.StocksOnHold.RemoveRange(stockOnHold); var order = new Order { OrderRef = CreateOrderReference(), StripeReference = request.StripeReference, FirstName = request.FirstName, LastName = request.LastName, Email = request.Email, PhoneNumber = request.PhoneNumber, Adress1 = request.Adress1, Adress2 = request.Adress2, City = request.City, PostCode = request.PostCode, OrderStocks = request.Stocks.Select(x => new OrderStock { StockId = x.StockId, Qty = x.Qty }).ToList() }; _db.Orders.Add(order); return(await _db.SaveChangesAsync() > 0); }
public void GetCustomerInformationTest() { var customerInformation = new CustomerInformation { FirstName = "Bob", LastName = "Smith", Email = "*****@*****.**", PhoneNumber = "375123092723", Address1 = "Lenina street 12", Address2 = "", City = "Minsk", PostCode = "220000" }; var mock = new Mock <ISessionManager>(); mock.Setup(x => x.GetCustomerInformation()).Returns(customerInformation); GetCustomerInformation.Response response = new GetCustomerInformation(mock.Object).Do(); Assert.True( response.FirstName == customerInformation.FirstName && response.LastName == customerInformation.LastName && response.Email == customerInformation.Email && response.PhoneNumber == customerInformation.PhoneNumber && response.Address1 == customerInformation.Address1 && response.Address2 == customerInformation.Address2 && response.City == customerInformation.City && response.PostCode == customerInformation.PostCode ); }
private async void registrationButton_MouseClick(object sender, MouseEventArgs e) { if (CheckRegistration()) { try { using (DataBaseIM db = new DataBaseIM()) { UsersLogin user = new UsersLogin(); user.Login = registrationName.Text; user.Password = registrationPassword.Text; user.Mail = registrationMail.Text; db.UsersLogins.Add(user); CustomerInformation userInformation = new CustomerInformation(); userInformation.UserLogin = user; db.CustomersInformations.Add(userInformation); await db.SaveChangesAsync(); } } catch (Exception w) { MessageBox.Show("Error Server: " + w.ToString()); } MessageBox.Show("Account Created!"); loginPanel.Visible = true; registrationPanel.Visible = false; } }
public HttpResponseMessage GetCustomers(HttpRequestMessage request, [FromBody] CustomerInformation customerInformation) { TransactionalInformation transaction = new TransactionalInformation(); string customerCode = customerInformation.CustomerCode; string companyName = customerInformation.CompanyName; int currentPageNumber = customerInformation.CurrentPageNumber; int pageSize = customerInformation.PageSize; string sortExpression = customerInformation.SortExpression; string sortDirection = customerInformation.SortDirection; int totalRows = 0; CustomerBusinessService customerBusinessService = new CustomerBusinessService(_customerDataService); List <Customer> customers = customerBusinessService.GetCustomers(customerCode, companyName, currentPageNumber, pageSize, sortDirection, sortExpression, out totalRows, out transaction); if (transaction.ReturnStatus == false) { var badResponse = Request.CreateResponse <TransactionalInformation>(HttpStatusCode.BadRequest, transaction); return(badResponse); } customerInformation = new CustomerInformation(); customerInformation.ReturnStatus = transaction.ReturnStatus; customerInformation.TotalRows = totalRows; customerInformation.TotalPages = Utilities.CalculateTotalPages(totalRows, pageSize); customerInformation.ReturnMessage.Add("page " + currentPageNumber + " of " + customerInformation.TotalPages + " returned at " + DateTime.Now.ToString()); customerInformation.Customers = customers; var response = Request.CreateResponse <CustomerInformation>(HttpStatusCode.OK, customerInformation); return(response); }
public HttpResponseMessage Create(CustomerInformation customerInfo) { try { var messages = customerService.Validate(customerInfo); if (messages != null && messages.Count != 0) { var message = customerService.GetStringFrom(messages); Trace.TraceWarning(message); return(Request.CreateResponse(HttpStatusCode.BadRequest, message)); } var customer = customerInfo.Customer; customerService.ResolveReferences(customer); var jsonData = JsonConvert.SerializeObject(customer); var response = customerService.Create(jsonData, crmService); if (response.Existing) { return(Request.CreateResponse(HttpStatusCode.BadRequest, Constants.Messages.CustomerCreationError)); } if (response.Create && !string.IsNullOrWhiteSpace(response.Id)) { return(Request.CreateResponse(HttpStatusCode.Created, response.Id)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } } catch (Exception ex) { Trace.TraceError("Unexpected error Customer.Create::Message:{0}||Trace:{1}", ex.Message, ex.StackTrace.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public void Update(CustomerInformation ObjToSave) { var ObjToUpdate = _context.CustomerInformations.SingleOrDefault (m => m.CompanyID == ObjToSave.CompanyID && m.AccountNumber == ObjToSave.AccountNumber); if (ObjToUpdate != null) { ObjToUpdate.AreaID = ObjToSave.AreaID; ObjToUpdate.AuthorizedSignatory = ObjToSave.AuthorizedSignatory; ObjToUpdate.BuildingNo = ObjToSave.BuildingNo; ObjToUpdate.CityID = ObjToSave.CityID; ObjToUpdate.CommercialRecord = ObjToSave.CommercialRecord; ObjToUpdate.DebitLimit = ObjToSave.DebitLimit; ObjToUpdate.DebitPeriod = ObjToSave.DebitPeriod; ObjToUpdate.DiscountPercentage = ObjToSave.DiscountPercentage; ObjToUpdate.Email = ObjToSave.Email; ObjToUpdate.FloorNo = ObjToSave.FloorNo; ObjToUpdate.KnownTo = ObjToSave.KnownTo; ObjToUpdate.Mobile = ObjToSave.Mobile; ObjToUpdate.NationalNumberOfTheFacility = ObjToSave.NationalNumberOfTheFacility; ObjToUpdate.NextTo = ObjToSave.NextTo; ObjToUpdate.PaymnetMethodTypeID = ObjToSave.PaymnetMethodTypeID; ObjToUpdate.ProfessionLicence = ObjToSave.ProfessionLicence; ObjToUpdate.StreetName = ObjToSave.StreetName; ObjToUpdate.TeleFax = ObjToSave.TeleFax; ObjToUpdate.Telephone = ObjToSave.Telephone; ObjToUpdate.TradeName = ObjToSave.TradeName; ObjToUpdate.Website = ObjToSave.Website; } }
private void InitializeCustomer(CustomerInformation customerInfo) { if (customerInfo == null) { return; } if (customerInfo.Customer == null) { return; } var customer = customerInfo.Customer; customer.CustomerIdentity = new CustomerIdentity(); customer.CustomerIdentifier = new CustomerIdentifier(); customer.CustomerGeneral = new CustomerGeneral(); customer.Company = new Company(); customer.Permissions = new Permission(); customer.Additional = new Additional(); customer.Address = new[] { new Address(), new Address(), new Address() }; customer.Address1 = new Address(); customer.Address2 = new Address(); customer.Address3 = new Address(); customer.Phone = new[] { new Phone(), new Phone(), new Phone() }; customer.Phone1 = new Phone(); customer.Phone2 = new Phone(); customer.Phone3 = new Phone(); customer.Email = new[] { new Email(), new Email(), new Email() }; customer.Email1 = new Email(); customer.Email2 = new Email(); customer.Email3 = new Email(); }
private async Task SubmitNewChatRequest(ITurnContext <IMessageActivity> turnContext) { try { dynamic value = turnContext.Activity.Value; CustomerInformation customer = JsonConvert.DeserializeObject <CustomerInformation>(Convert.ToString(value)); customer.Status = Constants.Unassigned; var newQueryAttachment = this.cardHelper.CreateNewQueryAttachment(customer); if (newQueryAttachment != null) { ChannelAccount channelAccount = new ChannelAccount(this.configuration[Constants.MicrosoftAppIdConfigurationSettingsKey]); var notificationStatus = await this.SendChannelNotification(channelAccount, customer, string.Empty, newQueryAttachment); if (notificationStatus.IsSuccessful) { var conversationResource = new ConversationResource() { TeamsConversationId = notificationStatus.MessageId, ConversationReference = turnContext.Activity.GetConversationReference() }; await DocumentDBRepository.CreateItemAsync(conversationResource); customer.TeamsConversationId = notificationStatus.MessageId; customer.WebConversationId = turnContext.Activity.Conversation.Id; await DocumentDBRepository.CreateItemAsync(customer); await turnContext.SendActivityAsync(Constants.RequestHasBeenSubmitted); } } } catch (Exception ex) { this.logger.LogError(ex.Message + " " + ex.StackTrace); } }
private async void buttonUsersDel_Click(object sender, EventArgs e) { if (dataGridViewUsers.SelectedRows.Count > 0) { int index = dataGridViewUsers.SelectedRows[0].Index; int id = 0; bool converted = Int32.TryParse(dataGridViewUsers[0, index].Value.ToString(), out id); if (converted == false) { return; } UsersLogin user = db.UsersLogins.Find(id); if (user.Admin == true) { MenedjerInformation mInfo = db.MenedjersInformations.FirstOrDefault(mI => mI.UserLoginId == user.Id); if (mInfo != null) { db.MenedjersInformations.Remove(mInfo); } } else { CustomerInformation cInfo = db.CustomersInformations.FirstOrDefault(cI => cI.UserLoginId == user.Id); if (cInfo != null) { db.CustomersInformations.Remove(cInfo); } } db.UsersLogins.Remove(user); await db.SaveChangesAsync(); MessageBox.Show("object deleted"); } }
public CustomerInformationViewModel(CustomerInformation custInfo) { CustomerID = custInfo.CustomerID; NameStyle = custInfo.NameStyle; Title = custInfo.Title; FirstName = custInfo.FirstName; MiddleName = custInfo.MiddleName; LastName = custInfo.LastName; Suffix = custInfo.Suffix; CompanyName = custInfo.CompanyName; SalesPerson = custInfo.SalesPerson; EmailAddress = custInfo.EmailAddress; Phone = custInfo.Phone; PasswordHash = custInfo.PasswordHash; PasswordSalt = custInfo.PasswordSalt; AddressID = custInfo.AddressID; AddressLine1 = custInfo.AddressLine1; AddressLine2 = custInfo.AddressLine2; City = custInfo.City; StateProvince = custInfo.StateProvince; CountryRegion = custInfo.CountryRegion; PostalCode = custInfo.PostalCode; rowguid = custInfo.rowguid; ModifiedDate = custInfo.ModifiedDate; }
//新增一个用户的方法 public void AddCustomerInformation(CustomerInformation customerInformation) { //先建立了客户表信息 int CustomerID = Dal.AddCustomerInformation(customerInformation); //立马建立一个空病史表 Dal.AddCustomerDetails(CustomerID); }
public IActionResult Edit(int?id) { CustomerInformation customerInformation = _context.CustomerInformations.Find(id); customerInformation.OldName = customerInformation.Name; return(View(customerInformation)); }
public PaymentStatusChangedMessage(string siteName, PaymentInformation payment, CustomerInformation customer) { SiteName = siteName; Payment = payment; Customer = customer; }
public ActionResult DeleteConfirmed(int id) { CustomerInformation customerInformation = db.CustomerInformation.Find(id); db.CustomerInformation.Remove(customerInformation); db.SaveChanges(); return(RedirectToAction("Index")); }
//新增一个用户的方法 public int AddCustomerInformation(CustomerInformation customerInformation) { db.CustomerInformation.Add(customerInformation); db.SaveChanges(); CustomerInformation Customer = db.CustomerInformation.ToList().LastOrDefault(); int CustomerID = Customer.CustomerID; return(CustomerID); }
public ActionResult DeleteConfirmed(int id) { CustomerInformation customerInformation = _context.CustomerInformations.Include(c => c.LoginUsers). Include(c => c.ContactsDetails).Include(c => c.Departaments).FirstOrDefault(c => c.Id == id); _context.CustomerInformations.Remove(customerInformation); _context.SaveChanges(); return(RedirectToAction("Index")); }
private async void DeleteCustomer(CustomerInformation cust) { var customerId = cust.Id; await client.DeleteCustomerAsync(customerId); mess.ShowMessage("Customer with id " + customerId + " has been deleted successfully."); Frame.Navigate(typeof(CustomersPage)); }
public void CanGoToRightToBuyDialogWindow() { Pages.SystemDashBoard.CustomerName(CustomerInformation .CustomerNameLabel).AndPressEnterKeyBoard(); Assert.IsTrue(Pages.SystemDashBoard.SearchResultList(), "Search result not displayed searh name"); Pages.SystemDashBoard.SelectSearchNameFromTheList(); Assert.AreEqual(CustomerInformation.CustomerInformationSummary("*****@*****.**", "04 Feb 1971"), Pages.SystemDashBoard.ActualValue(), "Expected and actual are not the same"); Pages.SystemDashBoard.AddMemoWordAndStartInteraction(); Assert.IsTrue(Pages.InteractionDashBoard.IsAt, "Cannot go to Interaction dashborad"); Pages.InteractionDashBoard.EventTile.Navigate("Right to buy"); //Assert right to buy title page Assert.IsTrue(Pages.RightToBuyDashBoard.IsAt(), "Fail to Go to Right To Buy Page"); // Click start botton from the menu bar Pages.RightToBuyDashBoard.StartRightToBuyDialogWindow(); Assert.IsTrue(Pages.RightToBuyDialogWindow.IsAt, "Unable to navigate to dialog window"); Pages.RightToBuyDialogWindow.CloseRightToBuyDialogWindow(); // Pages.RightToBuyDialogWindow.CanClickNextButton(); // //// select make a new application and click next // Pages.RightToBuyDialogWindow.SelectWith.SelectNewApplication(); // ////select voluntary sale and click next // Pages.RightToBuyDialogWindow.SelectWith.VoluntarySale(); // //// check active anti-social behaviour // Pages.RightToBuyDialogWindow.CheckWith.SocialBehaviour(); // ////assert Eligibility message display // Assert.IsTrue(Pages.RightToBuyDialogWindow.WarningMessage(CustomerInformation.EligibilityAdviced)); //// Pages.RightToBuyDashBoard.RightToBuyWindowPopUp.DialogBox.SharingRight(); // Pages.RightToBuyDialogWindow.SharingRight(); // // sharing right section including relative name, relationship // //and time at the address // Pages.RightToBuyDialogWindow.SharingRightWith(CustomerInformation.CustomerNorminee) // .WithRelationship(CustomerInformation.Relative) // .WithTimeLiveAtTheAddress(CustomerInformation.TimeAtTheAddress) // .CustomerNormineeName(); // //// select application form and click next // Pages.RightToBuyDialogWindow.ApplicationForm(); // //// select not send to post office // Pages.RightToBuyDialogWindow.PostOfficeOption(); // //// input comment // Pages.RightToBuyDialogWindow.InputAddtionalInformation(CustomerInformation.CommentInput); //// Finish the application form in the mini window // Pages.RightToBuyDialogWindow.FinishDialogInteraction(); }
public PaymentCustomerAccountChangedMessage(string publicPaymentId, string paymentReference, string siteName, CustomerInformation customer, AccountInformation account, CustomerAccountInformation customerAccount) { PublicPaymentId = publicPaymentId; PaymentReference = paymentReference; SiteName = siteName; Customer = customer; Account = account; CustomerAccount = customerAccount; }
public ActionResult Edit([Bind(Include = "customerInfoID,FirstName,LastName,Phone,Address,City,State,ZipCode,Email")] CustomerInformation customerInformation) { if (ModelState.IsValid) { db.Entry(customerInformation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerInformation)); }
public void CustomerTypeNotPresentCheck() { CustomerInformation customerInformation = new CustomerInformation(); customerInformation.Customer.CustomerGeneral = new CustomerGeneral(); var validateMessage = customerService.ValidateCustomerPatchRequest(customerInformation); var message = customerService.GetStringFrom(validateMessage); Assert.AreEqual(Messages.CustomerTypeNotPresent, message); }
public ActionResult Create(CustomerInformation account) { var newAccount = CustomerInformation.CreateCustomerInformation(account.CustomerName, User.Identity.GetUserName(), account.Address); if (newAccount != null) { return(RedirectToAction("Detail", new { id = newAccount.EmailAddress.Replace(".", "~") })); } return(View()); }