/// <summary> /// Saves all Customer Data into the Database and sends a Message to UI to refresh /// </summary> public void SaveCustomer() { IsDogToSave = false; IsDogRemoveToSave = false; CModel.FirstName = FirstName; CModel.LastName = LastName; CModel.Street = Street; CModel.HouseNumber = Housenumber; CModel.ZipCode = ZipCode; CModel.City = SelectedCity; CModel.PhoneNumber = PhoneNumber; CModel.MobileNumber = MobileNumber; CModel.Email = Email; CModel.Birthday = Birthday; if (NotActive) { CModel.Active = false; } else { CModel.Active = true; } GlobalConfig.Connection.UpdateCustomer(CModel); GlobalConfig.Connection.Get_Customer(CModel); SuccessMessages.ChangesSavedSuccess(); EventAggregationProvider.DogginatorAggregator.PublishOnUIThread(CModel); }
public async Task <IActionResult> Create(Create.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyCreatedProduct(command.Name)); return(this.RedirectToActionJson("Products", "Admin")); }
public async Task <IActionResult> Remove(Remove.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyDeletedRole((int)command.RoleId)); return(this.RedirectToActionJson("Roles", "Admin")); }
public async Task <IActionResult> Remove(Remove.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyRemovedCategory(command.Name)); return(this.RedirectToActionJson("Categories", "Admin")); }
public async Task <IActionResult> Remove(Remove.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyRemovedProduct(command.ProductId)); return(RedirectToAction("Products", "Admin")); }
public void AddMessage(MessageType messageType, string message) { var userMessage = new UserMessage { MessageType = messageType, Message = message }; switch (messageType) { case MessageType.Information: InformationMessages.Add(userMessage); break; case MessageType.Success: SuccessMessages.Add(userMessage); break; case MessageType.Error: ErrorMessages.Add(userMessage); break; case MessageType.Warning: WarningMessages.Add(userMessage); break; } }
public async Task <IActionResult> Edit(Edit.Command command) { await this.mediator.SendAsync(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyEditedRole(command.Name)); return(this.RedirectToActionJson("Roles", "Admin")); }
private async Task ButtonRegisterClicked() { ErrorMessages.Clear(); SuccessMessages.Clear(); try { if (!String.IsNullOrEmpty(SelectedServerAddress) && Uri.IsWellFormedUriString(SelectedServerAddress, UriKind.Absolute)) { EnableProgressRing = true; var user = new User() { Name = Name, Password = this._passwordHashService.HashSecureString(Password) }; var registerResult = await this._authenticationService.RegisterUser(user); if (registerResult.Success) { SuccessMessages.Add("Registration successful."); this.RemoveLoginInformation(true); } else { ErrorMessages.Add(String.Format("Registration unsuccessful. Reason: {0}", registerResult.StatusCode)); // Show the response of the server to the user. if (registerResult.Response != null) { var outputMap = "Field: {0}, Value: {1}"; if (!String.IsNullOrEmpty(registerResult.Response.Name)) { ErrorMessages.Add(String.Format(outputMap, nameof(Name), registerResult.Response.Name)); } if (!String.IsNullOrEmpty(registerResult.Response.Password)) { ErrorMessages.Add(String.Format(outputMap, nameof(Password), registerResult.Response.Password)); } } } } else { ErrorMessages.Add("Please use a valid URL."); } } catch (HttpRequestException) { ErrorMessages.Add("Server could not be reached."); } finally { EnableProgressRing = false; } }
public static string GetMessage(SuccessMessages successMessages) { switch (successMessages) { case SuccessMessages.EverythingsOkay: return("Vehicle Perfectly Landed.. Those Are Coordination Informations Of It"); default: return(""); } }
public async Task SuccessfulCreationSetsSuccessMessage(SliceFixture fixture) { // Arrange var controller = fixture.GetController <CategoryController>(); // Act var createCommand = new Create.Command { Name = "Some category" }; await controller.Create(createCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyCreatedCategory(createCommand.Name)); }
public async Task SuccessfullRemoveSetsSuccessMessage(SliceFixture fixture) { // Arrange var category = AddCategoryToDatabase(fixture); var controller = fixture.GetController <CategoryController>(); // Act var removeCommand = new Remove.Command { Id = category.Id }; await controller.Remove(removeCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyRemovedCategory(removeCommand.Name)); }
public async Task SuccessfullEditSetsSuccessMessage(SliceFixture fixture) { // Arrange var category = AddCategoryToDatabase(fixture); var controller = fixture.GetController <CategoryController>(); // Act var editCommand = new Edit.Command { Id = category.Id, Name = "Edited name" }; await controller.Edit(editCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyEditedCategory(editCommand.Name)); }
public void SuccessfullCreationSetsSuccessMessage(SliceFixture fixture) { // Arrange var controller = fixture.GetController <RoleController>(); // Act var createCommand = new Create.Command { Name = "Some role" }; controller.Create(createCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyCreatedRole(createCommand.Name)); }
public async Task SuccessfullRemoveSetsSuccessMessage(SliceFixture fixture) { // Arrange var product = AddProductToDatabase(fixture); var controller = fixture.GetController <ProductController>(); // Act var removeCommand = new Remove.Command { ProductId = product.Id }; await controller.Remove(removeCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyRemovedProduct(removeCommand.ProductId)); }
public async Task SuccessfullRemovalSetsSuccessMessage(SliceFixture fixture) { // Arrange var controller = fixture.GetController <RoleController>(); var role = AddRoleToDb(fixture); // Act var removeCommand = new Remove.Command { RoleId = role.Id }; await controller.Remove(removeCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyDeletedRole(role.Id)); }
public async Task SuccessfullEditSetsSuccessMessage(SliceFixture fixture) { // Arrange var controller = fixture.GetController <RoleController>(); var role = AddRoleToDb(fixture); // Act var editCommand = new Edit.Command { Name = "Edited name" }; await controller.Edit(editCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyEditedRole(editCommand.Name)); }
public async Task SuccessfullEditSetsSuccessMessage(SliceFixture fixture) { // Arrange var product = await AddProductToDatabase(fixture); var controller = fixture.GetController <ProductController>(); // Act var editCommand = new Edit.Command { Id = product.Id, Name = "Edited name" }; await controller.Edit(editCommand); controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyEditedProduct(editCommand.Name)); }
public void AddMessage(MessageType messageType, string message) { switch (messageType) { case MessageType.Information: InformationMessages.Add(message); break; case MessageType.Success: SuccessMessages.Add(message); break; case MessageType.Error: ErrorMessages.Add(message); break; case MessageType.Warning: WarningMessages.Add(message); break; } }
/// <summary> /// Saves the Appointment with the data into the database /// </summary> public void SaveAppointment() { IsInWeekAppointments.Clear(); DaysOfVisit = DateCalculator.getDays(LeavingDay, ArrivingDay); AppointmentModel.dogFromCustomer = SelectedDog; AppointmentModel.date_from = ArrivingDay; AppointmentModel.date_to = LeavingDay; AppointmentModel.isdailyguest = Convert.ToInt32(IsDailyGuest); AppointmentModel.days = DaysOfVisit; AppointmentModel.dogID = SelectedDog.Id; AppointmentModel.isActive = true; if (GlobalConfig.Connection.IsAppointmentInDataStore(AppointmentModel)) { ErrorMessages.AppointmentIsAlreadyInDatabaseError(AppointmentModel); } else if (GlobalConfig.Connection.IsDogInTimeSpanAlreadyInDataStore(AppointmentModel)) { ErrorMessages.DogIsInThisTimespanAlreadyInDatabaseError(AppointmentModel); } else { AppointmentModel = GlobalConfig.Connection.AddAppointmentToDataStore(AppointmentModel); SuccessMessages.AppointmentCreatedSuccess(); AvailableAppointments = new BindableCollection <AppointmentModel>(GlobalConfig.Connection.GetAppointments()); } foreach (AppointmentModel model in AvailableAppointments) { AppointmentsInCurrentWeek(model); } IsInWeekAppointments.OrderBy(x => x.date_from); ArrivingDay = DateTime.Today; LeavingDay = DateTime.Today; IsDailyGuest = false; DatePickerForWeek = DateTime.Parse(FirstDayOfWeek); }
public async Task SuccessfullCreationSetsSuccessMessage(SliceFixture fixture) { // Arrange var controller = fixture.GetController <ProductController>(); // Act var createCommand = new Create.Command() { Name = "Some product", Description = "Some description", Category = new Data.Models.Category() { Name = "Some category" }, Price = 120.00m }; await controller.Create(createCommand); // Assert controller.TempData .ShouldContainSuccessMessage(SuccessMessages.SuccessfullyCreatedProduct(createCommand.Name)); }
public ActionResult UploadPricingDetails(PricingList pricingList, HttpPostedFileBase FileUpload) { if (User.Identity.IsAuthenticated) { if (isAdminUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = null; if (FileUpload != null) { if (FileUpload.ContentType == "application/vnd.ms-excel" || FileUpload.ContentType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { string filename = FileUpload.FileName; string targetpath = Server.MapPath("~/Doc/"); FileUpload.SaveAs(targetpath + filename); string pathToExcelFile = targetpath + filename; var connectionString = ""; if (filename.EndsWith(".xls")) { connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", pathToExcelFile); } else if (filename.EndsWith(".xlsx")) { connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", pathToExcelFile); } var adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", connectionString); var ds = new DataSet(); adapter.Fill(ds, "ExcelTable"); DataTable dtable = ds.Tables["ExcelTable"]; string sheetName = "Sheet1"; var excelFile = new ExcelQueryFactory(pathToExcelFile); var pricingLists = from a in excelFile.Worksheet <PricingList>(sheetName) select a; StringBuilder ImportValues = new StringBuilder(); foreach (var a in pricingLists) { try { if (a.ProductId != "") { PricingList PL = new PricingList(); PL.ProductId = a.ProductId; PL.ProductName = a.ProductName; PL.BuyPrice = a.BuyPrice; PL.SellPrice = a.SellPrice; PL.Profit = a.Profit; PL.MRP = a.MRP; string value = "('" + Guid.NewGuid() + "','" + PL.ProductId + "','" + PL.ProductName + "','" + PL.BuyPrice + "','" + PL.SellPrice + "','" + PL.Profit + "','" + PL.MRP + "',1,getdate(),suser_sname(),null,null),"; ImportValues.Append(value); } } catch (DbEntityValidationException ex) { foreach (var entityValidationErrors in ex.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { ErrorMessages.Append("\nProperty: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage); } } } } //deleting excel file from folder if ((System.IO.File.Exists(pathToExcelFile))) { System.IO.File.Delete(pathToExcelFile); } string ImportData = ImportValues.ToString(); ImportData = ImportData.Substring(0, ImportData.Length - 1); PricingDetailsProxy.InsertBulkPricingDetails(ImportData); SuccessMessages = new StringBuilder(); SuccessMessages.Append(UploadConstants.UploadSuccessMessage); } else { ErrorMessages.Append(UploadConstants.InvalidFileFormat); } } else { ErrorMessages.Append(UploadConstants.FileNotFound); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { TempData[UploadConstants.UploadSuccess] = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { TempData[UploadConstants.UploadError] = ErrorMessages.ToString(); } return(RedirectToAction("Index", "ManagePricing")); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public IActionResult Create(Create.Command command) { this.mediator.Send(command); TempData.SetSuccessMessage(SuccessMessages.SuccessfullyCreatedRole(command.Name)); return(this.RedirectToActionJson("Roles", "Admin")); }