protected ModelReviewedListModel PrepareModelReviewedListModel(PagedList <FileVersion> models, int projectId) { ModelReviewedListModel model = new ModelReviewedListModel(); if (models.Count > 0) { var lastModelVersion = models.First().EngineeringFile.FileVersions.OrderByDescending(e => e.UpLoadeTime).First(); var roles = CurrentCustomer.GetCurrentRoles(0, lastModelVersion.EngineeringFile.Engineering); foreach (var node in models) { var query = new CommentService().GetCommentByRoleAndEngineeringFileId(roles.OrderBy(e => (int)e).FirstOrDefault(), node.Id); model.ModelReviewedList.Add(new ModelReviewedListModel.ModelReviewedModel() { UploadDescription = node.UploadDescription, ModelVersionId = node.Id, ModelVersionNo = node.VersionNo, UpdateTime = node.UpdateStateTime.ToString("yyyy-MM-dd HH:mm:ss"), CommnetCount = query.Count(), }); } } model.ProjectId = projectId; model.OrganizationType = CurrentCustomer.Organization.OrganizationType; return(model); }
protected DrawingListModel PrepareDrawingListModel(PagedList <FileVersion> list, int projectId) { DrawingListModel model = new DrawingListModel(); var project = new ProjectService().Get(e => e.Id == projectId); if (project == null) { throw new ArgumentNullException(nameof(project)); } model.ProjectIsFiled = project.IsProjectFiled(); model.Roles = CurrentCustomer.GetCurrentRoles(projectId); foreach (var node in list) { model.Drawings.Add(new DrawingListModel.DrawingModel() { Description = node.UploadDescription, DrawingCatalog = DictionaryService.DrawingCatalogDictionary.Find(e => e.Id == node.DrawingCatalog).DisplayName, DrawingId = node.Id, DrawingName = node.FileName, DrawingStatus = node.Status, FileSize = node.FileSize, DrawingVersion = node.VersionNo, UpdateTime = node.UpdateStateTime.ToString("yyyy-MM-dd HH:mm:ss"), Uri = node.BIMFileId, }); } return(model); }
private void SeedCustomers() { PotentialCustomer customer1 = new PotentialCustomer("Bob", "Smith"); _customerRepo.AddCustomer(customer1); PotentialCustomer customer2 = new PotentialCustomer("Jeremy", "Adams"); _customerRepo.AddCustomer(customer2); CurrentCustomer customer3 = new CurrentCustomer("Selina", "McCoy"); _customerRepo.AddCustomer(customer3); CurrentCustomer customer4 = new CurrentCustomer("Emily", "Arnold"); _customerRepo.AddCustomer(customer4); PastCustomer customer5 = new PastCustomer("Jim", "Williams"); _customerRepo.AddCustomer(customer5); PastCustomer customer6 = new PastCustomer("Henry", "Jones"); _customerRepo.AddCustomer(customer6); }
public ActionResult GetScoreModelVersionAndEchartsData(int engineeringId) { var engineering = new EngineeringService().Get(e => e.Id == engineeringId); if (engineering == null) { throw new ArgumentNullException(nameof(engineering)); } if (!new PermissionService().CanUserVisitProject(CurrentCustomer, engineering.ProjectId)) { return(NoAuthorityJson()); } if (CurrentCustomer.Organization.OrganizationType != OrganizationType.Censorship) { return(NoAuthorityJson()); } var lamda = PrepareEchartsDataLamda(engineering); var comments = new CommentService().GetCommentByRoleAndEngineeringFileId(CurrentCustomer.GetCurrentRoles(0, engineering).OrderBy(e => (int)e).FirstOrDefault(), engineering.EngineeringFiles.FirstOrDefault(e => e.FileType == FileType.Model).FileVersions.OrderByDescending(e => e.UpLoadeTime).FirstOrDefault().Id).Where(lamda).ToList(); var echartsData = PrepareEchartData(comments); var modelVersions = PrepareScoreModelVersionModel(engineering); return(Json(new { result = true, echartsData = echartsData, modelVersions = modelVersions }, JsonRequestBehavior.AllowGet)); }
public void Can_Generate_An_Invoice_For_Preview() { //// Arrange CurrentCustomer.Basket().AddItem(_product1, 10); CurrentCustomer.Basket().AddItem(_product2, 5); CurrentCustomer.Basket().AddItem(_product3, 1); this.CurrentCustomer.Basket().Save(); var shipping = MockAddressMaker.GetAddress("US"); var billing = MockAddressMaker.GetAddress("US"); var checkoutManager = this.CurrentCustomer.Basket().GetCheckoutManager(); checkoutManager.Customer.SaveShipToAddress(shipping); checkoutManager.Customer.SaveBillToAddress(billing); var shipment = this.CurrentCustomer.Basket().PackageBasket(shipping).FirstOrDefault(); var quotes = shipment.ShipmentRateQuotes().ToArray(); Assert.NotNull(quotes); Assert.IsTrue(quotes.Any(), "The collection of quotes was empty"); checkoutManager.Shipping.SaveShipmentRateQuote(quotes.First()); //// Act checkoutManager.Context.Settings.InvoiceNumberPrefix = "rss"; var invoice = checkoutManager.Payment.PrepareInvoice(); //// Assert Assert.NotNull(invoice); Assert.IsTrue(invoice.PrefixedInvoiceNumber().StartsWith("rss")); }
void OnCustomersSetUpdated(object sender, EditableObjectEventArgs e) { if (CurrentCustomer != null) { CurrentCustomer.Reload(); } }
public void Arrange() { PastCustomer customer1 = new PastCustomer("Lina", "Smith"); _repo.AddCustomer(customer1); PotentialCustomer customer2 = new PotentialCustomer("Kel", "Smith"); _repo.AddCustomer(customer2); CurrentCustomer customer3 = new CurrentCustomer("Eric", "Smith"); _repo.AddCustomer(customer3); PastCustomer customer4 = new PastCustomer("Chris", "Forsythe"); _repo.AddCustomer(customer4); CurrentCustomer customer5 = new CurrentCustomer("Jacob", "Bullock"); _repo.AddCustomer(customer5); PotentialCustomer customer6 = new PotentialCustomer("Kate", "Harrison"); _repo.AddCustomer(customer6); }
public void Can_Save_A_Shipment_Rate_Quote() { //// Arrange CurrentCustomer.Basket().AddItem(_product1, 10); this.CurrentCustomer.Basket().Save(); var shipping = MockAddressMaker.GetAddress("US"); var checkoutManager = this.CurrentCustomer.Basket().GetCheckoutManager(); checkoutManager.Customer.SaveShipToAddress(shipping); //// Act var shipment = this.CurrentCustomer.Basket().PackageBasket(shipping).FirstOrDefault(); Assert.NotNull(shipment); var quotes = shipment.ShipmentRateQuotes().ToArray(); Assert.NotNull(quotes); Assert.IsTrue(quotes.Any(), "The collection of quotes was empty"); checkoutManager.Shipping.SaveShipmentRateQuote(quotes.First()); //// Assert var shippingLineItems = checkoutManager.Context.ItemCache.Items.Where(x => x.LineItemType == LineItemType.Shipping); Assert.IsTrue(shippingLineItems.Any()); }
public ActionResult DeleteDictionary(DictionaryType type, int dictionaryId) { if (!CurrentCustomer.IsSuperAdmin()) { return(NoAuthorityJson()); } Dictionary dictionary; if (type != DictionaryType.FirstCommentType) { var list = DictionaryService.GetDictionaryList(type.GetDescription()); dictionary = list.Find(e => e.Id == dictionaryId); new DictionaryService().DeleteDictionary(dictionary); } else { dictionary = DictionaryService.DesignCommentTypeDictionary.FirstOrDefault(e => e.Id == dictionaryId); if (dictionary == null) { dictionary = DictionaryService.IntegralityCommentTypeDictionary.Find(e => e.Id == dictionaryId); } new DictionaryService().DeleteDictionary(dictionary); } return(Json(new { result = true, dictionaryId = dictionaryId, type = type, level = dictionary.DisplayName })); }
private async void Complete(object param) { ClearMessages(); IsBusy = true; var state = param as EntityBase; state.InProgress = true; try { var currentState = await remediationService.CompleteStateAsync(state); } catch (StateException ex) { ShowMessage(new Message() { MessageType = MessageType.Warn, Text = ex.Message }, true); } catch (Exception ex) { ShowMessage(new Message() { MessageType = MessageType.Error, Text = ex.Message }); } finally { IsBusy = false; state.InProgress = false; CurrentCustomer.Refresh(); } }
public ActionResult GetModelProfessionState(int modelVersionId, int professionId) { var modelVersion = new FileVersionService().Get(e => e.Id == modelVersionId); if (modelVersion == null) { throw new ArgumentNullException(nameof(modelVersion)); } if (!new PermissionService().CanUserVisitProject(CurrentCustomer, modelVersion.EngineeringFile.Engineering.ProjectId)) { return(NoAuthorityJson()); } var modelProfession = new ModelProfessionService().Get(e => e.ModelVersionId == modelVersionId && e.ProfessionId == professionId); var customerRoles = CurrentCustomer.CustomerRoles.Where(e => e.ProjectId == modelVersion.EngineeringFile.Engineering.ProjectId && e.FinishTime == null); string roleDes = CurrentCustomer.GetCurrentRoleDes(professionId, modelVersion.EngineeringFile.Engineering); ModelProfessionOperateModel operateModel = null; if (professionId != 0 && modelProfession != null) { var roles = CurrentCustomer.GetCurrentRoles(professionId, modelProfession.EngineerFile.Engineering); operateModel = PrepareOperateModel(modelProfession, roles); } return(Json(new { result = true, roleDes = roleDes, htmlStr = base.RenderPartialViewToString("_ModelProfessionOperate", operateModel) }, JsonRequestBehavior.AllowGet)); }
private void WriteBasketInfoToConsole() { Console.WriteLine("----------- Basket Item Info ---------------------"); Console.WriteLine("Total quantity count: {0}", CurrentCustomer.Basket().TotalQuantityCount); Console.WriteLine("Total basket price: {0}", CurrentCustomer.Basket().TotalBasketPrice); Console.WriteLine("Total item count: {0}", CurrentCustomer.Basket().TotalItemCount); }
public void DebitAmount() { if (CurrentCustomer.Accounts[0] != null) { MessageBox.Show("Account Information", ConstStrings.Get("Question"), MessageBoxButton.YesNo, MessageBoxImage.Asterisk); } CurrentCustomer.DebitMembershipFee(_currentCustomer.DefaultMemberAmount); }
public void ExplicitOperatorTest_ShouldConvertCustomerType() { //Works PotentialCustomer potential = new PotentialCustomer(); CurrentCustomer current = (CurrentCustomer)potential; //Works Customer customer = _repo.GetCustomerByName("Lina", "Smith"); CurrentCustomer anotherCurrent = (CurrentCustomer)(potential as PotentialCustomer); }
private void UpdatePayments() { CurrentCustomerPayments = CurrentCustomer == null ? null : CurrentCustomer.CustomerPayments; if (CurrentCustomer != null) { CurrentCustomer.UpdateCash(); } // CanCheckActiveRents = CurrentCustomer != null && CurrentCustomerActiveRents.Count > 0; }
public ActionResult CreateOrder(string phoneNumber, string address) { CurrentCustomer currentCustomer = (CurrentCustomer)Session[SessionBox.CUSTOMER_SESSION]; if (currentCustomer != null) { int customerID = currentCustomer.GetCustomerID(); Customer customer = db.Customers.FirstOrDefault(m => m.CustomerID == customerID); using (DbContextTransaction transaction = db.Database.BeginTransaction()) { try { Order order = new Order(); order.AccountCustomerID = customer.AccountID; order.OrderDate = DateTime.Now; order.TotalMoney = GetCart().ComputeTotalPrice(); order.ModifiredDate = DateTime.Now; order.OrderStatusID = 1;//ordered order.IsActive = true; order.OrderAddress = address; order.PhoneNumber = phoneNumber; db.Orders.Add(order); foreach (var item in GetCart().ListCartItems) { OrderDetail detail = new OrderDetail(); detail.OrderID = order.OrderID; detail.Quantity = item.Quantity; detail.IsActive = true; detail.Money = item.Quantity * item.Book.Price; detail.BookID = item.Book.BookID; db.OrderDetails.Add(detail); var book = db.Books.FirstOrDefault(b => b.BookID == item.Book.BookID); book.Quantity -= item.Quantity; db.Entry(book).State = EntityState.Modified; } db.SaveChanges(); transaction.Commit(); //clear cart GetCart().Clear(); return(Json(new { id = order.OrderID, email = customer.CustomerEmail }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Console.WriteLine(ex.Message); transaction.Rollback(); return(Json(new { id = 0, email = "" }, JsonRequestBehavior.AllowGet)); } } } else { return(Json(new { id = 0, email = "" }, JsonRequestBehavior.AllowGet)); } }
public void SeedContent() { CurrentCustomer customerOne = new CurrentCustomer(1, "Konrad", "Haight", "*****@*****.**"); _customerRepo.AddCustomerToList(customerOne); PastCustomer customerTwo = new PastCustomer(2, "Nicole", "Haight", "*****@*****.**"); _customerRepo.AddCustomerToList(customerTwo); PotentialCustomer customerThree = new PotentialCustomer(3, "Ruby", "Haight", "none"); _customerRepo.AddCustomerToList(customerThree); }
/// <summary> /// parses information to gather both the CustomerID and Name exclusively. /// </summary> public void parseCustomerInformation() { string[] split = CurrentCustomer.Split(' '); if (CurrentCustomer.IndexOf(' ') == 0) { CurrentCustomerID = split[1].ToString(); CurrentCustomer = split[2].ToString() + " " + split[3].ToString(); } else { CurrentCustomer = split[0].ToString() + " " + split[1].ToString(); } }
public void EditCustomer() { Console.WriteLine("Enter the customer ID:"); if (Int32.TryParse(Console.ReadLine(), out _userInput)) { if (_customerRepo.GetCustomerById(_userInput) != null) { ICustomer oldCustomer = _customerRepo.GetCustomerById(_userInput); ICustomer newCustomer; if (oldCustomer is CurrentCustomer) { newCustomer = new CurrentCustomer(); } else if (oldCustomer is PastCustomer) { newCustomer = new PastCustomer(); } else { newCustomer = new PotentialCustomer(); } Console.WriteLine("Enter the new customer ID"); newCustomer.Id = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter the new customer first name"); newCustomer.FirstName = Console.ReadLine(); Console.WriteLine("Enter the new customer last name"); newCustomer.LastName = Console.ReadLine(); Console.WriteLine("Enter the new customer email"); newCustomer.Email = Console.ReadLine(); _customerRepo.UpdateExistingCustomer(_userInput, newCustomer); Console.Clear(); } else { Console.WriteLine("Failed to locate customer\n" + "Press any key to try again."); Console.ReadKey(); Console.Clear(); } } else { Console.WriteLine("Please enter a valid customer ID\n" + "Press any key to try again."); Console.ReadKey(); Console.Clear(); } }
private void AddNewCurrentCustomer() { Console.Clear(); string firstName = _prompt.PromptUserForFirstName(); string lastName = _prompt.PromptUserForLastName(); CurrentCustomer customer = new CurrentCustomer(firstName, lastName); _customerRepo.AddCustomer(customer); Console.Clear(); Console.WriteLine("Customer was successfully added..."); Console.ReadLine(); }
public void Can_Add_Custom_Discount_ToBasket_And_Transfer_It_To_CheckoutManager() { //// Arrange var basket = CurrentCustomer.Basket(); var discount = new ItemCacheLineItem(LineItemType.Discount, "Test discount", "test", 1, 2, new ExtendedDataCollection()); basket.AddItem(_product1, 10); basket.AddItem(_product2, 5); basket.AddItem(_product3, 1); var preDiscountTotal = basket.TotalBasketPrice; basket.AddItem(discount); var postDiscountTotal = basket.TotalBasketPrice; Assert.AreEqual(postDiscountTotal, preDiscountTotal - 2, "Discount failed to calculate correctly"); var total = CurrentCustomer.Basket().TotalBasketPrice; this.CurrentCustomer.Basket().Save(); Assert.AreEqual(4, CurrentCustomer.Basket().Items.Count()); // var shipping = MockAddressMaker.GetAddress("US"); var billing = MockAddressMaker.GetAddress("US"); var checkoutManager = this.CurrentCustomer.Basket().GetCheckoutManager(); checkoutManager.Customer.SaveShipToAddress(shipping); checkoutManager.Customer.SaveBillToAddress(billing); var shipment = this.CurrentCustomer.Basket().PackageBasket(shipping).FirstOrDefault(); var quotes = shipment.ShipmentRateQuotes().ToArray(); Assert.NotNull(quotes); Assert.IsTrue(quotes.Any(), "The collection of quotes was empty"); checkoutManager.Shipping.SaveShipmentRateQuote(quotes.First()); //// Act checkoutManager.Context.Settings.InvoiceNumberPrefix = "rss"; var invoice = checkoutManager.Payment.PrepareInvoice(); //// Assert Assert.NotNull(invoice); Assert.IsTrue(invoice.PrefixedInvoiceNumber().StartsWith("rss")); }
public ActionResult AddDictionary(DictionaryModel model) { if (!CurrentCustomer.IsSuperAdmin()) { return(NoAuthorityJson()); } var dictionary = DictionaryModelToEntity(model); new DictionaryService().InsertOrUpdateDictionary(dictionary); var htmlStr = PrepareDictionaryAddHtmlStr(dictionary, model); return(Json(new { result = true, htmlStr = htmlStr, dictionary = model })); }
public void Can_Show_Adding_An_Additional_Item_To_Basket_Triggers_IsNewVersion() { this.WriteBasketInfoToConsole(); //// Arrange CurrentCustomer.Basket().AddItem(_product1, 10); this.CurrentCustomer.Basket().Save(); //// Act/Assert Assert.IsTrue(this.CurrentCustomer.Basket().GetCheckoutManager().Context.IsNewVersion, "Initialized as new version"); Assert.IsFalse(this.CurrentCustomer.Basket().GetCheckoutManager().Context.IsNewVersion, "Second call should not be a new version"); CurrentCustomer.Basket().AddItem(_product2, 5); this.CurrentCustomer.Basket().Save(); Assert.IsTrue(this.CurrentCustomer.Basket().GetCheckoutManager().Context.IsNewVersion, "Basket version changed so new version should be true"); }
protected DrawingSeriesListModel PrepareDrawingSeriesListModel(PagedList <EngineeringFile> drawings, int projectId, int engineeringId, int profeesionId = 0, string selectedStateId = "") { DrawingSeriesListModel model = new DrawingSeriesListModel(); var project = new ProjectService().Get(e => e.Id == projectId); if (project == null) { throw new ArgumentNullException(nameof(project)); } var engineering = new EngineeringService().Get(e => e.Id == engineeringId); if (engineering == null) { throw new ArgumentNullException(nameof(engineering)); } model.Roles = CurrentCustomer.GetCurrentRoles(profeesionId, engineering); model.ProjectIsFiled = project.IsProjectFiled(); foreach (var drawing in drawings) { model.DrawingSeriesList.Add(new DrawingSeriesListModel.DrawingSeriesModel() { Description = drawing.FileVersions.Where(e => e.FileType == FileType.Drawing).OrderByDescending(e => e.UpLoadeTime).FirstOrDefault()?.UploadDescription, DrawingVersion = drawing.FileVersions.Where(e => e.FileType == FileType.Drawing).OrderByDescending(e => e.UpLoadeTime).FirstOrDefault()?.VersionNo, FileSize = drawing.FileVersions.Where(e => e.FileType == FileType.Drawing).OrderByDescending(e => e.UpLoadeTime).FirstOrDefault()?.FileSize, DrawingCategoryId = drawing.DrawingCatalogId.GetValueOrDefault(), DrawingCategory = DictionaryService.DrawingCatalogDictionary.FirstOrDefault(e => e.Id == drawing.DrawingCatalogId)?.DisplayName, DrawingProfessionId = drawing.DrawingProfessionId.GetValueOrDefault(), DrawingProfession = DictionaryService.DrawingProfessionDictionary.FirstOrDefault(e => e.Id == drawing.DrawingProfessionId)?.DisplayName, DrawingName = drawing.FileName, DrawingSeriesId = drawing.Id, DrawingStatus = drawing.Status, PicUri = drawing.FileVersions.OrderByDescending(i => i.UpLoadeTime).FirstOrDefault()?.BIMFileId, UpdateTime = drawing.UpLoadTime.ToString("yyyy-MM-dd HH:mm:ss"), }); } //TODO 二期添加关于图纸审核的流程 model.AvaliableStatus.Add(new SelectListItem() { Text = "已上传", Value = "", Selected = true }); return(model); }
protected PagedList <FileVersion> GetAllModelVersion(int pageIndex, int pageSize, Expression <Func <FileVersion, bool> > lamda, int engineeringId) { var model = new EngineeringFileService().Get(e => e.EngineeringId == engineeringId && e.FileType == FileType.Model); if (model == null) { return(new PagedList <FileVersion>()); } var customerRoles = CurrentCustomer.GetCurrentRoles(0, model.Engineering); var query = new FileVersionService().GetListByRoleAndEngineeingId(customerRoles.OrderBy(e => (int)e).FirstOrDefault(), model.Id); query = query.Where(lamda).OrderByDescending(e => e.UpLoadeTime); return(new PagedList <FileVersion>(query, pageIndex, pageSize)); }
/** * Príchod zákazníka * 1. Naplánuem príchod ďalšieho zákazníka. (Nemá inštancie) * 2. Naplanujem na časovú os. * 3. Naplánujem príchod, referenciujem nového zákaznika. * 4. Vytvorím príchod samého seba. * * Príznak IsServed * a. TRUE - vložím do frontu referenciu zákaznika. * b. FALSE * - 1. nastavím na TRUE * - 2. vytvorím inštanciu StartPayment * - 3. naplánujem si udalosť s aktuálnym simulačným časom. * **/ public override void Execute() { //1. var time = (this.EventTime + ((SimCoreShop)ReferenceSimCore).Generators[1].GenerateDouble()); //initializaiton of new event - arrival of Customer var newEvent = new Arrival(time, ReferenceSimCore, new Customer()); //2. //planning of event on timeline ReferenceSimCore.ScheduleEvent(newEvent, time); //////////3. //////////set current customer time of his/her arrival to the system. ////////this. //4. //a. if (((SimCoreShop)ReferenceSimCore).IsServed) { //3. //set current customer time of his/her arrival to the system. CurrentCustomer.StartWaiting(EventTime); //add him to waiting queue as last ((SimCoreShop)ReferenceSimCore).AddCustomer(this.CurrentCustomer); // Console.WriteLine(core.CurrentTime+"\tCustomer is wainting in queue." ); } else { //b. //b.1. // core.IsServed = true; //b.2. //do other event //customer is paying for his newspapers //initialization of new event - start of payment StartPayment sp = new StartPayment(EventTime, ReferenceSimCore, CurrentCustomer); //b.3. //plan this event ((SimCoreShop)ReferenceSimCore).ScheduleEvent(sp, EventTime); // Console.WriteLine(core.CurrentTime + "\tCustomer started paying."); } }
protected List <SelectListItem> PrepareScoreModelVersionModel(Engineering engineering) { var modelId = engineering.EngineeringFiles.FirstOrDefault(e => e.FileType == FileType.Model)?.Id; if (!modelId.HasValue) { return(new List <SelectListItem>()); } return(new FileVersionService().GetListByRoleAndEngineeingId(CurrentCustomer.GetCurrentRoles(0, engineering).OrderBy(e => (int)e).FirstOrDefault(), modelId.Value).OrderByDescending(e => e.UpLoadeTime).ToList().Select(e => { return new SelectListItem() { Text = string.Format("{0}-{1}", e.FileName, e.VersionNo), Value = e.Id.ToString(), }; }).ToList()); }
public void Can_Show_Customer_Addresses_Are_Cleared_After_VersionReset() { //// Arrange var shipping = MockAddressMaker.GetAddress(); var billing = MockAddressMaker.GetAddress(); var checkoutManager = this.CurrentCustomer.Basket().GetCheckoutManager(); checkoutManager.Customer.SaveShipToAddress(shipping); checkoutManager.Customer.SaveBillToAddress(billing); //// Act CurrentCustomer.Basket().AddItem(_product1, 10); this.CurrentCustomer.Basket().Save(); Assert.IsNull(this.CurrentCustomer.Basket().GetCheckoutManager().Customer.GetShipToAddress()); Assert.IsNull(this.CurrentCustomer.Basket().GetCheckoutManager().Customer.GetBillToAddress()); }
public void Can_Create_A_CheckoutContext() { this.WriteBasketInfoToConsole(); //// Arrange CurrentCustomer.Basket().AddItem(_product1, 10); this.WriteBasketInfoToConsole(); //// Act var context = this.CurrentCustomer.Basket().CreateCheckoutContext(MerchelloContext.Current, new CheckoutContextSettings()); //// Assert Assert.NotNull(context); Assert.NotNull(context.Services); Assert.NotNull(context.Gateways); Assert.IsTrue(context.Settings.ApplyTaxesToInvoice); Assert.AreEqual(1, context.ItemCache.Items.Count); }
public Guid?ReturnRents() { Receipt overdueReceipt = null; if (MessageBox.Show(ReturningLate() ? ConstStrings.Get("ReturnAndPaymentLateFeeQuestion") : ConstStrings.Get("ReturnQuestion"), ConstStrings.Get("Question"), MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { List <Rent> returns = new List <Rent>(); foreach (Rent rent in checkedRents.Keys) { returns.Add(rent); } overdueReceipt = CurrentCustomer.ReturnRents(returns); } checkedRents.Clear(); CheckedRentsChangedSignal = true; CheckedRentsChangedSignal = false; CanReturnItems = false; return(overdueReceipt == null ? null : (Guid?)overdueReceipt.Oid); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { if ((Session["ReDirectToStep"] == null || (bool)Session["ReDirectToStep"] == false) && Request.RequestType == "GET" && !Request.Url.PathAndQuery.Contains(@"page?")) { #region ReDirectToStep=false Session["baseURL"] = Request.Url; CommonSessionInformation = Session[SessionConst.SESSION_CURRENTCUSTOMER] as CurrentCustomer; if (CommonSessionInformation != null) { #region Step1ok Step4chek Step4ok Step1timeout if (Request.Url.OriginalString.Contains("step1ok")) { filterContext.Result = new RedirectResult(Url.Action("step1ok", "step")); Session["ReDirectToStep"] = true; return; } else if (Request.Url.OriginalString.Contains("step4check")) { filterContext.Result = new RedirectResult(Url.Action("step4check", "step")); Session["ReDirectToStep"] = true; return; } else if (Request.Url.OriginalString.Contains("step4ok")) { filterContext.Result = new RedirectResult(Url.Action("step4ok", "step")); Session["ReDirectToStep"] = true; return; } else if (Request.Url.OriginalString.Contains("step1timeout")) { filterContext.Result = new RedirectResult(Url.Action("step1timeout", "step")); Session["ReDirectToStep"] = true; return; } #endregion #region StepStatusによるRedirect else if (CommonSessionInformation.Step1Status != 2) { filterContext.Result = new RedirectResult(Url.Action("step1", "step")); Session["ReDirectToStep"] = true; return; } else if (CommonSessionInformation.Step2Status == 1 || CommonSessionInformation.Step2Status == 2) { filterContext.Result = new RedirectResult(Url.Action("step2ng", "step")); Session["ReDirectToStep"] = true; return; } else if ((CommonSessionInformation.Step2Status != 3)) { filterContext.Result = new RedirectResult(Url.Action("step2", "step")); Session["ReDirectToStep"] = true; return; } else if (CommonSessionInformation.Step3Status == 1 || CommonSessionInformation.Step3Status == 2) { filterContext.Result = new RedirectResult(Url.Action("step3ng", "step")); Session["ReDirectToStep"] = true; return; } else if ((CommonSessionInformation.Step3Status != 3)) { filterContext.Result = new RedirectResult(Url.Action("step3", "step")); Session["ReDirectToStep"] = true; return; } else if (CommonSessionInformation.MyPageStatus != 2) //マイページステータス「有効」で無いユーザー { filterContext.Result = new RedirectResult(Url.Action("step4", "step")); Session["ReDirectToStep"] = true; return; } #endregion else { CommonSessionInformation = Session[SessionConst.SESSION_CURRENTCUSTOMER] as CurrentCustomer; //該当しないステータスでSTEP系のページが要求されたらTOPへ遷移させる if (Request.Url.OriginalString.Contains("step1") || Request.Url.OriginalString.Contains("step2") || Request.Url.OriginalString.Contains("step2_other") || Request.Url.OriginalString.Contains("step3")) { filterContext.Result = new RedirectResult(Url.Action("index", "home")); Session["ReDirectToStep"] = false; } //2015.7.15 T.Ebihara - 未予約・キャンセル・卒業済 の顧客はinfo系のページには遷移できない //2015.7.16 T.Ebihara - キャンセル・卒業済 の顧客はinfo系のページには遷移できない else if (Request.Url.OriginalString.Contains("/info/") && //info系のページを要求 ( //(CommonSessionInformation.Book.BookStateCD == 2) || //未予約 (CommonSessionInformation.Book.BookStateCD == 11) || //キャンセル (CommonSessionInformation.Book.GradDate < System.DateTime.Today) //卒業済 )) { filterContext.Result = new RedirectResult(Url.Action("index", "home")); Session["ReDirectToStep"] = false; } else { Session["baseURL"] = Request.Url; Session["ReDirectToStep"] = false; } } Session["UserBaseUrl"] = CommonSessionInformation.UserID + ""; } else { filterContext.Result = new RedirectResult(Url.Action("member", "login")); Session["baseURL"] = Request.Url; } #endregion } else { CommonSessionInformation = Session[SessionConst.SESSION_CURRENTCUSTOMER] as CurrentCustomer; Session["ReDirectToStep"] = false; } base.OnActionExecuting(filterContext); }