コード例 #1
0
        private async Task <DialogTurnResult> ProcessStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            //Need to call service inside if condition TODO...
            if ((bool)stepContext.Result)
            {
                ServiceResponceModel lstServiceResult = new ServiceResponceModel();
                List <ServiceModel>  lstService       = new List <ServiceModel>();
                // lstServiceResult.LstServiceResp   = new List<ServiceModel>();

                ServiceModel s = new ServiceModel();

                // lstServiceResult.LstServiceResp.Add(s);


                //   lstServiceResult.LstServiceResp.Add(resultData);
                var customerDetails = (CustomerDetailsModel)stepContext.Options;

                var response = await CollectionServiceBL.GetServiceResponse(customerDetails.DebtorNumber, customerDetails.DebtorName);

                var resultData = JsonConvert.DeserializeObject <ServiceModel>(response.ToString());

                var messageText   = $"Customer Account balance is in Inprocess";
                var promptMessage = MessageFactory.Text(messageText, InputHints.ExpectingInput);
                return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = promptMessage }, cancellationToken));
            }
            CustomerDetailsModel c = new CustomerDetailsModel();

            c.DebtorNumber = null;
            //return await stepContext.ReplaceDialogAsync(InitialDialogId, c, cancellationToken);
            return(await stepContext.NextAsync(null, cancellationToken));
        }
コード例 #2
0
 public static void AddOrUpdateCustomerDetails(CustomerDetailsModel customerDetails)
 {
     try
     {
         var addCustomerDetails = @"if exists(SELECT * from [CustomerDetails] where [CustomerId]= @CustomerId)            
             BEGIN            
              update [CustomerDetails] set [SkinType]=@SkinType, [HairType] = @HairType,[IsSensitiveSkin] = @IsSensitiveSkin,
              [MedicalHistory] = @MedicalHistory, [Allergies] = @Allergies, [Problems] = @Problems, [CurrentProducts] = @CurrentProducts 
              where [CustomerId]= @CustomerId 
             End                    
             else            
             BEGIN  
             insert into [CustomerDetails] values(@CustomerId, @SkinType, @HairType, @IsSensitiveSkin, @MedicalHistory, @Allergies, @Problems, @CurrentProducts)  
             end";
         using (var connection = OpenConnection())
         {
             var inputObj = new
             {
                 @CustomerId      = customerDetails.CustomerId,
                 @SkinType        = customerDetails.SkinType,
                 @HairType        = customerDetails.HairType,
                 @IsSensitiveSkin = customerDetails.IsSensitiveSkin,
                 @MedicalHistory  = customerDetails.MedicalHistory,
                 @Allergies       = customerDetails.Allergies,
                 @Problems        = customerDetails.Problems,
                 @CurrentProducts = customerDetails.CurrentProducts
             };
             connection.Query(addCustomerDetails, inputObj);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: Olusmith8/HBMC
        public ActionResult BouquetDetails(string type, string cardNumber)
        {
            ViewBag.BouquetDetails = "current";
            if (string.IsNullOrEmpty(type))
            {
                ShowMessage("Type of bouquet must be selected", AlertType.Danger);
                return(RedirectToAction("Index"));
            }
            if (!type.Equals("gotv") && !type.Equals("dstv"))
            {
                ShowMessage("Bouquet type can only be gotv or dstv", AlertType.Danger);
                return(RedirectToAction("Index"));
            }
            if (string.IsNullOrEmpty(cardNumber))
            {
                ShowMessage("Smart card number is required.", AlertType.Danger);
                return(RedirectToAction("Index"));
            }
            var response = new CustomerDetailsModel();

            try
            {
                var url = ApiConstantService.BASE_URL + type + "/details/" + cardNumber;
                response = _request.MakeRequest <CustomerDetailsModel>(url);
                return(View(response));
            }
            catch (Exception exception)
            {
                ShowMessage(exception.Message, AlertType.Danger);
                return(View(response));
            }
        }
コード例 #4
0
        // GET: DesignationMasterController/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            var existingcustomer = await _coDealerMasterService.GetAllCoDealerByIdAsync(id);

            if (existingcustomer == null)
            {
                return(RedirectToAction("List"));
            }

            var viewModel = new CustomerDetailsModel
            {
                Id              = existingcustomer.Id,
                CustomerName    = existingcustomer.SubDealerName,
                EmailId         = existingcustomer.EmailId,
                MobileNo1       = existingcustomer.ContactNo1,
                MobileNo2       = Convert.ToDecimal(existingcustomer.ContactNo2),
                Address1        = existingcustomer.Address,
                Pin             = existingcustomer.Pincode,
                District        = existingcustomer.City,
                StateId         = (await _stateListService.GetStateList()).Where(x => x.State == existingcustomer.State).FirstOrDefault().Id,
                DealerCode      = existingcustomer.DealerCode,
                ContinueEditing = IsContinueEditingAllowed()
            };

            viewModel.AvailableStates = await BindStates();

            return(View(viewModel));
        }
コード例 #5
0
        public IActionResult Create(CustomerViewModel model)
        {
            try
            {
                var options = new CustomerCreateOptions
                {
                    Description = model.FullName,
                    Email       = model.Email,
                    Source      = model.CreditCardToken,
                    Metadata    = new Dictionary <string, string>
                    {
                        { "Phone Number", model.Phone }
                    }
                };
                var service  = new CustomerService();
                var customer = service.Create(options);

                var res = new CustomerDetailsModel
                {
                    Id      = customer.Id,
                    Details = JsonConvert.SerializeObject(customer, Formatting.Indented)
                };

                return(View("CustomerStatus", res));
            }
            catch (Exception ex)
            {
                ViewData["ErrorMessage"] = ex.Message;
                return(View("Create"));
            }
        }
コード例 #6
0
        public CustomerDetailsModel GetAgreements(int customerId)
        {
            Customer customer = customerRepository.GetNameByPersonalId(customerId);

            if (customer == null)
            {
                return(null);
            }

            var ab = new CustomerDetailsModel()
            {
                Name       = customer.Name,
                Id         = customer.PersonalId,
                Agreements = customer.Agreements.Select(t => new AgreementDTO
                {
                    Id        = t.Id,
                    Amount    = t.Amount,
                    Margin    = t.Margin,
                    Duration  = t.Duration,
                    Code      = t.BaseRateCode,
                    PersonaId = t.CustomerId
                }).ToList()
            };

            return(ab);
        }
コード例 #7
0
        public async Task <string> UpdateCustomerDetails(CustomerDetailsModel existedCustomerDetails)
        {
            var updateCustomerResult = this.userContext.CustomerDetailsDB.
                                       Where(op => op.Id == existedCustomerDetails.Id).FirstOrDefault();

            if (updateCustomerResult != null)
            {
                updateCustomerResult.Name        = existedCustomerDetails.Name;
                updateCustomerResult.Phonenumber = existedCustomerDetails.Phonenumber;
                updateCustomerResult.Pincode     = existedCustomerDetails.Pincode;
                updateCustomerResult.Locality    = existedCustomerDetails.Locality;
                updateCustomerResult.Address     = existedCustomerDetails.Address;
                updateCustomerResult.City        = existedCustomerDetails.City;
                updateCustomerResult.Landmark    = existedCustomerDetails.Landmark;
                updateCustomerResult.Type        = existedCustomerDetails.Type;
                this.userContext.CustomerDetailsDB.Update(updateCustomerResult);
                await Task.Run(() => userContext.SaveChanges());

                return("Customer updation succesfull");
            }
            else
            {
                return(null);
            }
        }
コード例 #8
0
        // GET: DesignationMasterController/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            var existingcustomer = await _customerService.GetAllCustomerByIdAsync(id);

            if (existingcustomer == null)
            {
                return(RedirectToAction("List"));
            }

            var viewModel = new CustomerDetailsModel
            {
                Id              = existingcustomer.Id,
                Salutation      = existingcustomer.Salutation,
                CustomerName    = existingcustomer.CustomerName,
                EmailId         = existingcustomer.EmailId,
                MobileNo1       = existingcustomer.MobileNo1,
                MobileNo2       = Convert.ToDecimal(existingcustomer.MobileNo2),
                Address1        = existingcustomer.Address1,
                Address2        = existingcustomer.Address2,
                Pin             = existingcustomer.Pin,
                Taluka          = existingcustomer.Taluka,
                District        = existingcustomer.District,
                StateId         = (int)existingcustomer.State,
                PanNo           = existingcustomer.PanNo,
                AdharNo         = existingcustomer.AdharNo,
                Gstno           = existingcustomer.Gstno,
                ContinueEditing = IsContinueEditingAllowed()
            };

            viewModel.AvailableSalutations = BindSalutations();
            viewModel.AvailableStates      = await BindStates();


            return(View(viewModel));
        }
コード例 #9
0
        public async Task <IActionResult> GetCustomer(Guid customerId)
        {
            CustomerResult customer = await _customerQueries.GetCustomer(customerId);

            if (customer == null)
            {
                return(new NoContentResult());
            }
            List <AccountDetailsModel> accounts = new List <AccountDetailsModel>();

            foreach (var account in customer.Accounts)
            {
                List <TransactionModel> transactions = new List <TransactionModel>();
                foreach (var item in account.Transactions)
                {
                    var transaction = new TransactionModel(
                        item.Amount,
                        item.Description,
                        item.TransactionDate);
                    transactions.Add(transaction);
                }
                accounts.Add(new AccountDetailsModel(
                                 account.AccountId,
                                 account.CurrentBalance,
                                 transactions));
            }

            CustomerDetailsModel model = new CustomerDetailsModel(
                customer.CustomerId,
                customer.PersonNummer,
                customer.Name,
                accounts);

            return(new ObjectResult(model));
        }
コード例 #10
0
        public async Task <IActionResult> GetExistingCustomer(string searchTerm)
        {
            var existingcustomer = await _customerService.GetCustomerByAnyAsync(searchTerm);

            if (existingcustomer == null)
            {
                return(Json("Not Found"));
            }

            var model = new CustomerDetailsModel
            {
                CustId       = existingcustomer.Id,
                Salutation   = existingcustomer.Salutation,
                CustomerName = existingcustomer.CustomerName,
                EmailId      = existingcustomer.EmailId,
                MobileNo1    = existingcustomer.MobileNo1,
                MobileNo2    = Convert.ToDecimal(existingcustomer.MobileNo2),
                Address1     = existingcustomer.Address1,
                Address2     = existingcustomer.Address2,
                Pin          = existingcustomer.Pin,
                Taluka       = existingcustomer.Taluka,
                District     = existingcustomer.District,
                StateId      = (int)existingcustomer.State,
                PanNo        = existingcustomer.PanNo,
                AdharNo      = existingcustomer.AdharNo,
                Gstno        = existingcustomer.Gstno,
            };

            model.AvailableSalutations = BindSalutations();
            model.AvailableStates      = await BindStates();

            return(PartialView("~/Views/CustomerMaster/_CreateOrUpdate.cshtml", model));
        }
コード例 #11
0
        public void Handle(Output output)
        {
            List <AccountDetailsModel> accounts = new List <AccountDetailsModel>();

            foreach (var account in output.Accounts)
            {
                List <TransactionModel> transactions = new List <TransactionModel>();

                foreach (var item in account.Transactions)
                {
                    var transaction = new TransactionModel(
                        item.Amount,
                        item.Description,
                        item.TransactionDate);

                    transactions.Add(transaction);
                }

                accounts.Add(new AccountDetailsModel(
                                 account.AccountId,
                                 account.CurrentBalance,
                                 transactions));
            }

            CustomerDetailsModel model = new CustomerDetailsModel(
                output.CustomerId,
                output.SSN,
                output.UserName,
                accounts
                );

            ViewModel = new ObjectResult(model);
        }
コード例 #12
0
        public async Task <IActionResult> Create()
        {
            var model = new CustomerDetailsModel();

            model.AvailableStates = await BindStates();

            return(View(model));
        }
コード例 #13
0
        public async Task <IActionResult> CustomerDetailsUpdate([FromBody] CustomerDetailsModel customerDetails)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _repository.CustomerDetails_Update(customerDetails);
            await _repository.SaveChangesAsync();

            return(CreatedAtAction("GetCustomerAddressDetails", new { id = customerDetails.Id }, customerDetails));
        }
コード例 #14
0
        // POST: api/Customers
        public CustomerDetailsModel Post([FromBody] CustomerDetailsModel value)
        {
            var customer = new Customer()
            {
                Id          = value.Id,
                FirstName   = value.FirstName,
                SurName     = value.SurName,
                Address     = value.Address,
                PhoneNumber = value.PhoneNumber
            };

            _dataManager.Customers.Add(customer);
            return(mapToCustomerDetailsModel(customer));
        }
コード例 #15
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var customerDetails = new CustomerDetailsModel {
                    AspUserId    = user.Id,
                    Email        = model.Email,
                    FirstName    = model.FirstName,
                    LastName     = model.LastName,
                    EmailUpdates = model.EmailUpdates
                };

                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var contextAccessor = new HttpContextAccessor();
                    var hostBaseUrl     = contextAccessor.HttpContext.Request.Host;

                    using (var httpClient = new HttpClient())
                    {
                        var apiUrl  = string.Format("https://" + hostBaseUrl + "/api/CustomerDetails");
                        var data    = JsonConvert.SerializeObject(customerDetails);
                        var content = new StringContent(data, Encoding.UTF8, "application/json");
                        await httpClient.PostAsync(apiUrl, content);
                    }

                    _logger.LogInformation("User created a new account with password.");

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
                    await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    _logger.LogInformation("User created a new account with password.");
                    return(RedirectToLocal(returnUrl));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #16
0
        private List <SelectListItem> BindSalutations()
        {
            var model = new CustomerDetailsModel();

            foreach (SalutationEnum e in Enum.GetValues(typeof(SalutationEnum)))
            {
                model.AvailableSalutations.Add(new SelectListItem
                {
                    Value = e.ToString(),
                    Text  = e.ToString()
                });
            }

            return(model.AvailableSalutations);
        }
コード例 #17
0
        // PUT: api/Customers/5
        public CustomerViewModel Put([FromBody] CustomerDetailsModel value)
        {
            Customer customer = _dataManager.Customers.GetById(value.Id);

            customer.FirstName   = value.FirstName;
            customer.SurName     = value.SurName;
            customer.Address     = value.Address;
            customer.PhoneNumber = value.PhoneNumber;

            _dataManager.Customers.Update(customer);

            return(new CustomerViewModel()
            {
                Id = customer.Id, FirstName = customer.FirstName, SurName = customer.SurName
            });
        }
コード例 #18
0
        public async Task <IActionResult> Create(CustomerDetailsModel model, bool continueEditing)
        {
            try
            {
                var existingcustomer = (await _customerService.GetAllCustomerListAsync(model.EmailId, model.MobileNo1.ToString(), model.PanNo, model.AdharNo)).FirstOrDefault();
                if (existingcustomer == null)
                {
                    TempData["UserMessageError"] = "Records allready exist.";
                    return(View());
                }

                var customerInfo = new CustomerDetailsTable
                {
                    Salutation   = model.Salutation,
                    CustomerName = model.CustomerName,
                    EmailId      = model.EmailId,
                    MobileNo1    = model.MobileNo1,
                    MobileNo2    = Convert.ToDecimal(model.MobileNo2),
                    Address1     = model.Address1,
                    Address2     = model.Address2,
                    Pin          = model.Pin,
                    Taluka       = model.Taluka,
                    District     = model.District,
                    State        = model.StateId,
                    PanNo        = model.PanNo,
                    AdharNo      = model.AdharNo,
                    Gstno        = model.Gstno,
                    DateUpdated  = DateTime.UtcNow,
                    DateCreated  = DateTime.UtcNow
                };

                await _customerService.InsertAsync(customerInfo);

                if (continueEditing)
                {
                    return(RedirectToAction(nameof(Edit), new { id = customerInfo.Id }));
                }

                TempData["UserMessageSuccess"] = "Record saved sucessfully.";
                return(RedirectToAction(nameof(List)));
            }
            catch (Exception ex)
            {
                TempData["UserMessageError"] = ex.Message.ToString();
                return(RedirectToAction(nameof(Create)));
            }
        }
コード例 #19
0
        public void AddOrUpdateCustomerDetails()
        {
            var customer        = Customer.GetAllCustomers().FirstOrDefault();
            var customerDetails = new CustomerDetailsModel()
            {
                IsSensitiveSkin = false,
                HairType        = "Dry",
                SkinType        = "Oily",
                MedicalHistory  = "Cosmetic Surgery",
                Problems        = "Frizzy Hair",
                CurrentProducts = "Dove shampoo and conditioner",
                Allergies       = "Synus",
                CustomerId      = customer.Id
            };

            Customer.AddOrUpdateCustomerDetails(customerDetails);
        }
コード例 #20
0
        public async Task <ActionResult> Edit(CustomerDetailsModel model, bool continueEditing)
        {
            try
            {
                var existingcustomer = await _customerService.GetAllCustomerByIdAsync(model.Id);

                if (existingcustomer == null)
                {
                    return(RedirectToAction("List"));
                }

                existingcustomer.Salutation   = model.Salutation;
                existingcustomer.CustomerName = model.CustomerName;
                existingcustomer.EmailId      = model.EmailId;
                existingcustomer.MobileNo1    = model.MobileNo1;
                existingcustomer.MobileNo2    = Convert.ToDecimal(model.MobileNo2);
                existingcustomer.Address1     = model.Address1;
                existingcustomer.Address2     = model.Address2;
                existingcustomer.Pin          = model.Pin;
                existingcustomer.Taluka       = model.Taluka;
                existingcustomer.District     = model.District;
                existingcustomer.State        = model.StateId;
                existingcustomer.PanNo        = model.PanNo;
                existingcustomer.AdharNo      = model.AdharNo;
                existingcustomer.Gstno        = model.Gstno;
                existingcustomer.DateUpdated  = DateTime.UtcNow;

                await _customerService.UpdateAsync(existingcustomer);

                AllowContinueEditing(continueEditing);
                TempData["UserMessageSuccess"] = "Record saved sucessfully.";

                if (continueEditing)
                {
                    return(RedirectToAction(nameof(Edit), new { id = existingcustomer.Id }));
                }

                return(RedirectToAction(nameof(List)));
            }
            catch (Exception ex)
            {
                TempData["UserMessageError"] = ex.Message.ToString();
                return(RedirectToAction(nameof(Create)));
            }
        }
コード例 #21
0
        public async Task <string> NewCustomerDetails(CustomerDetailsModel customerDetails)
        {
            CustomerDetailsModel newCustomer = new CustomerDetailsModel()
            {
                Name        = customerDetails.Name,
                Phonenumber = customerDetails.Phonenumber,
                Pincode     = customerDetails.Pincode,
                Locality    = customerDetails.Locality,
                Address     = customerDetails.Address,
                City        = customerDetails.City,
                Landmark    = customerDetails.Landmark,
                Type        = customerDetails.Type
            };

            this.userContext.CustomerDetailsDB.Add(newCustomer);
            await Task.Run(() => userContext.SaveChanges());

            return("New customer added");
        }
コード例 #22
0
ファイル: Presenter.cs プロジェクト: x3nx1a/dotnet-new-caju
        public void Populate(CustomerOutput output)
        {
            Output = output;

            if (output == null)
            {
                ViewModel = new NoContentResult();
                return;
            }

            List <AccountDetailsModel> accounts = new List <AccountDetailsModel>();

            foreach (var account in output.Accounts)
            {
                List <TransactionModel> transactions = new List <TransactionModel>();

                foreach (var item in account.Transactions)
                {
                    var transaction = new TransactionModel(
                        item.Amount,
                        item.Description,
                        item.TransactionDate);

                    transactions.Add(transaction);
                }

                accounts.Add(new AccountDetailsModel(
                                 account.AccountId,
                                 account.CurrentBalance,
                                 transactions));
            }

            CustomerDetailsModel model = new CustomerDetailsModel(
                output.CustomerId,
                output.Personnummer,
                output.Name,
                accounts
                );

            ViewModel = new ObjectResult(model);
        }
コード例 #23
0
        public ActionResult Register(CustomerDetailsModel customerDetails)
        {
            CustomerInfo  customer      = new CustomerInfo();
            LoginInfo     login         = new LoginInfo();
            AccountDetail accountDetail = new AccountDetail();

            //Adding details to CustomerInfo
            customer.UserID             = customerDetails.UserID;
            customer.UserName           = customerDetails.UserName;
            customer.Gender             = customerDetails.Gender;
            customer.DOB                = customerDetails.DOB;
            customer.AddressLine        = customerDetails.AddressLine;
            customer.City               = customerDetails.City;
            customer.StateDetails       = customerDetails.State;
            customer.Country            = customerDetails.Country;
            customer.Pincode            = customerDetails.Pincode;
            customer.Email              = customerDetails.Email;
            customer.PrimaryPhoneNumber = customerDetails.PrimaryPhoneNumber;
            customer.AccountNumber      = customerDetails.AccountNumber;
            customer.Password           = customerDetails.Password;
            customer.Status             = "Active";
            customer.BalanceAvailable   = decimal.Parse(customerDetails.BalanceAvailable);
            //Adding details to LoginInfo
            login.UserID   = customerDetails.UserID;
            login.UserName = customerDetails.UserName;
            login.UserType = "Customer";
            login.Password = customerDetails.Password;
            //Adding details to AccountDetails
            accountDetail.UserID           = customerDetails.UserID;
            accountDetail.AccountNumber    = customerDetails.AccountNumber;
            accountDetail.UserName         = customer.UserName;
            accountDetail.BalanceAvailable = customer.BalanceAvailable;
            accountDetail.Status           = customer.Status;
            //Adding to Entities
            onlineBankingEntities.CustomerInfo.Add(customer);
            onlineBankingEntities.AccountDetails.Add(accountDetail);
            onlineBankingEntities.LoginInfo.Add(login);
            // onlineBankingEntities.SaveChanges();
            //return View();
            return(RedirectToAction("AdminHomePage", "Admin"));
        }
コード例 #24
0
        public async Task <IActionResult> Create(CustomerDetailsModel model, bool continueEditing)
        {
            try
            {
                var existingcustomer = (await _coDealerMasterService.GetAllCoDealerListAsync(model.EmailId, model.MobileNo1.ToString())).FirstOrDefault();
                if (existingcustomer != null)
                {
                    TempData["UserMessageError"] = "Records allready exist.";
                    return(await Create());
                }

                var coDealerInfo = new SubDealerMaster
                {
                    SubDealerName = model.CustomerName,
                    EmailId       = model.EmailId,
                    ContactNo1    = model.MobileNo1,
                    ContactNo2    = model.MobileNo2,
                    Address       = model.Address1,
                    Pincode       = model.Pin,
                    City          = model.District,
                    State         = (await _stateListService.GetStateById(model.StateId)).State,
                    DealerCode    = model.DealerCode,
                    DateCreated   = DateTime.UtcNow
                };

                await _coDealerMasterService.InsertAsync(coDealerInfo);

                if (continueEditing)
                {
                    return(RedirectToAction(nameof(Edit), new { id = coDealerInfo.Id }));
                }

                TempData["UserMessageSuccess"] = "Record saved sucessfully.";
                return(RedirectToAction(nameof(List)));
            }
            catch (Exception ex)
            {
                TempData["UserMessageError"] = ex.Message.ToString();
                return(RedirectToAction(nameof(Create)));
            }
        }
コード例 #25
0
        public void Populate(CustomerOutput output)
        {
            Output = output;

            if (output == null)
            {
                ViewModel = new NoContentResult();
                return;
            }

            List <OrderDetailsModel> orders = Utils.GetOrderDetailsModel(output.Orders);

            CustomerDetailsModel model = new CustomerDetailsModel(
                output.CustomerId,
                output.Personnummer,
                output.Name,
                orders
                );

            ViewModel = new ObjectResult(model);
        }
コード例 #26
0
        public ActionResult GetView(string customerID, string viewName)
        {
            //object model = null;
            CustomerDetailsModel customerModel = new CustomerDetailsModel();
            OrderModel           orderModel    = new OrderModel();

            if (viewName == "CustomerDetails")
            {
                customerModel.Customer = cusomterList.Where(x => x.CustomerId == Convert.ToInt32(customerID)).FirstOrDefault();

                return(PartialView(viewName, customerModel));
            }
            if (viewName == "OrderDetails")
            {
                orderModel.Order = orderList.Where(x => x.CustomerId == Convert.ToInt32(customerID)).OrderBy(o => o.OrderId).ToList();

                return(PartialView(viewName, orderModel));
            }

            return(PartialView(viewName));
        }
コード例 #27
0
        private async Task <DialogTurnResult> ProcessStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            CustomerDetailsModel c = new CustomerDetailsModel();
            var    customerDetails = (CustomerDetailsModel)stepContext.Options;
            var    messageText     = string.Empty;
            string balance         = string.Empty;
            string no   = string.Empty;
            string name = string.Empty;

            // c.DebtorName = null;
            //Need to call service inside if condition TODO...
            if ((bool)stepContext.Result)
            {
                List <CustomerModel> response = await CollectionServiceBL.GetServiceResponse(customerDetails.DebtorNumber, customerDetails.DebtorName);

                for (int i = 0; i < response.Count; i++)
                {
                    balance = response[i].Balance;
                    no      = response[i].CustomerNumber;
                    name    = response[i].CustomerName;
                }
                messageText = "Customer Name :" + name + " Customer No :" + no + " Balance :" + balance;

                if (messageText == "" || messageText == null)
                {
                    messageText = "We coundn't find any customer no " + customerDetails.DebtorNumber;
                }
                var promptMessage = MessageFactory.Text(messageText, InputHints.ExpectingInput);
                return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = promptMessage }, cancellationToken));

                // return await stepContext.NextAsync(null, cancellationToken);
            }
            else
            {
                return(await stepContext.ReplaceDialogAsync(InitialDialogId, c, cancellationToken));
            }

            //return await stepContext.ReplaceDialogAsync(InitialDialogId, c, cancellationToken);
        }
コード例 #28
0
        public async Task <ActionResult> Edit(CustomerDetailsModel model, bool continueEditing)
        {
            try
            {
                var existingcustomer = await _coDealerMasterService.GetAllCoDealerByIdAsync(model.Id);

                if (existingcustomer == null)
                {
                    return(RedirectToAction("List"));
                }

                existingcustomer.SubDealerName = model.CustomerName;
                existingcustomer.EmailId       = model.EmailId;
                existingcustomer.ContactNo1    = model.MobileNo1;
                existingcustomer.ContactNo2    = Convert.ToDecimal(model.MobileNo2);
                existingcustomer.Address       = model.Address1;
                existingcustomer.Pincode       = model.Pin;
                existingcustomer.City          = model.District;
                existingcustomer.State         = (await _stateListService.GetStateById(model.StateId)).State;
                existingcustomer.DealerCode    = model.DealerCode;
                await _coDealerMasterService.UpdateAsync(existingcustomer);

                AllowContinueEditing(continueEditing);
                TempData["UserMessageSuccess"] = "Record saved sucessfully.";

                if (continueEditing)
                {
                    return(RedirectToAction(nameof(Edit), new { id = existingcustomer.Id }));
                }

                return(RedirectToAction(nameof(List)));
            }
            catch (Exception ex)
            {
                TempData["UserMessageError"] = ex.Message.ToString();
                return(RedirectToAction(nameof(Create)));
            }
        }
コード例 #29
0
        private async Task <List <SelectListItem> > BindStates()
        {
            var modelList = new CustomerDetailsModel();

            modelList.AvailableStates.Add(new SelectListItem
            {
                Value = "0",
                Text  = "Select State"
            });

            var stateList = await _stateListService.GetStateList();

            foreach (var state in stateList)
            {
                modelList.AvailableStates.Add(new SelectListItem
                {
                    Value = state.Id.ToString(),
                    Text  = state.State
                });
            }

            return(modelList.AvailableStates);
        }
コード例 #30
0
        //[Route]
        public async Task <IActionResult> Update(CustomerDetailsModel detailsModel)
        {
            try
            {
                var updateResult = await this.customerDetails.UpdateCustomerDetails(detailsModel);

                if (updateResult != null)
                {
                    logger.LogInformation("log infrmation");
                    return(Ok(new { updateResult }));
                }
                else
                {
                    var jsonObj = new JsonError();
                    jsonObj.ErrorCode    = 405;
                    jsonObj.ErrorMessage = "Update customers details failed";
                    return(BadRequest(jsonObj));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }