public ActionResult Create(NewOrderView order) { if (ModelState.IsValid) { var response = MovementsHelper.NewOrder(order, User.Identity.Name); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, response.Message); } var adminUser = WebConfigurationManager.AppSettings["AdminUser"]; if (adminUser == User.Identity.Name) { ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(), "CustomerId", "UserName", order.CustomerId); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(order.CompanyId), "ProjectId", "Name", order.ProjectId); ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "CompanyId", "Name", order.CompanyId); } else { var user = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "UserName", order.CustomerId); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(user.CompanyId), "ProjectId", "Name", order.ProjectId); } order.Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(); return(View(order)); }
public ActionResult Create() { var adminUser = WebConfigurationManager.AppSettings["AdminUser"]; if (adminUser == User.Identity.Name) { ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(), "CustomerId", "FullName"); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(0), "ProjectId", "Name"); ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "CompanyId", "Name"); var adminView = new NewOrderView { Date = DateTime.Now, Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(), }; return(View(adminView)); } //verifica el usuario logeado y envia su compania a la vista var user = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name); if (user == null) { return(RedirectToAction("Index", "Home")); } ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(), "CustomerId", "FullName"); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(user.CompanyId), "ProjectId", "Name"); var view = new NewOrderView { CompanyId = user.CompanyId, Date = DateTime.Now, Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(), }; return(View(view)); }
public ActionResult Edit(Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; var responseSave = DBHelper.SaveChanges(db); if (responseSave.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, responseSave.Message); } var adminUser = WebConfigurationManager.AppSettings["AdminUser"]; if (adminUser == User.Identity.Name) { ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(order.CompanyId), "CustomerId", "UserName", order.CustomerId); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(order.CompanyId), "ProjectId", "Name", order.ProjectId); ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "ProjectId", "Name", order.CompanyId); } else { var user = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "UserName", order.CustomerId); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(user.CompanyId), "ProjectId", "Name", order.ProjectId); } return(View(order)); }
public ActionResult Create(int?id) { //var details = db.Orders.Where(odt => odt.UserName == userName).ToList; Order orders = db.Orders.Find(id); DisbursedLoan views = new DisbursedLoan() { //UserName = User.Identity.Name, CompanyId = orders.CompanyId, CustomerId = orders.CustomerId, WarehouseId = orders.WarehouseId, OrderId = orders.OrderId, StateId = DBHelper.GetState("Disbursed", db), TypeLoanId = DBHelper.GetTypeLoan("Renewed", db), LoanStateId = DBHelper.GetLoanState("Common", db), StartDate = orders.StartDate, EndDate = orders.EndDate, Period = orders.Period, UserName = User.Identity.Name, Remarks = orders.Remarks, BorrowedCapital = orders.BorrowedCapital, Interest = orders.Interest, Total = orders.Total, Balance = orders.Balance, DailyPayment = orders.DailyPayment, OperatingExpenses = orders.OperatingExpenses, }; var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "CompanyId", "Name", orders.CompanyId); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", orders.CustomerId); return(View(views)); }
// GET: Orders/Create public ActionResult Create() { var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName"); var view = new NewOrderView { Date = DateTime.Now, Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(), }; return(View(view)); }
public ActionResult Edit(Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var user = db.Users.Where(c => c.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", order.CustomerId); return(View(order)); }
public async Task <ActionResult> Create(Order order) { if (ModelState.IsValid) { db.Orders.Add(order); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "UserName", order.CustomerId); ViewBag.WarehouseId = new SelectList(db.Warehouses, "WarehouseId", "Name", order.WarehouseId); return(PartialView(order)); }
// GET: Orders/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var order = db.Orders.Find(id); if (order == null) { return(HttpNotFound()); } var user = db.Users.Where(c => c.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", order.CustomerId); return(View(order)); }
public ActionResult Create(DisbursedLoan view) { if (ModelState.IsValid) { var response = MovementsHelper.NewLoan(view, User.Identity.Name); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, response.Message); } ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "CompanyId", "Name", view.CompanyId); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(view.CompanyId), "CustomerId", "FullName", view.CustomerId); return(View(view)); }
public ActionResult Create(NewOrderView view) { if (ModelState.IsValid) { var response = MovementsHelper.NewOrder(view, User.Identity.Name); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, response.Message); } var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName"); view.Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(); return(View(view)); }
// GET: Sales/Create public ActionResult Create() { var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); NewSaleView view = (NewSaleView)TempData["model"]; if (view == null) { view = new NewSaleView { Date = DateTime.Now, Details = db.SaleDetailTmps.Where(sdt => sdt.UserName == User.Identity.Name).ToList(), }; } ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", view.CustomerId); ViewBag.WarehouseId = new SelectList(CombosHelper.GetWarehouses(user.CompanyId), "WarehouseId", "Name", view.WarehouseId); return(View(view)); }
public ActionResult Edit(Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; var response = DBHelper.SaveChanges(db); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, response.Message); } var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", order.CustomerId); return(View(order)); }
public ActionResult Create(NewOrderView view) { if (ModelState.IsValid) { Response response = MovementsHelper.NewOrder(view, User.Identity.Name); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, response.Message); } var user = db.Users.Where(c => c.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", view.CustomerId); //ViewBag.StateId = new SelectList(db.States, "StateId", "Description", order.StateId); return(View(view)); }
// GET: Sales/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sale sale = db.Sales.Find(id); if (sale == null) { return(HttpNotFound()); } var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName", sale.CustomerId); ViewBag.WarehouseId = new SelectList(CombosHelper.GetWarehouses(user.CompanyId), "WarehouseId", "Name", sale.WarehouseId); return(View(sale)); }
// GET: Orders/Create public ActionResult Create() { var user = db.Users.Where(c => c.UserName == User.Identity.Name).FirstOrDefault(); if (user == null) { return(RedirectToAction("Index", "Home")); } ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName"); //ViewBag.StateId = new SelectList(db.States, "StateId", "Description"); var view = new NewOrderView { Date = DateTime.Now, Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(), }; view.Details = db.OrderDetailTmps.Where(odt => odt.UserName == User.Identity.Name).ToList(); return(View(view)); }
// GET: Orders/Create public ActionResult Create() { var user = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); var warehouse = db.Warehouses.Where(w => w.UserId == user.UserId).FirstOrDefault(); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "FullName"); ViewBag.WarehouseId = new SelectList(db.Warehouses.Where(w => w.User.UserId == user.UserId), "WarehouseId", "Name"); //var wareHouse = db.Warehouses.Where(w => w.User.UserId == user.UserId); var view = new Order() { UserName = User.Identity.Name, StateId = DBHelper.GetState("Created", db), StartDate = DateTime.Now, Period = 30, EndDate = DateTime.Now.AddDays(30), CompanyId = user.CompanyId, WarehouseId = warehouse.WarehouseId, }; return(PartialView(view)); }
public ActionResult Create() { AddDetails(); var adminUser = WebConfigurationManager.AppSettings["AdminUser"]; if (adminUser == User.Identity.Name) { ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(), "CustomerId", "FullName"); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(0), "ProjectId", "Name"); ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "CompanyId", "Name"); var adminView = new NewBudgetView { Date = DateTime.Now, DetailsSc01 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC01").ToList(), DetailsSc02 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC02").ToList(), DetailsSc03 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC03").ToList(), DetailsSc04 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC04").ToList(), DetailsSc05 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC05").ToList(), DetailsSc06 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC06").ToList(), DetailsSc07 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC07").ToList(), DetailsSc08 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC08").ToList(), DetailsSc09 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC09").ToList(), DetailsSc10 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC10").ToList(), DetailsSc11 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC11").ToList(), DetailsSc12 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC12").ToList(), DetailsSc13 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC13").ToList(), DetailsSc14 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC14").ToList(), DetailsSc15 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC15").ToList(), DetailsSc16 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC16").ToList(), DetailsSc17 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC17").ToList(), DetailsSc18 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC18").ToList(), DetailsSc19 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC19").ToList(), DetailsSc20 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC20").ToList(), DetailsSc21 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC21").ToList(), DetailsSc22 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC22").ToList(), DetailsSc23 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC23").ToList(), DetailsSc24 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC24").ToList(), DetailsSc25 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC25").ToList(), DetailsSc26 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC26").ToList(), DetailsSc27 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC27").ToList(), DetailsSc28 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC28").ToList(), DetailsSc29 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC29").ToList(), DetailsSc30 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC30").ToList(), DetailsSc31 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC31").ToList(), DetailsSc32 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC32").ToList(), DetailsSc33 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC33").ToList(), DetailsSc34 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC34").ToList(), DetailsSc35 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC35").ToList(), DetailsSc36 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC36").ToList(), DetailsSc37 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC37").ToList(), DetailsSc38 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC38").ToList(), DetailsSc39 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC39").ToList(), DetailsSc40 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC40").ToList(), DetailsSc41 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC41").ToList(), DetailsSc42 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC42").ToList(), DetailsSc43 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC43").ToList(), DetailsSc44 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC44").ToList(), DetailsSc45 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC45").ToList(), DetailsSc46 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC46").ToList(), DetailsSc47 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC47").ToList(), DetailsSc48 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC48").ToList(), DetailsSc49 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC49").ToList(), DetailsSc50 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC50").ToList(), DetailsSc51 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC51").ToList(), DetailsSc52 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC52").ToList(), DetailsSc53 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC53").ToList(), DetailsSc54 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC54").ToList(), }; return(View(adminView)); } //verifica el usuario logeado y envia su compania a la vista var user = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name); if (user == null) { return(RedirectToAction("Index", "Home")); } ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(), "CustomerId", "FullName"); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(user.CompanyId), "ProjectId", "Name"); var view = new NewBudgetView { CompanyId = user.CompanyId, Date = DateTime.Now, DetailsSc01 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC01").ToList(), DetailsSc02 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC02").ToList(), DetailsSc03 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC03").ToList(), DetailsSc04 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC04").ToList(), DetailsSc05 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC05").ToList(), DetailsSc06 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC06").ToList(), DetailsSc07 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC07").ToList(), DetailsSc08 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC08").ToList(), DetailsSc09 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC09").ToList(), DetailsSc10 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC10").ToList(), DetailsSc11 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC11").ToList(), DetailsSc12 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC12").ToList(), DetailsSc13 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC13").ToList(), DetailsSc14 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC14").ToList(), DetailsSc15 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC15").ToList(), DetailsSc16 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC16").ToList(), DetailsSc17 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC17").ToList(), DetailsSc18 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC18").ToList(), DetailsSc19 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC19").ToList(), DetailsSc20 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC20").ToList(), DetailsSc21 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC21").ToList(), DetailsSc22 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC22").ToList(), DetailsSc23 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC23").ToList(), DetailsSc24 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC24").ToList(), DetailsSc25 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC25").ToList(), DetailsSc26 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC26").ToList(), DetailsSc27 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC27").ToList(), DetailsSc28 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC28").ToList(), DetailsSc29 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC29").ToList(), DetailsSc30 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC30").ToList(), DetailsSc31 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC31").ToList(), DetailsSc32 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC32").ToList(), DetailsSc33 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC33").ToList(), DetailsSc34 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC34").ToList(), DetailsSc35 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC35").ToList(), DetailsSc36 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC36").ToList(), DetailsSc37 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC37").ToList(), DetailsSc38 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC38").ToList(), DetailsSc39 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC39").ToList(), DetailsSc40 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC40").ToList(), DetailsSc41 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC41").ToList(), DetailsSc42 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC42").ToList(), DetailsSc43 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC43").ToList(), DetailsSc44 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC44").ToList(), DetailsSc45 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC45").ToList(), DetailsSc46 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC46").ToList(), DetailsSc47 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC47").ToList(), DetailsSc48 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC48").ToList(), DetailsSc49 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC49").ToList(), DetailsSc50 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC50").ToList(), DetailsSc51 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC51").ToList(), DetailsSc52 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC52").ToList(), DetailsSc53 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC53").ToList(), DetailsSc54 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC54").ToList(), }; return(View(view)); }
public ActionResult Create(NewBudgetView budget) { if (ModelState.IsValid) { var response = MovementsHelper.NewBudget(budget, User.Identity.Name); if (response.Succeeded) { return(RedirectToAction("Index")); } ModelState.AddModelError(string.Empty, response.Message); } var adminUser = WebConfigurationManager.AppSettings["AdminUser"]; if (adminUser == User.Identity.Name) { ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(), "CustomerId", "UserName", budget.CustomerId); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(budget.CompanyId), "ProjectId", "Name", budget.ProjectId); ViewBag.CompanyId = new SelectList(CombosHelper.GetCompanies(), "CompanyId", "Name", budget.CompanyId); } else { var user = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name); ViewBag.CustomerId = new SelectList(CombosHelper.GetCustomers(user.CompanyId), "CustomerId", "UserName", budget.CustomerId); ViewBag.ProjectId = new SelectList(CombosHelper.GetProjects(user.CompanyId), "ProjectId", "Name", budget.ProjectId); } budget.DetailsSc01 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC01").ToList(); budget.DetailsSc02 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC02").ToList(); budget.DetailsSc03 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC03").ToList(); budget.DetailsSc04 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC04").ToList(); budget.DetailsSc05 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC05").ToList(); budget.DetailsSc06 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC06").ToList(); budget.DetailsSc07 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC07").ToList(); budget.DetailsSc08 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC08").ToList(); budget.DetailsSc09 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC09").ToList(); budget.DetailsSc10 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC10").ToList(); budget.DetailsSc11 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC11").ToList(); budget.DetailsSc12 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC12").ToList(); budget.DetailsSc13 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC13").ToList(); budget.DetailsSc14 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC14").ToList(); budget.DetailsSc15 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC15").ToList(); budget.DetailsSc16 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC16").ToList(); budget.DetailsSc17 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC17").ToList(); budget.DetailsSc18 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC18").ToList(); budget.DetailsSc19 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC19").ToList(); budget.DetailsSc20 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC20").ToList(); budget.DetailsSc21 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC21").ToList(); budget.DetailsSc22 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC22").ToList(); budget.DetailsSc23 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC23").ToList(); budget.DetailsSc24 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC24").ToList(); budget.DetailsSc25 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC25").ToList(); budget.DetailsSc26 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC26").ToList(); budget.DetailsSc27 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC27").ToList(); budget.DetailsSc28 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC28").ToList(); budget.DetailsSc29 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC29").ToList(); budget.DetailsSc30 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC30").ToList(); budget.DetailsSc31 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC31").ToList(); budget.DetailsSc32 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC32").ToList(); budget.DetailsSc33 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC33").ToList(); budget.DetailsSc34 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC34").ToList(); budget.DetailsSc35 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC35").ToList(); budget.DetailsSc36 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC36").ToList(); budget.DetailsSc37 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC37").ToList(); budget.DetailsSc38 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC38").ToList(); budget.DetailsSc39 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC39").ToList(); budget.DetailsSc40 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC40").ToList(); budget.DetailsSc41 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC41").ToList(); budget.DetailsSc42 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC42").ToList(); budget.DetailsSc43 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC43").ToList(); budget.DetailsSc44 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC44").ToList(); budget.DetailsSc45 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC45").ToList(); budget.DetailsSc46 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC46").ToList(); budget.DetailsSc47 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC47").ToList(); budget.DetailsSc48 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC48").ToList(); budget.DetailsSc49 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC49").ToList(); budget.DetailsSc50 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC50").ToList(); budget.DetailsSc51 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC51").ToList(); budget.DetailsSc52 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC52").ToList(); budget.DetailsSc53 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC53").ToList(); budget.DetailsSc54 = db.BudgetDetailTmps.Where(odt => odt.UserName == User.Identity.Name && odt.SubcategoryCode == "SC54").ToList(); return(View(budget)); }