public Client([TestContract("c1")] ServiceWrap wrap, OtherService otherService) { this.wrap = wrap; this.otherService = otherService; }
public ServiceWrap(Service service, OtherService otherService) { this.service = service; this.otherService = otherService; }
public UserController(UserService service, UserQueries data, ArtistService artistService, ArtistQueries artistQueries, OtherService otherService, IRepository repository, UserMessageQueries messageQueries, IPRuleManager ipRuleManager, VdbConfigManager config, MarkdownParser markdownParser) { Service = service; Data = data; this.artistQueries = artistQueries; this.artistService = artistService; this.repository = repository; this.otherService = otherService; this.messageQueries = messageQueries; this.ipRuleManager = ipRuleManager; this.config = config; this.markdownParser = markdownParser; }
public Service(OtherService <T> otherService, IDependency dependency) { OtherService = otherService; }
public HomeController(SongQueries songService, OtherService otherService, BrandableStringsManager brandableStringsManager) { this.songService = songService; this.otherService = otherService; this.brandableStringsManager = brandableStringsManager; }
public CommentController(OtherService otherService) { this.otherService = otherService; }
public void TestNonHookedExceptionOnFinally() { IOtherService other = new OtherService(); other.ThrowExceptionOnFinally().Should().Be(new DateTime(2009, 09, 09)); }
private void EndButton_Click(object sender, EventArgs e) { try { var dateMadeChanges = DateMadeChanges_DatePicker.Value; var kilometers = CurrentKilometers_TextBox.Text.Trim(); var serviceMade = Description_TextBox.Text.Trim(); HomePageForm homePageForm; if (string.IsNullOrWhiteSpace(kilometers) && string.IsNullOrWhiteSpace(serviceMade)) { dbContext.Cars.Add(Car); dbContext.SaveChanges(); homePageForm = new HomePageForm(); Close(); homePageForm.Show(); return; } var sb = new StringBuilder(); var emptyOrWrongFields = new List <string>(); if (string.IsNullOrWhiteSpace(kilometers)) { emptyOrWrongFields.Add("Км"); } if (string.IsNullOrWhiteSpace(serviceMade)) { emptyOrWrongFields.Add("Извършена сервизна дейност"); } if (emptyOrWrongFields.Count() > 0) { sb.AppendLine("Моля попълнете следните полета: "); sb.AppendLine(string.Join(", ", emptyOrWrongFields.Select(x => x))); MessageBox.Show(sb.ToString()); return; } var currentKilometersRegex = new Regex("^([0-9]*)$|^([0-9]* [0-9]*)$"); if (!currentKilometersRegex.IsMatch(kilometers)) { emptyOrWrongFields.Add("Км"); } if (emptyOrWrongFields.Count() > 0) { sb.AppendLine("Моля въведете коректни данни за следните полета: "); sb.AppendLine(string.Join(", ", emptyOrWrongFields.Select(x => x))); MessageBox.Show(sb.ToString()); return; } var toStringedDate = dateMadeChanges.ToString("dd.M.yyyy HH:mm:ss"); var jsonData = new OtherServicesJsonData(toStringedDate, kilometers, serviceMade); var data = JsonConvert.SerializeObject(jsonData); var otherServices = new OtherService(data); Car.OtherServices.Add(otherServices); dbContext.Cars.Add(Car); dbContext.SaveChanges(); homePageForm = new HomePageForm(); Close(); homePageForm.Show(); } catch (Exception ex) { logger.WriteLine($"CreateNewServiceBookFormThree.End_Button_Click: {ex}"); MessageBox.Show("Възникна неочаквана грешка!"); } }
public void TestNonHookedException() { IOtherService other = new OtherService(); other.ThrowException().Should().Be(42.42f); }
public HomeController(OtherService otherService, BrandableStringsManager brandableStringsManager) { this.otherService = otherService; this.brandableStringsManager = brandableStringsManager; }
public EntryApiController(EntryQueries queries, OtherService otherService) { this.queries = queries; this.otherService = otherService; }
public ActionResult Checkout(ShippingDetailViewModel shippingDetailViewModel) { if (ModelState.IsValid) { string userId = User.Identity.GetUserId(); IEnumerable <CartDetail> cartDetails = cartService.GetByUserID(userId); IEnumerable <Book> books = bookService.GetAll(); // Kiem tra tinh hop le cua gio hang bool flagValid = true; foreach (var cartDetail in cartDetails) { Book tmpBook = cartDetail.Book; int wareHouseQuantity = (int)bookService.GetByID(tmpBook.ID).Quantity; if (cartDetail.Quantity > wareHouseQuantity) { cartDetail.Quantity = wareHouseQuantity; cartService.UpdateCartDetail(cartDetail); flagValid = false; } } if (flagValid == false) { TempData["errorMessage"] = "Một số sách bạn đặt có số lượng không đủ, chúng tôi đã cập nhật " + " lại số lượng sách của vài sản phẩm trong giỏ hàng, mời bạn xem và đặt hàng lại"; return(RedirectToAction("Index")); } // Neu hop le // create order and orderDetail and update book quantity int totalMoney = cartService.GetTotalMoney(User.Identity.GetUserId()); Order order = Mapper.Map <Order>(shippingDetailViewModel); order.UserId = userId; order.Status = (int)StatusOrder.New; order.OrderDate = DateTime.Today; order.Amount = totalMoney; orderService.CreateOrder(order); // send mail to customer string subject = "Notification about your order at DTBook"; ICollection <OrderDetailViewModel> orderDetailViewModels = new List <OrderDetailViewModel>(); var orderDetails = order.OrderDetails; foreach (var item in orderDetails) { OrderDetailViewModel tmpOrDeViewModel = Mapper.Map <OrderDetailViewModel>(item); orderDetailViewModels.Add(tmpOrDeViewModel); } var model = new OrderConfirmEmailModel() { Order = order, OrderDetailViewModels = orderDetailViewModels }; var path = Path.Combine(Server.MapPath("~/Helpers/EmailTemplate"), "OrderConfirmTemplate.cshtml"); var templateSerivce = new TemplateService(); try { string emailHtmlBody = templateSerivce.Parse(System.IO.File.ReadAllText(path), model, null, null); OtherService.SendMail(shippingDetailViewModel.Email, subject, emailHtmlBody); } catch (Exception ex) { Debug.Write("This is inner exeption: " + ex.Message); Debug.Write("This is inner exeption: " + ex.InnerException); } return(View()); } else { string errorMessage = ""; foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { errorMessage += error.ErrorMessage + "<br />"; } } TempData["errorMessage"] = errorMessage; return(RedirectToAction("Index")); } }
public QueryService(ArtistQueries artistQueries, TagQueries tagQueries, UserQueries userQueries, AlbumService albumService, ArtistService artistService, SongService songService, UserService userService, OtherService otherService, IUserPermissionContext userPermissionContext) { this.artistQueries = artistQueries; this.tagQueries = tagQueries; this.userQueries = userQueries; this.albumService = albumService; this.artistService = artistService; this.songService = songService; this.userService = userService; this.otherService = otherService; this.userPermissionContext = userPermissionContext; }