public ActionResult UpdateProductType(string orderId, string productId, string type) { var orderProduct = db.OrderProducts.Where(p => p.ProductId == productId && p.OrderId == orderId).FirstOrDefault(); if (orderProduct == null) { return(Json(new { id = 0 }, JsonRequestBehavior.AllowGet)); } orderProduct.ProductType = type; db.Entry(orderProduct).State = EntityState.Modified; db.SaveChanges(); string typeName = "Chưa xác định"; if (type == "warehouse") { typeName = "Hàng gửi kho"; } else if (type == "new") { typeName = "Hàng xuất mới"; } var staff = orderProduct.HaiOrder.OrderStaffs.Where(p => p.ProcessId == "create").FirstOrDefault(); if (staff != null) { Utitl.Send("Đơn hàng " + orderProduct.HaiOrder.Code, "Đã thay đổi loại hàng: " + typeName, staff.HaiStaff.UserLogin, db, mongoHelp); } return(Json(new { id = 1 }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddProduct(ProductInfo product, string IsBox, HttpPostedFileBase Thumbnail) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageProduct", 1)) { return(RedirectToAction("relogin", "home")); } product.Id = Guid.NewGuid().ToString(); if (product.PCode != null && product.PCode.Trim() != "") { var checkDb = db.ProductInfoes.Where(p => p.PCode == product.PCode).FirstOrDefault(); if (checkDb != null) { return(RedirectToAction("manage", "product")); } } if (IsBox != null) { product.IsBox = 1; } else { product.IsBox = 0; } return(RedirectToAction("manage", "product")); }
public ActionResult ChooseEvent(string DateFrom = null, string DateTo = null, string search = "", int?page = 1) { if (!Utitl.CheckUser(db, User.Identity.Name, "AgencyReport", 0)) { return(RedirectToAction("relogin", "home")); } int pageSize = 10; int pageNumber = (page ?? 1); DateTime dFrom = DateTime.Now.Date; DateTime dTo = DateTime.Now.Date; if (DateFrom != null) { dFrom = DateTime.ParseExact(DateFrom, "dd/MM/yyyy", null); dTo = DateTime.ParseExact(DateTo, "dd/MM/yyyy", null); } ViewBag.DateFrom = dFrom; ViewBag.DateTo = dTo; ViewBag.SearchText = search; var allEvent = (from log in db.EventInfoes where DbFunctions.TruncateTime(log.BeginTime) >= DbFunctions.TruncateTime(dFrom) && DbFunctions.TruncateTime(log.BeginTime) <= DbFunctions.TruncateTime(dTo) && log.Name.Contains(search) select log).OrderByDescending(p => p.EndTime).ToPagedList(pageNumber, pageSize); return(View(allEvent)); }
public ActionResult RemainProductDetail(int?page, string DateTo, string DateFrom) { if (!Utitl.CheckUser(db, User.Identity.Name, "RemainProductDetail", 0)) { return(RedirectToAction("relogin", "home")); } int pageSize = 10; int pageNumber = (page ?? 1); DateTime dFrom = DateTime.Now.Date; DateTime dTo = DateTime.Now.Date; string strDateFrom; string strDateTo; if (!String.IsNullOrEmpty(DateTo) && !String.IsNullOrEmpty(DateTo)) { dFrom = DateTime.ParseExact(DateFrom, "dd/MM/yyyy", null); dTo = DateTime.ParseExact(DateTo, "dd/MM/yyyy", null); } strDateFrom = dFrom.ToString("yyyy-MM-dd"); strDateTo = dTo.ToString("yyyy-MM-dd"); ViewBag.DateFrom = dFrom; ViewBag.DateTo = dTo; var listRemain = db.report_cii_product(strDateFrom, strDateTo).ToList(); return(View(listRemain.OrderBy(p => p.ctime).ToPagedList(pageNumber, pageSize))); }
public ActionResult ModifyBranch(HaiBranch branch) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var branchCheck = db.HaiBranches.Find(branch.Id); if (branchCheck == null) { return(RedirectToAction("error", "home")); } branchCheck.Name = branch.Name; branchCheck.Code = branch.Code; branchCheck.AreaId = branch.AreaId; branchCheck.AddressInfo = branch.AddressInfo; branchCheck.Notes = branch.Notes; db.Entry(branchCheck).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("modifybranch")); }
// quản lý chi nhánh public ActionResult CreateBrand(int?page, string areaId, string search, int?tab) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 0)) { return(RedirectToAction("relogin", "home")); } int pageSize = 30; int pageNumber = (page ?? 1); ViewBag.AllArea = db.HaiAreas.ToList(); ViewBag.AreaId = areaId; if (search == null) { search = ""; } ViewBag.SearchText = search; if (areaId == null) { areaId = "-1"; } if (tab == null) { tab = 0; // tab 0 } ViewBag.Tab = tab; if (areaId == "-1") { return(View(db.HaiBranches.Where(p => p.Name.Contains(search) || p.Code.Contains(search)).OrderByDescending(p => p.AreaId).ToPagedList(pageNumber, pageSize))); } return(View(db.HaiBranches.Where(p => p.AreaId == areaId && (p.Name.Contains(search) || p.Code.Contains(search))).OrderByDescending(p => p.Name).ToPagedList(pageNumber, pageSize))); }
public ActionResult ExportAgencyReport(string Ctype, string EventId) { if (!Utitl.CheckUser(db, User.Identity.Name, "AgencyReport", 0)) { return(RedirectToAction("relogin", "home")); } string pathRoot = Server.MapPath("~/haiupload/agencyreport.xlsx"); string name = "report" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".xlsx"; string pathTo = Server.MapPath("~/temp/" + name); System.IO.File.Copy(pathRoot, pathTo); try { FileInfo newFile = new FileInfo(pathTo); var data = db.report_event_agency(Ctype, EventId).ToList(); using (ExcelPackage package = new ExcelPackage(newFile)) { ExcelWorksheet worksheet = package.Workbook.Worksheets["DSNT"]; for (int i = 0; i < data.Count; i++) { try { worksheet.Cells[i + 2, 1].Value = i + 1; worksheet.Cells[i + 2, 2].Value = data[i].CCode; worksheet.Cells[i + 2, 3].Value = data[i].CName; worksheet.Cells[i + 2, 4].Value = data[i].CDeputy; worksheet.Cells[i + 2, 5].Value = data[i].IdentityCard; worksheet.Cells[i + 2, 7].Value = data[i].DistrictName; worksheet.Cells[i + 2, 8].Value = data[i].ProvinceName; worksheet.Cells[i + 2, 9].Value = data[i].BranchCode; worksheet.Cells[i + 2, 10].Value = data[i].Phone; worksheet.Cells[i + 2, 11].Value = data[i].PName; worksheet.Cells[i + 2, 12].Value = data[i].quantity; worksheet.Cells[i + 2, 13].Value = data[i].Point; worksheet.Cells[i + 2, 14].Value = data[i].AllPoint; } catch { return(RedirectToAction("error", "home")); } } package.Save(); } } catch { return(RedirectToAction("error", "home")); } return(File(pathTo, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", string.Format("report-khuyen-mai-" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".{0}", "xlsx"))); }
public ActionResult ProductSeri(string productId, int Quantity, string DateFrom, string DateTo, int SeriType) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageProduct", 1)) { return(RedirectToAction("relogin", "home")); } var checkProduct = db.ProductInfoes.Find(productId); if (checkProduct == null) { return(RedirectToAction("error", "home")); } if (SeriType == 1 || SeriType == 2) { // 1: dai ly -- 2 : nong dan var maxSeri = db.ProductSeris.Max(p => p.Seri); if (maxSeri == null || maxSeri == 0) { maxSeri = 1000000; } DateTime dFrom = DateTime.ParseExact(DateFrom, "dd/MM/yyyy", null); DateTime dTo = DateTime.ParseExact(DateTo, "dd/MM/yyyy", null); while (Quantity > 0) { var generalCode = RandomCod(); var pSeri = new ProductSeri() { Id = Guid.NewGuid().ToString(), BeginTime = dFrom, ExpireTime = dTo, IsUse = 0, Seri = maxSeri + Quantity, Code = generalCode, ProductId = productId, SeriType = SeriType }; db.ProductSeris.Add(pSeri); db.SaveChanges(); Quantity--; } } return(RedirectToAction("productseri", "product")); }
public ActionResult ExcelRemainProductDetail(string DateTo, string DateFrom) { if (!Utitl.CheckUser(db, User.Identity.Name, "RemainProductDetail", 0)) { return(RedirectToAction("relogin", "home")); } var data = db.report_cii_product(DateFrom, DateTo).ToList(); string pathRoot = Server.MapPath("~/haiupload/barcodereportdeatail.xlsx"); string name = "report" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".xlsx"; string pathTo = Server.MapPath("~/temp/" + name); System.IO.File.Copy(pathRoot, pathTo); try { FileInfo newFile = new FileInfo(pathTo); using (ExcelPackage package = new ExcelPackage(newFile)) { ExcelWorksheet worksheet = package.Workbook.Worksheets[1]; for (int i = 0; i < data.Count; i++) { try { worksheet.Cells[i + 2, 1].Value = data[i].CaseCode; worksheet.Cells[i + 2, 2].Value = data[i].branchExport; worksheet.Cells[i + 2, 3].Value = data[i].C1; worksheet.Cells[i + 2, 4].Value = data[i].WareHouse; worksheet.Cells[i + 2, 5].Value = data[i].WareHouseName; worksheet.Cells[i + 2, 6].Value = data[i].branch; worksheet.Cells[i + 2, 8].Value = data[i].Staff; worksheet.Cells[i + 2, 10].Value = data[i].PName; worksheet.Cells[i + 2, 11].Value = data[i].Quantity; worksheet.Cells[i + 2, 12].Value = data[i].BoxPoint; worksheet.Cells[i + 2, 13].Value = data[i].ctime; worksheet.Cells[i + 2, 14].Value = data[i].staffhelp; } catch { return(RedirectToAction("error", "home")); } } package.Save(); } } catch { return(RedirectToAction("error", "home")); } return(File(pathTo, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", string.Format("report-ton-kho-" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".{0}", "xlsx"))); }
public ActionResult CreateStaff(int?page, int?func, string branchId, string areaId, string departmentId, string posId, string search) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 0)) { return(RedirectToAction("relogin", "home")); } int pageSize = 10; int pageNumber = (page ?? 1); ViewBag.FuncShow = prepareFuncShowStaff(); if (func == null) { func = 0; } ViewBag.AllBranch = db.HaiBranches.ToList(); ViewBag.AllArea = db.HaiAreas.ToList(); ViewBag.AllDepartment = db.HaiDepartments.ToList(); ViewBag.AllPosition = db.HaiPositions.ToList(); ViewBag.FuncId = func; ViewBag.SearchText = search; ViewBag.AreaId = areaId; ViewBag.BranchId = branchId; ViewBag.DepartmentId = departmentId; ViewBag.PosId = posId; // ViewBag.MaxId = generalCode(); switch (func) { case 0: return(View(db.HaiStaffs.Where(p => p.IsLock != 1).OrderByDescending(p => p.DepartmentId).ToPagedList(pageNumber, pageSize))); case 1: return(View(db.HaiStaffs.Where(p => p.HaiBranch.AreaId == areaId && p.IsLock != 1).OrderByDescending(p => p.CreateDate).ToPagedList(pageNumber, pageSize))); case 2: return(View(db.HaiStaffs.Where(p => p.BranchId == branchId && p.IsLock != 1).OrderByDescending(p => p.CreateDate).ToPagedList(pageNumber, pageSize))); case 3: return(View(db.HaiStaffs.Where(p => p.DepartmentId == departmentId && p.IsLock != 1).OrderByDescending(p => p.CreateDate).ToPagedList(pageNumber, pageSize))); case 4: return(View(db.HaiStaffs.Where(p => p.PositionId == posId && p.IsLock != 1).OrderByDescending(p => p.CreateDate).ToPagedList(pageNumber, pageSize))); case 5: return(View(db.HaiStaffs.Where(p => p.Code.Contains(search) || p.FullName.Contains(search)).OrderByDescending(p => p.CreateDate).ToPagedList(pageNumber, pageSize))); } return(View(db.HaiStaffs.OrderByDescending(p => p.DepartmentId).ToPagedList(pageNumber, pageSize))); }
public ActionResult CreatePosition(HaiPosition position) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } db.HaiPositions.Add(position); db.SaveChanges(); return(RedirectToAction("CreatePosition", "haistaff")); }
public ActionResult CreateDepartment(HaiDepartment department) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } db.HaiDepartments.Add(department); db.SaveChanges(); return(RedirectToAction("CreateDepartment", "haistaff")); }
public ActionResult CreateArea(HaiArea area) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } db.HaiAreas.Add(area); db.SaveChanges(); return(RedirectToAction("createbrand", "haistaff", new { search = "", tab = 3 })); }
public ActionResult CreateBrand(HaiBranch branch) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } db.HaiBranches.Add(branch); db.SaveChanges(); return(RedirectToAction("createbrand", "haistaff")); }
public ActionResult ReportCheckIn() { if (!Utitl.CheckUser(db, User.Identity.Name, "CheckIn", 1)) { return(RedirectToAction("relogin", "home")); } ViewBag.Month = DateTime.Now.Month; ViewBag.Year = DateTime.Now.Year; ViewBag.Day = DateTime.Now.Day; return(View()); }
// GET: Order public ActionResult Show(int?page, string OrderCode = "", string DateFrom = "", string DateTo = "", string StaffCode = "", string ProcessId = "process", string StatusId = "", string SalePlace = "", string C1Code = "") { int permit = Utitl.CheckRoleShowInfo(db, User.Identity.Name); int pageSize = 30; int pageNumber = (page ?? 1); var current = DateTime.Now; DateTime dFrom; DateTime dTo; if (String.IsNullOrEmpty(DateFrom) || String.IsNullOrEmpty(DateTo)) { dTo = current; dFrom = current.AddMonths(-1); } else { dFrom = DateTime.ParseExact(DateFrom, "d/M/yyyy", null); dTo = DateTime.ParseExact(DateTo, "d/MM/yyyy", null); } ViewBag.DateFrom = dFrom.ToString("dd/MM/yyyy"); ViewBag.DateTo = dTo.ToString("dd/MM/yyyy"); ViewBag.StaffCode = StaffCode; ViewBag.ProcessId = ProcessId; ViewBag.StatusId = StatusId; ViewBag.SalePlace = SalePlace; ViewBag.C1Code = C1Code; List <get_list_orders_Result> data = new List <get_list_orders_Result>(); if (!String.IsNullOrEmpty(OrderCode)) { data = db.get_list_orders_by_code("%" + OrderCode + "%").ToList(); } else { data = db.get_list_orders(dFrom.ToString("yyyy-MM-dd"), dTo.ToString("yyyy-MM-dd"), "%" + ProcessId + "%", "%" + StatusId + "%", "%" + StaffCode + "%", "%" + C1Code + "%").ToList(); } data = data.Where(p => p.SalePlace.Contains(SalePlace)).ToList(); if (permit == 2) { // get list cn var branchPermit = db.UserBranchPermisses.Where(p => p.UserName == User.Identity.Name).Select(p => p.BranchCode).ToList(); data = data.Where(p => branchPermit.Contains(p.BrachCode)).ToList(); } return(View(data.OrderByDescending(p => p.CreateDate).ToPagedList(pageNumber, pageSize))); }
// report public ActionResult ProductRemain(int?page, string Code, string DateTo, string DateFrom) { if (!Utitl.CheckUser(db, User.Identity.Name, "AgencyReport", 0)) { return(RedirectToAction("relogin", "home")); } if (String.IsNullOrEmpty(Code)) { Code = "AX"; } var product = db.ProductInfoes.Where(p => p.Barcode == Code).FirstOrDefault(); if (product == null) { return(RedirectToAction("error", "home")); } int pageSize = 10; int pageNumber = (page ?? 1); DateTime dFrom = DateTime.Now.Date; DateTime dTo = DateTime.Now.Date; string strDateFrom; string strDateTo; if (!String.IsNullOrEmpty(DateTo) && !String.IsNullOrEmpty(DateTo)) { dFrom = DateTime.ParseExact(DateFrom, "dd/MM/yyyy", null); dTo = DateTime.ParseExact(DateTo, "dd/MM/yyyy", null); } strDateFrom = dFrom.ToString("yyyy-MM-dd"); strDateTo = dTo.ToString("yyyy-MM-dd"); ViewBag.DateFrom = dFrom; ViewBag.DateTo = dTo; ViewBag.Code = Code; ViewBag.Product = product; var listRemain = db.report_remain_product(Code, strDateFrom, strDateTo).ToList(); return(View(listRemain.OrderBy(p => p.WCode).ToPagedList(pageNumber, pageSize))); }
public ActionResult Send(string msg = null) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageNotification", 0)) { return(RedirectToAction("relogin", "home")); } ViewBag.MSG = msg; ViewBag.Areas = db.HaiAreas.ToList(); ViewBag.Branches = db.HaiBranches.ToList(); return(View()); }
public ActionResult AddAgency(string id, string type, string AgencyId, HttpPostedFileBase files, int action, int?group) { // id: staffid if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } if (group == null) { group = 1; } var staffCheck = db.HaiStaffs.Find(id); if (staffCheck == null) { return(RedirectToAction("error", "home")); } if (type == "c2") { if (action == 1) { // thêm AddAgencyC2(staffCheck, AgencyId, files, group); } else if (action == 2) { // xoa DeleteAgencyC2(staffCheck, AgencyId, files); } } else if (type == "c1") { if (action == 1) { // thêm AddAgencyC1(staffCheck, AgencyId, files); } else if (action == 2) { // xoa DeleteAgencyC1(staffCheck, AgencyId, files); } } return(RedirectToAction("AddAgency", "HaiStaff", new { id = id })); }
public ActionResult ModifyStaff(HaiStaff staff, string birthday, HttpPostedFileBase avatar, HttpPostedFileBase signature) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var staffCheck = db.HaiStaffs.Find(staff.Id); if (staffCheck != null) { if (birthday != "" && birthday != null) { DateTime dt = DateTime.ParseExact(birthday, "MM/dd/yyyy HH:mm", null); staffCheck.BirthDay = dt; } staffCheck.FullName = staff.FullName; // staffCheck.Code = staff.Code; staffCheck.BranchId = staff.BranchId; staffCheck.DepartmentId = staff.DepartmentId; staffCheck.PositionId = staff.PositionId; staffCheck.Notes = staff.Notes; staffCheck.Phone = staff.Phone; staffCheck.Email = staff.Email; staffCheck.PlaceOfBirth = staff.PlaceOfBirth; if (avatar != null) { staffCheck.AvatarUrl = UploadImage(avatar, "/staff/avatar", ".jpg", staff.Code); } if (signature != null) { staffCheck.SignatureUrl = UploadImage(signature, "/staff/signature", ".png", staff.Code); } db.Entry(staffCheck).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.TabActive = "1"; return(RedirectToAction("modifystaff", "haistaff", new { Id = staffCheck.Id })); } else { return(RedirectToAction("error", "home")); } }
public ActionResult ExportWarehouseRemain(string Code, string DateTo, string DateFrom) { if (!Utitl.CheckUser(db, User.Identity.Name, "AgencyReport", 0)) { return(RedirectToAction("relogin", "home")); } string pathRoot = Server.MapPath("~/haiupload/warehouseremain.xlsx"); string name = "report" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".xlsx"; string pathTo = Server.MapPath("~/temp/" + name); System.IO.File.Copy(pathRoot, pathTo); try { FileInfo newFile = new FileInfo(pathTo); var data = db.report_remain_wcode(Code, DateFrom, DateTo).ToList(); using (ExcelPackage package = new ExcelPackage(newFile)) { ExcelWorksheet worksheet = package.Workbook.Worksheets["Report"]; for (int i = 0; i < data.Count; i++) { try { worksheet.Cells[i + 2, 1].Value = data[i].ProductCode; worksheet.Cells[i + 2, 2].Value = data[i].PName; worksheet.Cells[i + 2, 3].Value = data[i].countNK; worksheet.Cells[i + 2, 4].Value = data[i].countXK; } catch { return(RedirectToAction("error", "home")); } } package.Save(); } } catch { return(RedirectToAction("error", "home")); } return(File(pathTo, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", string.Format("report-ton-kho-" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".{0}", "xlsx"))); }
public ActionResult ModifyBranch(int id) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var branch = db.HaiBranches.Find(id); if (branch == null) { return(RedirectToAction("error", "home")); } ViewBag.AllArea = db.HaiAreas.ToList(); return(View(branch)); }
public ActionResult ModifyArea(int id) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var area = db.HaiAreas.Find(id); if (area == null) { return(RedirectToAction("error", "home")); } return(View(area)); }
public ActionResult ModifyPosition(int id) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var pos = db.HaiPositions.Find(id); if (pos == null) { return(RedirectToAction("error", "home")); } return(View(pos)); }
public ActionResult ModifyDepartment(int id) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var dep = db.HaiDepartments.Find(id); if (dep == null) { return(RedirectToAction("error", "home")); } return(View(dep)); }
public ActionResult ResetImei(string user) { if (!Utitl.CheckUser(db, User.Identity.Name, "CheckImei", 0)) { return(RedirectToAction("relogin", "home")); } var data = db.ImeiUsers.Where(p => p.UserName == user).FirstOrDefault(); if (data != null) { data.IsUpdate = 1; db.Entry(data).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("CheckImei", "UserImei", new { user = user })); }
public ActionResult DeleteSeri(string Id) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageProduct", 1)) { return(RedirectToAction("relogin", "home")); } var check = db.ProductSeris.Find(Id); if (check != null && check.IsUse == 0) { db.ProductSeris.Remove(check); db.SaveChanges(); } return(RedirectToAction("productseri", "product")); }
//them khach hang cho nhan vien public ActionResult AddAgency(string id) { // id: staffid if (!Utitl.CheckUser(db, User.Identity.Name, "ManageStaff", 1)) { return(RedirectToAction("relogin", "home")); } var staffCheck = db.HaiStaffs.Find(id); if (staffCheck == null) { return(RedirectToAction("error", "home")); } return(View(staffCheck)); }
public ActionResult ShowCalendarDetail(string id) { if (!Utitl.CheckUser(db, User.Identity.Name, "CheckIn", 0)) { return(RedirectToAction("relogin", "home")); } var calendar = db.CalendarInfoes.Find(id); var detail = db.checkin_getcalendar(calendar.CMonth, calendar.CYear, calendar.StaffId).OrderBy(p => p.CDay).ToList(); ViewBag.GroupType = db.checkin_calendartype_group(calendar.CMonth, calendar.CYear, calendar.StaffId).ToList(); ViewBag.Calendar = calendar; ViewBag.AgencyReport = db.checkin_count_day_agency(calendar.CMonth, calendar.CYear, calendar.StaffId).OrderBy(p => p.AgencyCode).ToList(); return(View(detail)); }
// tao seri public ActionResult ProductSeri(int?page, string productId, int?isUse, int?SeriType) { if (!Utitl.CheckUser(db, User.Identity.Name, "ManageProduct", 0)) { return(RedirectToAction("relogin", "home")); } if (String.IsNullOrEmpty(productId)) { productId = "-1"; } if (isUse == null) { isUse = 0; } if (SeriType == null) { SeriType = 1; } // 1: dai ly // 2: nong dan ViewBag.Products = db.ProductInfoes.ToList(); ViewBag.ProductId = productId; ViewBag.IsUse = isUse; ViewBag.SeriType = SeriType; int pageSize = 10; int pageNumber = (page ?? 1); if (productId == "-1") { return(View(db.ProductSeris.Where(p => p.IsUse == isUse && p.SeriType == SeriType).OrderByDescending(p => p.BeginTime).ToPagedList(pageNumber, pageSize))); } else { return(View(db.ProductSeris.Where(p => p.ProductId == productId && p.IsUse == isUse && p.SeriType == SeriType).OrderByDescending(p => p.BeginTime).ToPagedList(pageNumber, pageSize))); } }