示例#1
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType)
        {
            SysRole role = CurrentUser.Role(3).Role();

            ViewBag.canWrite  = role.SysRolePermission.Where(x => x.MenuId == 3210 && x.PermissionId == 2 && x.PermissionFlag).Count() > 0;
            ViewBag.canDelete = role.SysRolePermission.Where(x => x.MenuId == 3210 && x.PermissionId == 3 && x.PermissionFlag).Count() > 0;
            ViewBag.canExport = role.SysRolePermission.Where(x => x.MenuId == 3210 && x.PermissionId == 4 && x.PermissionFlag).Count() > 0;
            List <TblCalLoad> lst = new List <TblCalLoad>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                var data = db.TblCalLoad
                           .Where(x => x.CreatedBy == CurrentUID);
                int total = data.Count();
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Soil", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>(),
                    SortExp   = "",
                    Total     = total
                };
                ViewBag.Pagination = Pagination;
                lst = (from d in data
                       join m in db.TblPile on d.ModelId equals m.PileId
                       orderby
                       m.PileName ascending
                       , d.InputC ascending
                       select d)
                      .Skip((Pagination.Page - 1) * Pagination.Size)
                      .Take(Pagination.Size)
                      .ToList();
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#2
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType,
                                  string src = "", string username = "")
        {
            SysRole role = CurrentUser.Role(SITE_ID).Role();

            ViewBag.canWrite  = role.SysRolePermission.Where(x => x.MenuId == 2910 && x.PermissionId == 2 && x.PermissionFlag).Count() > 0;
            ViewBag.canDelete = role.SysRolePermission.Where(x => x.MenuId == 2910 && x.PermissionId == 3 && x.PermissionFlag).Count() > 0;
            List <SysAccount> lst = new List <SysAccount>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Account.Counts(src, username);
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Account", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>()
                    {
                        { "src", src },
                        { "username", username }
                    },
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Account.Gets(Pagination.Page, Pagination.Size, src, username);
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
        // GET: TransferStockIn
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType,
                                  string src = "")
        {
            List <TransferStockHeader> lst = new List <TransferStockHeader>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Modules.TransferStock.Count(0, "I");
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "TransferStockIn", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>()
                    {
                        { "src", src }
                    },
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Modules.TransferStock.Gets(Pagination.Page, Pagination.Size, src, "I");
                foreach (var ls in lst.ToList())
                {
                    ls.Employee = uow.Modules.Employee.GetByCondition(ls.EmpId);
                }
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage(true)
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#4
0
        // GET: Payment
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType,
                                  string src = "")
        {
            List <TblPayment> lst = new List <TblPayment>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Modules.Payment.Count(src);
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Payment", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>()
                    {
                        { "src", src }
                    },
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Modules.Payment.Gets(Pagination.Page, Pagination.Size, src);
                foreach (var ls in lst.ToList())
                {
                    ls.AcctReceive = uow.Modules.BankAccount.Get(ls.AcctReceiveId.HasValue ? ls.AcctReceiveId.Value : 0);
                }
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage(true)
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#5
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType,
                                  string src = "", string phone = "", string email = "")
        {
            List <TblEmployee> lst = new List <TblEmployee>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Modules.Employee.Counts(src, phone, email);
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Account", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>()
                    {
                        { "src", src },
                        { "phone", phone },
                        { "email", email }
                    },
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Modules.Employee.Gets(Pagination.Page, Pagination.Size, src, phone, email);
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#6
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType,
                                  string src = "")
        {
            List <TblPile> lst = new List <TblPile>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = db.TblPile.Count();
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Pile", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>()
                    {
                        { "src", src }
                    },
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = db.TblPile.Include("TblPileSeries")
                      .OrderBy(x => x.TblPileSeries.SeriesOrder).ThenBy(x => x.PileSeriesOrder).Skip((Pagination.Page - 1) * Pagination.Size).Take(Pagination.Size).ToList();
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage(true)
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#7
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType)
        {
            List <TeamSale> lst = new List <TeamSale>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Modules.TeamSale.Count();
                WidgetPaginationModel Pagination = new WidgetPaginationModel(PathHelper.SaleTeam)
                {
                    Page    = (page ?? 1),
                    Size    = (size ?? 10),
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;

                AccountPermission permission = new AccountPermission();
                permission = GetPermissionSale(CurrentUser.AccountId, CurrentUser.AccountId);
                ViewData["userAccount"]   = CurrentUser;
                ViewData["optPermission"] = permission;
                lst = uow.Modules.TeamSale.Gets(Pagination.Page, Pagination.Size).FindAll(o => o.DepartmentId == departmentID);
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#8
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType,
                                  string src = "")
        {
            List <TblProduct> lst = new List <TblProduct>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Modules.Product.Count(src);
                WidgetPaginationModel Pagination = new WidgetPaginationModel(MVCAction, MVCController, MVCArea)
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>()
                    {
                        { "src", src }
                    },
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Modules.Product.Gets(Pagination.Page, Pagination.Size, src);
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage(true)
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#9
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType)
        {
            SysRole role = CurrentUser.Role(3).Role();

            ViewBag.canWrite  = role.SysRolePermission.Where(x => x.MenuId == 3920 && x.PermissionId == 2 && x.PermissionFlag).Count() > 0;
            ViewBag.canDelete = role.SysRolePermission.Where(x => x.MenuId == 3920 && x.PermissionId == 3 && x.PermissionFlag).Count() > 0;
            List <SysRole> lst = new List <SysRole>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Role.Counts(SITE_ID);
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Role", "")
                {
                    Page    = (page ?? 1),
                    Size    = (size ?? 10),
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Role.Gets(Pagination.Page, Pagination.Size, SITE_ID);
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#10
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType)
        {
            List <SysRole> lst = new List <SysRole>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                int total = uow.Modules.Role.Counts(SiteId);
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Role", "")
                {
                    Page    = (page ?? 1),
                    Size    = (size ?? 10),
                    SortExp = "",
                    Total   = total
                };
                ViewBag.Pagination = Pagination;
                lst = uow.Modules.Role.Gets(Pagination.Page, Pagination.Size, SiteId);
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#11
0
        public ActionResult Index(int?page, int?size, string msg, AlertMsgType?msgType)
        {
            SysRole role = CurrentUser.Role(3).Role();

            ViewBag.canWrite  = role.SysRolePermission.Where(x => x.MenuId == 3220 && x.PermissionId == 2 && x.PermissionFlag).Count() > 0;
            ViewBag.canDelete = role.SysRolePermission.Where(x => x.MenuId == 3220 && x.PermissionId == 3 && x.PermissionFlag).Count() > 0;
            ViewBag.canExport = role.SysRolePermission.Where(x => x.MenuId == 3220 && x.PermissionId == 4 && x.PermissionFlag).Count() > 0;
            List <TblKpt> lst = new List <TblKpt>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                var data = uow.db.TblKpt.AsQueryable();
                if (!CurrentUser.FlagAdminCalc)
                {
                    var staffs = db.CalcAccountStaff.Where(x => x.AccountId == CurrentUID).Select(x => x.StaffId).ToList();
                    if (staffs.Count() > 0)
                    {
                        data = data.Where(x => staffs.Contains(x.CreatedBy) || x.CreatedBy == CurrentUID);
                    }
                    else
                    {
                        data = data.Where(x => x.CreatedBy == CurrentUID);
                    }
                }
                int total = data.Count();
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "KPT", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>(),
                    SortExp   = "",
                    Total     = total
                };
                ViewBag.Pagination = Pagination;
                lst = data
                      .OrderByDescending(x => x.KptDate)
                      .ThenBy(x => x.ProjectName)
                      .Include(x => x.TblKptDetail)
                      .Skip((Pagination.Page - 1) * Pagination.Size)
                      .Take(Pagination.Size)
                      .ToList();
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#12
0
        public ActionResult Maps(int?page, int?size, string dateStart, string dateEnd, string msg, AlertMsgType?msgType)
        {
            DateTime?dtStart = dateStart.ParseDateNullable(DateFormat.ddMMyyyy);
            DateTime?dtEnd   = dateEnd.ParseDateNullable(DateFormat.ddMMyyyy);

            ViewData["GoogleMapsAPIKey"] = ConfigurationManager.AppSettings["GoogleMapsAPI"];
            SysRole role = CurrentUser.Role(3).Role();

            ViewBag.canWrite  = role.SysRolePermission.Where(x => x.MenuId == 3710 && x.PermissionId == 2 && x.PermissionFlag).Count() > 0;
            ViewBag.canDelete = role.SysRolePermission.Where(x => x.MenuId == 3710 && x.PermissionId == 3 && x.PermissionFlag).Count() > 0;
            ViewBag.canExport = role.SysRolePermission.Where(x => x.MenuId == 3710 && x.PermissionId == 4 && x.PermissionFlag).Count() > 0;
            List <TblKpt> lst = new List <TblKpt>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                var data = uow.db.TblKpt.AsQueryable();
                if (dtStart.HasValue)
                {
                    data = data.Where(x => DbFunctions.TruncateTime(x.CreatedDate) >= dtStart.Value);
                }
                if (dtEnd.HasValue)
                {
                    data = data.Where(x => DbFunctions.TruncateTime(x.CreatedDate) <= dtEnd.Value);
                }
                ViewData["dateStart"] = dtStart.ParseString(DateFormat.ddMMyyyy);
                ViewData["dateEnd"]   = dtEnd.ParseString(DateFormat.ddMMyyyy);
                int total = data.Count();
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Maps", "Report", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>(),
                    SortExp   = "",
                    Total     = total
                };
                ViewBag.Pagination = Pagination;
                lst = data
                      .OrderByDescending(x => x.KptDate)
                      .ThenBy(x => x.ProjectName)
                      .Include(x => x.TblKptDetail)
                      .Skip((Pagination.Page - 1) * Pagination.Size)
                      .Take(Pagination.Size)
                      .ToList();
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }
示例#13
0
        public ActionResult Index(int?page, int?size, string dateStart, string dateEnd, string msg, AlertMsgType?msgType)
        {
            DateTime?         dtStart = dateStart.ParseDateNullable(DateFormat.ddMMyyyy);
            DateTime?         dtEnd   = dateEnd.ParseDateNullable(DateFormat.ddMMyyyy);
            List <TblCalLoad> lst     = new List <TblCalLoad>();

            try
            {
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    WidgetAlertModel alert = new WidgetAlertModel()
                    {
                        Message = msg
                    };
                    if (msgType.HasValue)
                    {
                        alert.Type = msgType.Value;
                    }
                    ViewBag.Alert = alert;
                }
                var data = db.TblCalLoad.AsQueryable();
                if (dtStart.HasValue)
                {
                    data = data.Where(x => DbFunctions.TruncateTime(x.CreatedDate) >= dtStart.Value);
                }
                if (dtEnd.HasValue)
                {
                    data = data.Where(x => DbFunctions.TruncateTime(x.CreatedDate) <= dtEnd.Value);
                }
                int total = data.Count();
                ViewData["dateStart"] = dtStart.ParseString(DateFormat.ddMMyyyy);
                ViewData["dateEnd"]   = dtEnd.ParseString(DateFormat.ddMMyyyy);
                WidgetPaginationModel Pagination = new WidgetPaginationModel("Index", "Report", "")
                {
                    Page      = (page ?? 1),
                    Size      = (size ?? 10),
                    SearchCri = new Dictionary <string, dynamic>(),
                    SortExp   = "",
                    Total     = total
                };
                ViewBag.Pagination = Pagination;
                lst = (from d in data
                       join m in db.TblPile on d.ModelId equals m.PileId
                       orderby
                       d.CreatedDate descending
                       , m.PileName ascending
                       , d.InputC ascending
                       select d)
                      .Skip((Pagination.Page - 1) * Pagination.Size)
                      .Take(Pagination.Size)
                      .ToList();
            }
            catch (Exception ex)
            {
                WidgetAlertModel Alert = new WidgetAlertModel()
                {
                    Type    = AlertMsgType.Danger,
                    Message = ex.GetMessage()
                };
                ViewBag.Alert = Alert;
            }
            return(View(lst));
        }