public string CreateExcelReport(string customer, EmployeeMenu[] choices) { Action<ITemplateDocument> processDocument = document => { document.Process(WeeklyMenus); document.Process(choices); document.Process(CalculateExcelSummaries(choices)); }; return CreateReport(processDocument, customer, choices, ".xlsx"); }
public string CreateWordReport(string customer, EmployeeMenu[] choices) { Action<ITemplateDocument> processDocument = document => { document.Process( choices .Select(it => new { Employee = it.Employee, Choices = new[] { it.MondayChoice, it.TuesdayChoice, it.ThursdayChoice, it.WednesdayChoice, it.FridayChoice } })); document.Process(CalculateWordSummaries(choices)); }; return CreateReport(processDocument, customer, choices, ".docx"); }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IEmployeeMenuRespository employeeMenuRespository, EmployeeMenu employeeMenu, string validatorType) { var employeeMenuValidator = new EmployeeMenuValidator(employeeMenuRespository); var validatorReresult = await employeeMenuValidator.DoValidateAsync(employeeMenu, validatorType); if (!validatorReresult.IsValid) { throw new DomainException(validatorReresult); } }
public static void EmployeeMenu(BankService bankService, AccountService accountService) { Console.Write(Constant.EmployeeMenu); EmployeeMenu option = (EmployeeMenu)Helper.GetValidInteger(); switch (option) { case Models.EmployeeMenu.AddAccount: bankService.CreateAccount(UserInput.GetAccountDetails()); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.RemoveAccount: Console.Write(Constant.AccountNumber); string accountId = Helper.GetValidString(); Account account = bankService.GetAccount(accountId); if (account == null) { Console.WriteLine(Constant.UserNotFound); } else { Console.Write(Constant.DeleteConfirmation); if (UserInput.Confirmation() == ConfirmationOption.Yes) { bankService.RemoveAccount(accountId); Console.WriteLine(Constant.RemoveAccount); } } Console.ReadKey(); Console.ReadKey(); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.UpdateAccount: Console.Write(Constant.AccountNumber); accountId = Helper.GetValidString(); account = bankService.GetAccount(accountId); if (account == null) { Console.WriteLine(Constant.UserNotFound); } else { bankService.UpdateAccount(UserInput.GetAccountDetails(), accountId); Console.WriteLine(Constant.UpdateAccount); } Console.ReadKey(); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.Transaction: TransactionMenu(bankService, accountService); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.CurrencyExchange: Console.Write(Constant.TransactionAmount); double amount = Helper.GetValidDouble(); Console.Write(Constant.CurrencyRate); float currencyRate = Helper.GetValidFloat(); Console.Write(amount * currencyRate + Constant.PayableAmount); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.SignOut: break; case Models.EmployeeMenu.Exit: Environment.Exit(0); break; default: EmployeeMenu(bankService, accountService); break; } }
private static IEnumerable CalculateExcelSummaries(EmployeeMenu[] choices) { return (from ChoiceEnum option in Enum.GetValues(typeof(ChoiceEnum)) select new { SummaryMark = option, MondaySummary = choices.Where(it => it.MondayChoice == option).Count(), TuesdaySummary = choices.Where(it => it.TuesdayChoice == option).Count(), WednesdaySummary = choices.Where(it => it.WednesdayChoice == option).Count(), ThursdaySummary = choices.Where(it => it.ThursdayChoice == option).Count(), FridaySummary = choices.Where(it => it.FridayChoice == option).Count() }).ToList(); }
public string CreateCSVReport(string customer, EmployeeMenu[] choices) { Action<ITemplateDocument> processDocument = document => document.Process(CalculateExcelSummaries(choices)); return CreateReport(processDocument, customer, choices, ".csv"); }
private static string CreateReport( Action<ITemplateDocument> customProcessing, string customer, EmployeeMenu[] choices, string ext) { var newFile = GetPath("Documents\\Order-" + Path.GetRandomFileName() + ext); File.Copy(GetPath("App_Data\\Order" + ext), newFile, true); using (var document = DocumentFactory.Open(newFile)) { customProcessing(document); // The order of processing tags does not need to match their position in the template var nextMonday = GetFirstDayOfNextWeek(DateTime.Today); document.Process( new { CustomerName = customer, SubmissionDate = DateTime.Today, FirstDate = nextMonday, LastDate = nextMonday.AddDays(4) }); } return newFile.Substring(AppDomain.CurrentDomain.BaseDirectory.Length); }
private static IEnumerable CalculateWordSummaries(EmployeeMenu[] choices) { var fromDay = GetFirstDayOfNextWeek(DateTime.Today); return (from cnt in Enumerable.Range(0, 5) let day = fromDay.AddDays(cnt) select new { Day = day.DayOfWeek, Menu = from menu in WeeklyMenus select new { Name = menu.GetType().GetProperty(day.DayOfWeek + "Menu").GetValue(menu, null), TotalOrders = choices.Where(it => it.GetType().GetProperty(day.DayOfWeek + "Choice") .GetValue(it, null).Equals(menu.MenuMark)) .Count() } }).ToList(); }
public JsonNetResult PostOwnMenu(EmployeeMenu employeeMenu) { return(PostEmployeeMenu(DetectUser(), employeeMenu)); }
public UpdateEmployeeMenuCommand(EmployeeMenu employeeMenu) { EmployeeMenu = employeeMenu; }
private void InitMenu() { IList <EmployeeMenu> list = new List <EmployeeMenu>(); list.Add(new EmployeeMenu() { Code = "001", Name = "系统资料", Sort = 9999 }); list.Add(new EmployeeMenu() { Code = "001001", Name = "基础设置", Sort = 9999 }); list.Add(new EmployeeMenu() { Code = "001001001", Name = "员工资料", Controller = "Employee", Action = "Index,Create,Query", Url = "/Employee/Index", Sort = 1 }); list.Add(new EmployeeMenu() { Code = "001001002", Name = "角色配置", Controller = "EmployeeRole", Action = "Index,Create,Query", Url = "/EmployeeRole/Index", Sort = 2 }); list.Add(new EmployeeMenu() { Code = "001001003", Name = "部门配置", Controller = "EmployeeDepartment", Action = "Index,Create,Query", Url = "/EmployeeDepartment/Index", Sort = 3 }); list.Add(new EmployeeMenu() { Code = "001001004", Name = "收银宝参数配置", Controller = "Preferences", Action = "Index,Create,Query", Url = "/Preferences/Create", Sort = 4 }); list.Add(new EmployeeMenu() { Code = "001001005", Name = "通联通参数配置", Controller = "TLTPreferences", Action = "Index,Create,Query", Url = "/TLTPreferences/Create", Sort = 5 }); //list.Add(new EmployeeMenu() { Code = "001001005", Name = "收款类型", Controller = "ProceedsType", Action = "Index,Create,Query", Url = "/ProceedsType/Index", Sort = 4 }); list.Add(new EmployeeMenu() { Code = "001002", Name = "订单管理", Sort = 1 }); list.Add(new EmployeeMenu() { Code = "001002001", Name = "认缴订单", Controller = "OrderPaid", Action = "Index,Create,Query", Url = "/OrderPaid/Index", Sort = 1 }); list.Add(new EmployeeMenu() { Code = "001002002", Name = "预约订单", Controller = "OrderBooking", Action = "Index,Create,Query", Url = "/OrderBooking/Index", Sort = 2 }); // list.Add(new EmployeeMenu() { Code = "001002003", Name = "房款订单", Controller = "OrderHousePayment", Action = "Index,Create,Query", Url = "/OrderHousePayment/Index", Sort = 3 }); list.Add(new EmployeeMenu() { Code = "001003", Name = "项目管理", Sort = 2 }); list.Add(new EmployeeMenu() { Code = "001003001", Name = "项目管理", Controller = "ProjectManagement", Action = "Index,Create,Query", Url = "/ProjectManagement/Index", Sort = 1 }); list.Add(new EmployeeMenu() { Code = "001003002", Name = "户型展示", Controller = "HouseTypeShow", Action = "Index,Create,Query", Url = "/HouseTypeShow/Index", Sort = 2 }); list.Add(new EmployeeMenu() { Code = "001004", Name = "会员管理", Sort = 3 }); list.Add(new EmployeeMenu() { Code = "001004001", Name = "查看会员", Controller = "MemberManagement", Action = "Index,Create,Query", Url = "/MemberManagement/Index", Sort = 1 }); foreach (var m in list) { EmployeeMenu menu = iEmployeeMenuService.Get(t => t.Code == m.Code) ?? new EmployeeMenu(); menu.Code = m.Code; menu.ParentCode = !string.IsNullOrWhiteSpace(m.Code.Substring(0, m.Code.Length - 3)) ? m.Code.Substring(0, m.Code.Length - 3) : null; menu.Name = m.Name; menu.Url = m.Url; menu.Sort = m.Sort; menu.Controller = m.Controller; menu.Action = m.Action; menu.Status = 1; iEmployeeMenuService.Save(menu); } }