コード例 #1
0
        public JsonResult List(EmpSearch search, FormCollection form)
        {
            PageView view = new PageView(form);

            if (search == null)
            {
                search = new EmpSearch();
            }
            search.FirstTime = form["FirstTime"];
            search.EndTime   = form["EndTime"];
            search.DeptId    = form["DeptId"];
            search.StoreName = form["StoreName"];
            List <string> deptIdList = new List <string>();

            if (deptTree == null)
            {
                setDeptTree();
            }
            List <EMPLOYEE_EX> pList    = _service.QueryEmplReport(search);
            string             colkey   = form["colkey"];
            string             colsinfo = form["colsinfo"];
            JsonQTable         fdata    = JsonQTable.ConvertFromList <EMPLOYEE_EX>(pList, colkey, colsinfo.Split(','));

            return(Json(fdata));
        }
コード例 #2
0
        public FileResult ExportEmployeeList(string StoreName, string FirstTime, string EndTime)
        {
            //如果没有输条件,则导出该用户权限下所有员工数据

            JsonSMsg  rMsg   = new JsonSMsg();
            EmpSearch search = new EmpSearch();

            search.StoreName = StoreName;
            search.FirstTime = FirstTime;
            search.EndTime   = EndTime;

            List <EMPLOYEE_EX> pList = _service.QueryEmplReport(search);

            //创建Excel文件的对象
            NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook();
            //添加一个sheet
            NPOI.SS.UserModel.ISheet sheet1 = book.CreateSheet("Sheet1");
            //给sheet1添加第一行的头部标题
            NPOI.SS.UserModel.IRow row1 = sheet1.CreateRow(0);
            row1.CreateCell(0).SetCellValue("id");
            row1.CreateCell(1).SetCellValue("userid");
            row1.CreateCell(2).SetCellValue("姓名");
            row1.CreateCell(3).SetCellValue("手机");
            row1.CreateCell(4).SetCellValue("ewmid");
            row1.CreateCell(5).SetCellValue("ewmurl");
            row1.CreateCell(6).SetCellValue("区域");
            row1.CreateCell(7).SetCellValue("门店");
            row1.CreateCell(8).SetCellValue("绑定人数");
            //将数据逐步写入sheet1各个行
            for (int j = 0; j < pList.Count; j++)
            {
                NPOI.SS.UserModel.IRow rowtemp = sheet1.CreateRow(j + 1);
                rowtemp.CreateCell(0).SetCellValue(pList[j].ID);
                rowtemp.CreateCell(1).SetCellValue(pList[j].USERID);
                rowtemp.CreateCell(2).SetCellValue(pList[j].NAME);
                rowtemp.CreateCell(3).SetCellValue(pList[j].MOBILE);
                rowtemp.CreateCell(4).SetCellValue(pList[j].EwmId.ToString());
                rowtemp.CreateCell(5).SetCellValue(pList[j].EwmUrl);
                rowtemp.CreateCell(6).SetCellValue(pList[j].AreaName);
                rowtemp.CreateCell(7).SetCellValue(pList[j].StoreName);
                rowtemp.CreateCell(8).SetCellValue(pList[j].FansNum);
            }
            // 写入到客户端
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            book.Write(ms);
            ms.Seek(0, 0);

            return(File(ms, "application/vnd.ms-excel", "员工列表.xls"));
        }
コード例 #3
0
        public JsonResult ListEmp(EmpSearch search, FormCollection form)
        {
            PageView view = new PageView(form);

            if (search == null)
            {
                search = new EmpSearch();
            }
            PagedList <EMPLOYEE> pList = _service.QueryGetEmp(search, view);
            string     colkey          = form["colkey"];
            string     colsinfo        = form["colsinfo"];
            JsonQTable fdata           = JsonQTable.ConvertFromPagedList <EMPLOYEE>(pList, colkey, colsinfo.Split(','));

            return(Json(fdata));
        }
コード例 #4
0
ファイル: SystemService.cs プロジェクト: Thn123/hmj
 public List <EMPLOYEE_EX> QueryEmplReport(EmpSearch search)
 {
     return(_set.QueryEmplReport(search));
 }
コード例 #5
0
ファイル: SystemService.cs プロジェクト: Thn123/hmj
 public PagedList <EMPLOYEE> QueryGetEmp(EmpSearch search, PageView view)
 {
     return(_set.QueryGetEmp(search, view));
 }
コード例 #6
0
        public ActionResult empsearchajax(EmpSearch empSearch)
        {
            int offSet   = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["appTableOffSet"]);
            int skipRows = (empSearch.pageNumber - 1) * offSet;

            using (var dbCntx = new HrDataContext())
            {
                var list = dbCntx.EmployeeHeaders.AdvSearchEmpHeaderWhere(empSearch.EmployeeName, empSearch.EmployeeType)
                           .Join(dbCntx.EmployeePersonalDetails,
                                 a => a.EmployeeId, b => b.EmployeeId,
                                 (a, b) => new { A = a, B = b })
                           .Join(dbCntx.EmployeeWorkDetails.AdvSearchEmpWorkDetailWhere(empSearch.DOJ, empSearch.Designation, BRANCHID, ROLECODE),
                                 c => c.A.EmployeeId, d => d.EmployeeId,
                                 (c, d) => new { C = c, D = d })
                           //.Join(dbCntx.Users,
                           //e => e.C.A.EmployeeId, f => f.EmployeeId,
                           //(e, f) => new { E = e, F = f })
                           //.Join(dbCntx.EmployeeDocumentDetails,
                           //g => g.E.C.A.EmployeeId, h => h.EmployeeId,
                           //(g, h) => new { G = g, H = h })
                           .Select(x => new EmployeeListVm
                {
                    EmployeeId   = x.C.A.EmployeeId,
                    EmployeeNo   = x.C.A.IDNumber,
                    EmployeeName = x.C.A.FirstName,
                    JoiningDate  = x.D.JoiningDate,
                    JobTitle     = dbCntx.LookUps
                                   .Where(y => y.LookUpID == x.D.DesignationId)
                                   .FirstOrDefault().LookUpDescription,
                    ContactNo        = x.C.B.EmergencyContactNumber,
                    PersonalEmailId  = x.C.A.UserEmailId,
                    OfficialEmailId  = x.C.A.UserEmailId,
                    DocumentDetailID = dbCntx.EmployeeDocumentDetails
                                       .Where(z => z.DocumentType == UTILITY.DOCUMENTTYPEID && z.EmployeeId == x.C.A.EmployeeId).FirstOrDefault() == null ? 0 :
                                       dbCntx.EmployeeDocumentDetails
                                       .Where(z => z.DocumentType == UTILITY.DOCUMENTTYPEID && z.EmployeeId == x.C.A.EmployeeId).FirstOrDefault().DocumentDetailID,//x.H.DocumentDetailID,
                    DateOfBirth = x.C.B.DOB,
                    branchid    = x.C.A.BranchId,
                    ProfilePic  = dbCntx.EmployeeDocumentDetails
                                  .Where(a => a.DocumentType == UTILITY.DOCUMENTTYPEID && a.EmployeeId == x.C.A.EmployeeId).FirstOrDefault() == null ? "" :
                                  dbCntx.EmployeeDocumentDetails
                                  .Where(a => a.DocumentType == UTILITY.DOCUMENTTYPEID && a.EmployeeId == x.C.A.EmployeeId).FirstOrDefault().FileName
                });
                var emplist = list.Where(x => x.branchid == BRANCHID).ToList();
                var query   = emplist.OrderByDescending(x => x.EmployeeId).Skip(skipRows).Take(offSet).ToList().AsEnumerable();

                var totalCount = emplist.Count();

                decimal pagerLength    = decimal.Divide(Convert.ToDecimal(totalCount), Convert.ToDecimal(offSet));
                decimal pagnationRound = Math.Ceiling(Convert.ToDecimal(pagerLength));

                var empDirectoryVm = new EmpDirectoryVm
                {
                    employeeVm  = query,
                    empSearch   = empSearch,
                    count       = totalCount,
                    PagerLength = pagnationRound
                };
                return(Json(empDirectoryVm, JsonRequestBehavior.AllowGet));
            }
        }