public ActionResult Create(long periodId, long customerId, long currencyId) { ReceiptViewModel receipt = new ReceiptViewModel(); SessionHelper.Calendar = CalendarHelper.GetCalendar(ReceivablePeriodHelper.GetReceivablePeriod(periodId.ToString()).CalendarId.ToString()); receipt.PeriodId = SessionHelper.Calendar.Id; receipt.SOBId = SessionHelper.SOBId; receipt.CustomerId = customerId; receipt.CurrencyId = currencyId; receipt.ConversionRate = 1; receipt.ReceiptDate = SessionHelper.Calendar.StartDate; SessionHelper.PrecisionLimit = CurrencyHelper.GetCurrency(currencyId.ToString()).Precision; if (receipt.CustomerSites == null) { receipt.CustomerSites = CustomerHelper.GetCustomerSites(receipt.CustomerId).Select(a => new SelectListItem { Text = a.SiteName.ToString(), Value = a.Id.ToString() }).ToList(); } else { receipt.CustomerSites = new List <SelectListItem>(); } if (receipt.Banks == null) { receipt.Banks = BankHelper.GetBankList(receipt.SOBId); } else { receipt.Banks = new List <SelectListItem>(); } receipt.BankId = receipt.Banks.Count() > 0 ? Convert.ToInt64(receipt.Banks.FirstOrDefault().Value) : 0; if (receipt.BankAccounts == null) { receipt.BankAccounts = BankHelper.GetBankAccountList(receipt.BankId); } else { receipt.BankAccounts = new List <SelectListItem>(); } return(View(receipt)); }
public void CreateSale_Send_DebitCardTransaction_Return_Valid_Reponse() { var validDebitCardSaleResponse = ValidCreateSaleResponse(CardTransactionHelper.CreateDebitCardPaymentResponse()); _mockRestClient.Setup(m => m.Execute <Sale>(It.IsAny <IRestRequest>())).Returns(new RestResponse <Sale>() { StatusCode = HttpStatusCode.Created, Content = new JsonSerializer().Serialize(validDebitCardSaleResponse), Data = validDebitCardSaleResponse }); var response = _service.CreateSale(MerchantAuthenticationHelper.CreateMerchantAuthentication(), SaleHelper.CreateOrder(CardTransactionHelper.CreateDebitCardPaymentRequest())); response.Should().NotBeNull(); response.MerchantOrderId.Should().NotBeEmpty(); response.Customer.Should().NotBeNull(); response.Customer.Address.Should().NotBeNull(); response.Payment.Should().NotBeNull(); response.Payment.ExtraDataCollection.Should().BeNull(); response.Payment.Links.Should().NotBeNull(); response.Customer.Address.City.Should().Be(CustomerHelper.CreateCustomer().Address.City); response.Customer.Address.Complement.Should().Be(CustomerHelper.CreateCustomer().Address.Complement); response.Customer.Address.Country.Should().Be(CustomerHelper.CreateCustomer().Address.Country); response.Customer.Address.District.Should().Be(CustomerHelper.CreateCustomer().Address.District); response.Customer.Address.Number.Should().Be(CustomerHelper.CreateCustomer().Address.Number); response.Customer.Address.State.Should().Be(CustomerHelper.CreateCustomer().Address.State); response.Customer.Address.Street.Should().Be(CustomerHelper.CreateCustomer().Address.Street); response.Customer.Address.ZipCode.Should().Be(CustomerHelper.CreateCustomer().Address.ZipCode); response.Customer.Birthdate.Should().NotBe(new DateTime()); response.Customer.Email.Should().Be(CustomerHelper.CreateCustomer().Email); response.Customer.Identity.Should().Be(CustomerHelper.CreateCustomer().Identity); response.Customer.IdentityType.Should().Be(CustomerHelper.CreateCustomer().IdentityType); response.Customer.Name.Should().Be(CustomerHelper.CreateCustomer().Name); response.Payment.Amount.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Amount); response.Payment.CapturedAmount.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().CapturedAmount); response.Payment.Provider.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Provider); response.Payment.Country.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Country); response.Payment.Credentials.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Credentials); response.Payment.Currency.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Currency); response.Payment.ReasonCode.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().ReasonCode); response.Payment.ReasonMessage.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().ReasonMessage); response.Payment.ReturnUrl.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().ReturnUrl); response.Payment.Status.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Status); response.Payment.Type.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().Type); response.Payment.VoidedAmount.Should().Be(CardTransactionHelper.CreateDebitCardPaymentResponse().VoidedAmount); }
private void Button3_Click(object sender, EventArgs e)//adding { Customers customer = new Customers(); customer.customerName = addedCustomerName.Text; customer.customerSurname = addedCustomerSurname.Text; customer.customerPhone = addedCustomerPhone.Text; customer.customerAddress = addedCustomerAddress.Text; customer.userId = activeUser.userId; var status = CustomerHelper.CustomerCUD(customer, System.Data.Entity.EntityState.Added); LoadUserCustomers(); MessageBox.Show(status.message); }
public ActionResult Create() { InvoiceModel model = SessionHelper.Invoice; if (model == null) { model = new InvoiceModel { CompanyId = AuthenticationHelper.CompanyId.Value, InvoiceDetail = new List <InvoiceDetailModel>(), InvoiceNo = "New", SOBId = SessionHelper.SOBId, ConversionRate = 1 }; SessionHelper.Invoice = model; } model.Currencies = CurrencyHelper.GetCurrencyList(SessionHelper.SOBId); //model.Periods = CalendarHelper.GetCalendarsList(SessionHelper.SOBId); model.Periods = ReceivablePeriodHelper.GetPeriodList(SessionHelper.SOBId); if (model.Currencies != null && model.Currencies.Count() > 0) { model.CurrencyId = Convert.ToInt64(model.Currencies.FirstOrDefault().Value); SessionHelper.PrecisionLimit = CurrencyHelper.GetCurrency(model.CurrencyId.ToString()).Precision; } if (model.Periods != null && model.Periods.Count() > 0) { model.PeriodId = Convert.ToInt64(model.Periods.FirstOrDefault().Value); //SessionHelper.Calendar = CalendarHelper.GetCalendar(model.PeriodId.ToString()); SessionHelper.Calendar = CalendarHelper.GetCalendar(ReceivablePeriodHelper.GetReceivablePeriod(model.PeriodId.ToString()).CalendarId.ToString()); model.InvoiceDate = SessionHelper.Calendar.StartDate; model.Customers = CustomerHelper.GetCustomersCombo(SessionHelper.Calendar.StartDate, SessionHelper.Calendar.EndDate); if (model.Customers != null && model.Customers.Count() > 0) { model.CustomerId = Convert.ToInt64(model.Customers.FirstOrDefault().Value); model.CustomerSites = CustomerHelper.GetCustomerSitesCombo(model.CustomerId); if (model.CustomerSites != null && model.CustomerSites.Count() > 0) { model.CustomerSiteId = Convert.ToInt64(model.CustomerSites.FirstOrDefault().Value); } } } return(View("Edit", model)); }
private void Button2_Click(object sender, EventArgs e)//deleting { DialogResult dr = MessageBox.Show("Bu işlem geri alınamaz. Yine de silinsin mi?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { selectedCustomer = userCustomer[customerListView.SelectedIndices[0]]; var saveModel = CustomerHelper.CustomerCUD(selectedCustomer, System.Data.Entity.EntityState.Deleted); LoadUserCustomers(); MessageBox.Show(saveModel.message, "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { LoadUserCustomers(); } }
public ActionResult Edit(CustomerModel model) { if (ModelState.IsValid) { if (model.StartDate != null && model.StartDate > model.EndDate) { ModelState.AddModelError("Error", "Start Date cannot be greater than End Date."); } else { string result = CustomerHelper.SaveCustomer(model); return(RedirectToAction("Index")); } } return(View(model)); }
public ActionResult RemoveBeneficiaryFinal(string selectedaccount) { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var c1 = new Beneficiary(); c1.custId = HttpContext.Session["LoggedInCustomerId"].ToString(); c1.beneficiaryAccNo = int.Parse(selectedaccount); var ch = new CustomerHelper(); ch.removeBeneficiary(c1); return(Redirect("/CustomerFundTransfer/RemoveBeneficiary")); } }
public ActionResult RemoveBeneficiary() { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var cid = new Beneficiary(); cid.custId = HttpContext.Session["LoggedInCustomerId"].ToString(); var h = new CustomerHelper(); var model1 = new List <Beneficiary>(); model1 = h.fetchBeneficiaryAccount(cid); return(View("RemoveBeneficiary", model1)); } }
// GET: CustomerAccountStatement public ActionResult Index() { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var c = new CustomerDetails(); c.cid = HttpContext.Session["LoggedInCustomerId"].ToString(); var ch = new CustomerHelper(); var model = new List <Accounts>(); model = ch.FetchCustomerAccount(c); return(View("ViewStatements", model)); } }
/// <summary> /// 日常记账 /// </summary> /// <returns></returns> public ActionResult DailyWrite() { //所有产品 List <Products> products = ProductHelper.ProductList(); //所有客户 List <Customer> customers = CustomerHelper.CustomerList(); CustomerProductViewModel cusProduct = new CustomerProductViewModel() { Customers = customers, Products = products }; ViewBag.Staffs = StaffHelper.StaffList(); ViewBag.flag = "DailyWrite"; return(View(cusProduct)); }
public ActionResult AddBeneficiaryFinal(string benefname, int benefaccno) { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var c = new Beneficiary(); c.custId = HttpContext.Session["LoggedInCustomerId"].ToString(); c.beneficiaryName = benefname; c.beneficiaryAccNo = benefaccno; var ch = new CustomerHelper(); TempData["AddBeneficiaryMessage"] = ch.AddBeneficiary(c); return(Redirect("/CustomerFundTransfer/Index")); } }
public ActionResult ChangePasswordFinal(string oldpass, string newpass) { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var c = new ChangePasswordModel(); c.cid = HttpContext.Session["LoggedInCustomerId"].ToString(); c.oldpass = oldpass; c.newpass = newpass; var ch = new CustomerHelper(); TempData["ChangePasswordMessage"] = ch.ChangePassword(c); return(Redirect("/Customer/ChangePassword")); } }
public ActionResult ResetPassword(string pass1) { if (Session["LoggedInCustomerId"] != null || Session["bankerid"] != null) { return(Redirect("/HomePage/Logout")); } else { var c = new ChangePasswordModel(); c.cid = HttpContext.Session["ForgotPassword"].ToString(); c.newpass = pass1; var ch = new CustomerHelper(); ch.ChangePasswordForgot(c); TempData["CustomerMessage"] = "Password Reset Successfully"; return(Redirect("/HomePage/Index")); } }
public ActionResult ViewProfile() { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var customerinfo = new CustomerDetails(); customerinfo.cid = HttpContext.Session["LoggedInCustomerId"].ToString(); var info = new CustomerHelper(); var customerInfoModel = new List <CustomerDetails>(); customerInfoModel = info.fetchCustomerInfo(customerinfo); return(View("ViewProfile", customerInfoModel)); } }
public ActionResult CheckBalance() { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var customerbal = new Accounts(); customerbal.customerid = HttpContext.Session["LoggedInCustomerId"].ToString(); var balinfo = new CustomerHelper(); var customerBalInfoModel = new List <Accounts>(); customerBalInfoModel = balinfo.fetchCustomerAccInfo(customerbal); return(View("CheckBalance", customerBalInfoModel)); } }
/// <summary> /// Executes the workflow to create the customer. /// </summary> /// <param name="request">The request.</param> /// <returns>The response.</returns> protected override CreateCustomerResponse Process(CreateCustomerRequest request) { ThrowIf.Null(request, "request"); CustomerHelper.ValidateAddresses(this.Context, request.NewCustomer.Addresses); // Checking whether this is context of RetailStore or not because DeviceConfiguration exists only for RetailStores and not for OnlineStores if (this.Context.GetPrincipal().IsEmployee) { DeviceConfiguration deviceConfiguration = request.RequestContext.GetDeviceConfiguration(); System.Diagnostics.Debug.WriteLine(deviceConfiguration.CreateAsyncCustomers); if (deviceConfiguration.CreateAsyncCustomers) { request.NewCustomer.IsAsyncCustomer = true; } } // save new customer var saveCustomerServiceRequest = new SaveCustomerServiceRequest(request.NewCustomer); var saveCustomerServiceResponse = this.Context.Execute <SaveCustomerServiceResponse>(saveCustomerServiceRequest); Customer addedCustomer = saveCustomerServiceResponse.UpdatedCustomer; if (addedCustomer != null && !string.IsNullOrWhiteSpace(addedCustomer.Email)) { ICollection <NameValuePair> mappings = GetCreateCustomerEmailMappings(addedCustomer); // Send new customer email to customer var sendCustomerEmailServiceRequest = new SendEmailRealtimeRequest(addedCustomer.Email, mappings, addedCustomer.Language ?? CultureInfo.CurrentUICulture.ToString(), null, NewCustomerEmailId); // don't fail the customer creation if there is is an error sending the email, log the error. try { this.Context.Execute <NullResponse>(sendCustomerEmailServiceRequest); } catch (Exception ex) { RetailLogger.Log.CrtWorkflowCreateCustomerEmailFailure(ex); } } return(new CreateCustomerResponse(addedCustomer)); }
public async Task <ActionResult> AddCustomer(long?Id, AddCustomerModel customerModel) { try { if (!ModelState.IsValid) { return(View(customerModel)); } var customerValidModel = CustomerHelper.BindCustomerModel(customerModel); if (customerModel.CustomerId.IsGreaterThenZero()) { long customerId = iCustomer.UpdateCustomer(customerValidModel); if (customerId == RepositoryReturnCode.MailExist.GetHashCode()) { TempData[MessageConstant.ErrorMessage] = MessageConstant.CustomerEmailError; return(View(customerModel)); } else if (customerId.IsGreaterThenZero()) { TempData[MessageConstant.SuccessMessage] = MessageConstant.CustomerUpdated; } } else { long customerId = iCustomer.AddCustomer(customerValidModel); if (customerId == RepositoryReturnCode.MailExist.GetHashCode()) { TempData[MessageConstant.ErrorMessage] = MessageConstant.CustomerEmailError; return(View(customerModel)); } else if (customerId.IsGreaterThenZero()) { TempData[MessageConstant.SuccessMessage] = MessageConstant.CustomerAdded; } } return(RedirectToAction("Index")); } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + Constants.ExceptionSeprator + ex.StackTrace); throw ex; } }
static void Main(string[] args) { // SRP problem solving. CustomerHelper objCust = new CustomerHelper(); foreach (var item in objCust.GetAllCustomers()) { Console.WriteLine("Customer Data \n ID: {0}, Name: {1}, City: {2}", item.CustID, item.Name, item.city); } // LSP PROBLEM SpecialCustomers sc = null; sc = new TopNCustomers(); for (int i = 0; i < 10; i++) { Customer obj = new Customer(); sc.AddCustomer(obj); } /* Problem * The problem comes in the for loop. The for loop that follows attempts to add 10 Customer instances to the TopNCustomers. * But TopNCustomers allows only 5 instances and hence throws an error. * If sc would have been of type SpecialCustomers the for loop would have successfully added 10 instances into the List. * However, since the code substitutes TopNCustomers instance in place of SpecialCustomers the code produces an exception. * Thus LSP is violated in this example. */ // LSP SOLUTION TO ABOVE PROBLEM Customer c = new Customer() { CustID = "ALFKI" }; CustomerCollection collection = null; collection = new SpecialCustomers(); collection.AddCustomer(c); collection = new TopNCustomers(); collection.AddCustomer(c); /* NOTE: * The above code declares a variable of CustomerCollection type. Once it points to an instance of SpecialCustomers and then to TopNCustomers. * In this case, however, their base class is CustomerCollection and the instances are perfectly substitutable for it without producing any inaccuracies. * */ }
//Push data to client private void PushDataToClient() { using (var context = new WebsiteTTKEntities()) { List <Customer> customers = CustomerHelper.GetAllCustomer(); //var list = qTable.Select(s => new { // s.customer_id, // s.first_name, // s.last_name, // s.phone, // s.email, // s.street, // s.city, // s.zip_code, //}).ToList(); var json = new JavaScriptSerializer().Serialize(customers); Server_Data.InnerText = json; } }
private void FillAlert4(List<AlertSaleOrder> lstNoCumplimentadas, string customerCode) { GVSeguimientoOV.DataSource = lstNoCumplimentadas; GVSeguimientoOV.DataBind(); lblTotalCountAlert4.Text = "Total: " + lstNoCumplimentadas.Count + " registros"; pnSeguimientoOv.Visible = true; btnExportToExcel.Visible = (lstNoCumplimentadas.Count > 0); List<CustomerHelper> finalCustomerNames = new List<CustomerHelper>(); CustomerHelper def = new CustomerHelper("--Cliente--", "--00--"); def.Name = "--Cliente--"; finalCustomerNames.Add(def); finalCustomerNames.AddRange(ControllerManager.AlertSaleOrder.GetCustomers()); ddlClient.DataSource = finalCustomerNames; ddlClient.DataTextField = "Name"; ddlClient.DataValueField = "Code"; if(!string.IsNullOrEmpty(customerCode)) ddlClient.SelectedValue = customerCode; ddlClient.DataBind(); }
public string UpdateCustomerAccount(string jsonCustomer) { string error = ""; Customer customer = SerializationHelper.DeserializeFromJsonString <Customer>(jsonCustomer); var context = new KoloAndroidEntities(); var tmp = context.Customers.Include("Person").FirstOrDefault(c => c.IdCustomer == customer.IdCustomer); MobileDevice mobileDevice = null; if (customer.MobileDevices[0] != null) { mobileDevice = context.MobileDevices.FirstOrDefault(m => m.IdCustomer == customer.IdCustomer && m.IdMobileDevice == customer.MobileDevices[0].IdMobileDevice); } CustomerHelper.UpdateCustomerAccount(ref tmp, customer, ref mobileDevice, context, out error); context.SaveChanges(); KoloWsObject <Customer> koloWs = new KoloWsObject <Customer>(error, tmp); var result = SerializationHelper.SerializeToJson(koloWs); context.Dispose(); return(result); }
public ActionResult TransferFunds() { if (Session["LoggedInCustomerId"] == null) { return(Redirect("/HomePage/Index")); } else { var c = new CustomerDetails(); c.cid = HttpContext.Session["LoggedInCustomerId"].ToString(); var h = new CustomerHelper(); var model1 = new List <Accounts>(); model1 = h.FetchCustomerAccount(c); var b = new Beneficiary(); b.custId = HttpContext.Session["LoggedInCustomerId"].ToString(); ViewBag.Beneficiaries = h.fetchBeneficiaryAccount(b); return(View("TransferFunds", model1)); // return View(); } }
protected void Page_Load(object sender, EventArgs e) { ((Site)this.Master).IsHomePage = false; if (!IsPostBack) { SubCategoryNavigation1.C1SysNo = C1SysNo; ProductDetailHelper helper = new ProductDetailHelper(ProductSysNo); ProductDetailImagesHTML = helper.GetProductDetailImages(); ProductNameInfoHTML = helper.GetProductNameInfo(); ProductBaiscInfoHTML = helper.GetProductBaiscInfo(); ProductLongDescriptionHTML = helper.GetProductLongDescription(); ProductPackageListHTML = helper.GetProductPackageList(); ProductAttrSummeryHTML = helper.GetProductAttrSummery(); ProductRelatedGuessYouLikeHTML = FrontProductsHelper.GetProductGuessYouLikeHTML(C1SysNo, C2SysNo, C3SysNo, ProductSysNo); ProductAlsoSeenHTML = FrontProductsHelper.GetProductAlsoSeenHTML(C1SysNo, C2SysNo, C3SysNo, ProductSysNo); ProductAlsoBuyHTML = FrontProductsHelper.GetProductAlsoBuyInCartCheck(C1SysNo, C2SysNo, C3SysNo, ProductSysNo); //添加最近浏览记录 CustomerHelper.SetCustomerBrowserHistory(ProductSysNo); BrowserHistoryProductListHTML = CustomerHelper.GetProductDetailBrowserHistoryProductsHTML(); } }
public ActionResult CustomerwiseReceiptClearance() { CustomerSalesCriteriaModel model = new CustomerSalesCriteriaModel(); model.Customers.Add(new SelectListItem { Text = "All Customers", Value = "0" }); foreach (var customer in CustomerHelper.GetCustomers()) { model.Customers.Add(new SelectListItem { Text = customer.CustomerName, Value = customer.Id.ToString() }); } return(View(model)); }
public ActionResult Edit(string id) { OrderModel order = OrderHelper.GetOrder(id); order.OrderDetail = OrderHelper.GetOrderDetail(id); SessionHelper.Order = order; order.Customers = CustomerHelper.GetCustomersCombo(order.OrderDate, order.OrderDate); if (order.Customers != null && order.Customers.Count() > 0) { order.CustomerSites = CustomerHelper.GetCustomerSitesCombo(order.CustomerId); } order.OrderTypes = OrderTypeHelper.GetOrderTypesCombo(order.OrderDate); if (order.OrderTypes != null && order.OrderTypes.Count() > 0) { order.OrderTypeId = order.OrderTypeId > 0 ? order.OrderTypeId : Convert.ToInt64(order.OrderTypes.FirstOrDefault().Value); } return(View("Edit", order)); }
/// <summary> /// Adds the customer. /// </summary> /// <param name="Id">The identifier.</param> /// <returns></returns> public async Task <ActionResult> AddCustomer(long?Id) { try { if (Id.HasValue) { var customerListModel = iCustomer.GetAllCustomer(DBHelper.ParseInt64(Id)); if (customerListModel != null && customerListModel.Data != null && customerListModel.Data.Count > 0) { var customerModel = CustomerHelper.BindAddCustomerModel(customerListModel.Data[0]); return(View(customerModel)); } } return(View(new AddCustomerModel())); } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + Constants.ExceptionSeprator + ex.StackTrace); throw ex; } }
public ActionResult Login(LoginRequest loginRequest) { if (ModelState.IsValid) { var user = CustomerHelper.Login(loginRequest); if (user != null) { //set login part string userData = JsonConvert.SerializeObject(user); FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, user.Email, DateTime.Now, DateTime.Now.AddMinutes(15), false, //pass here true, if you want to implement remember me functionality userData); string encTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(faCookie); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "Email or password you entrered is incorrect"); } return(View(loginRequest)); }
public ActionResult Edit(string no, DateTime date) { OrderShipmentModel orderShipment = ShipmentHelper.GetShipmentEdit(no, date); orderShipment.Customers = CustomerHelper.GetActiveCustomersCombo(orderShipment.DeliveryDate); if (orderShipment.Customers != null && orderShipment.Customers.Count() > 0) { orderShipment.CustomerId = orderShipment.CustomerId > 0 ? orderShipment.CustomerId : Convert.ToInt64(orderShipment.Customers.First().Value); orderShipment.Customers.Add(new SelectListItem { Text = "-- Select --", Value = "0" }); orderShipment.CustomerSites = CustomerHelper.GetCustomerSitesCombo(orderShipment.CustomerId); if (orderShipment.CustomerSites != null && orderShipment.CustomerSites.Count() > 0) { orderShipment.CustomerSiteId = orderShipment.CustomerSiteId > 0 ? orderShipment.CustomerSiteId : Convert.ToInt64(orderShipment.CustomerSites.First().Value); orderShipment.CustomerSites.Add(new SelectListItem { Text = "-- Select --", Value = "0" }); } } orderShipment.Orders = OrderHelper.GetOrdersCombo(); if (orderShipment.Orders != null && orderShipment.Orders.Count() > 0) { orderShipment.OrderId = orderShipment.OrderId > 0 ? orderShipment.OrderId : Convert.ToInt64(orderShipment.Orders.First().Value); orderShipment.Orders.Add(new SelectListItem { Text = "-- Select --", Value = "0" }); } orderShipment.Warehouses = WarehouseHelper.GetWarehousesCombo(SessionHelper.SOBId); if (orderShipment.Warehouses != null && orderShipment.Warehouses.Count() > 0) { orderShipment.WarehouseId = orderShipment.WarehouseId > 0 ? orderShipment.WarehouseId : Convert.ToInt64(orderShipment.Warehouses.First().Value); } SessionHelper.Shipment = orderShipment; return(View("Edit", orderShipment)); }
public ActionResult Edit(long customerId, long?id) { ViewBag.CustomerName = CustomerHelper.GetCustomer(customerId.ToString()).CustomerName; CustomerSiteModel model; if (id != null) { model = CustomerHelper.GetCustomerSite(id.Value.ToString()); CodeCombinitionCreateViewModel codeCombination = CodeCombinationHelper.GetCodeCombination(model.CodeCombinationId.ToString()); model.CodeCombinationString = Utility.Stringize(".", codeCombination.Segment1, codeCombination.Segment2, codeCombination.Segment3, codeCombination.Segment4, codeCombination.Segment5, codeCombination.Segment6, codeCombination.Segment7, codeCombination.Segment8); } else { model = new CustomerSiteModel(); model.CustomerId = customerId; } model.TaxCode = taxService.GetAll(AuthenticationHelper.CompanyId.Value) .Select(x => new SelectListItem { Text = x.TaxName, Value = x.Id.ToString() }).ToList(); model.TaxId = model.TaxCode.Any() ? Convert.ToInt64(model.TaxCode.First().Value) : 0; //model.CodeCombination = codeCombinationService.GetAllCodeCombinitionView(AuthenticationHelper.CompanyId.Value) // .Select(x => new SelectListItem // { // Text = x.CodeCombinitionCode, // Value = x.Id.ToString() // }).ToList(); //model.CodeCombinationId = model.CodeCombination.Any() ? Convert.ToInt64(model.CodeCombination.First().Value) : 0; return(View(model)); }
public CustomerApiMasterModel GetCustomerDetails(decimal businessId) { CustomerApiMasterModel result = new CustomerApiMasterModel(); List <InvoiceCustomerModel> CustomerInvoices = CustomersApiServices.Instance.getCustomerInvoices(businessId); List <TaxCodeModel> TaxCodes = CustomersApiServices.Instance.getTaxCodes(businessId); List <TransectionCustomerModel> CustomerTransections = CustomersApiServices.Instance.getCustomerTransections(businessId); List <Customer> customers = CustomersApiServices.Instance.getAllCustomers(businessId); List <Attachment> attachments = CustomersApiServices.Instance.getAttachmentsByBusiness(businessId); result.Customers = new List <CustomerApiModel>(); foreach (var item in customers.OrderBy(x => x.CustomerName)) { CustomerApiModel customerModel = new CustomerApiModel(); List <InvoiceCustomerModel> customerInvoices = CustomerInvoices.Where(x => x.CustomerID == item.CustomerID).ToList(); List <TransectionCustomerModel> customerTransections = CustomerTransections.Where(x => x.CustomerID == item.CustomerID).ToList(); customerModel = CustomerHelper.getCustomerApiModel(customerInvoices, customerTransections, TaxCodes, item, attachments); result.Customers.Add(customerModel); } result.TotalInvoices = result.Customers.Select(x => x.InvoiceCount).Sum(); result.TotalAmount = result.Customers.Select(x => x.AccountReceivable).Sum(); return(result); }
/// <summary> /// Bind Grid /// </summary> protected void BindGrid() { CustomerHelper HelperAccess = new CustomerHelper(); uxGrid.DataSource = HelperAccess.GetAffiliate(); uxGrid.DataBind(); }
/// <summary> /// Return DataSet for a given Input /// </summary> /// <returns></returns> private DataSet BindSearchAffiliate() { CustomerHelper HelperAccess = new CustomerHelper(); string Status = ""; if (ListAffilaiteStatus.SelectedValue == "I") { Status = "I"; } else if (ListAffilaiteStatus.SelectedValue == "A") { Status = "A"; } else if (ListAffilaiteStatus.SelectedValue == "N") { Status = "N"; } else { Status = ""; } DataSet Dataset = HelperAccess.SearchAffiliate(txtFirstName.Text, txtLastName.Text, txtComapanyName.Text, txtAccountID.Text, Status); return Dataset; }
/// <summary> /// Return DataSet for a given Input /// </summary> /// <returns></returns> private DataSet BindSearchCustomer() { // Create Instance for Customer HElper class CustomerHelper HelperAccess = new CustomerHelper(); DataSet Dataset = HelperAccess.SearchCustomer(txtFName.Text.Trim(), txtLName.Text.Trim(), txtComapnyNM.Text.Trim(), txtLoginName.Text.Trim(), txtExternalaccountno.Text.Trim(), txtContactID.Text.Trim(), txtStartDate.Text.Trim(), txtEndDate.Text.Trim(), txtPhoneNumber.Text.Trim(), txtEmailID.Text.Trim(), lstProfile.SelectedValue, lstReferralStatus.SelectedValue); Session["ContactList"] = Dataset; //Return DataSet return Dataset; }
protected void download_Click(object sender, EventArgs e) { DataDownloadAdmin _DataDownloadAdmin = new DataDownloadAdmin(); CustomerHelper HelperAccess = new CustomerHelper(); DataSet _dataset = new DataSet(); //Check for Search enabled if(CheckSearch) { if(Session["ContactList"]!=null) _dataset = Session["ContactList"] as DataSet; } else { _dataset = HelperAccess.SearchCustomer(String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, String.Empty, "0",String.Empty); } string StrData = _DataDownloadAdmin.Export(_dataset, true); byte[] data = ASCIIEncoding.ASCII.GetBytes(StrData); //Release Resources _dataset.Dispose(); Response.Clear(); // Set as Excel as the primary format Response.AddHeader("Content-Type", "application/Excel"); Response.AddHeader("Content-Disposition", "attachment;filename=Customer.csv"); Response.ContentType = "application/vnd.xls"; Response.BinaryWrite(data); Response.End(); }