Example #1
0
        public ActionResult ExportProfileSuspenseListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_SuspenseSearchModel model)
        {
            #region Tao template
            
            
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom == null ? DateTime.Now : model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo == null ? DateTime.Now : model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_StopWorkingModel(),
                    FileName = "Hre_StopWorking",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #endregion
            string status = string.Empty;
           // var isDataTable = false;
            object obj = new Hre_ProfileModel();
            var actionService = new ActionService(UserLogin);

            var lstObj = new List<object>();
            lstObj.Add(model.ProfileName);
            lstObj.Add(model.CodeEmp);
            lstObj.Add(model.JobTitleID);
            lstObj.Add(model.PositionID);
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(model.DateFrom);
            lstObj.Add(model.DateTo);
            lstObj.Add(model.TypeSuspense);
            lstObj.Add(model.Status);
            lstObj.Add(model.StatusComeBack);
            lstObj.Add(model.RequestDateComebackFrom);
            lstObj.Add(model.RequestDateComebackTo);
            lstObj.Add(model.DateComebackFrom);
            lstObj.Add(model.DateComebackTo);
            lstObj.Add(model.RankID);
            lstObj.Add(model.IsCreateTemplate);
            lstObj.Add(model.ExportId);
            lstObj.Add(model.ExportType);
            lstObj.Add(1);
            lstObj.Add(int.MaxValue - 1);

            var lisObjClas = new List<object>();
            lisObjClas.AddRange(new object[3]);
            lisObjClas[1] = 1;
            lisObjClas[2] = int.MaxValue - 1;
            var lisObjRank = new List<object>();
            lisObjRank.AddRange(new object[4]);
            lisObjRank[2] = 1;
            lisObjRank[3] = int.MaxValue - 1;
            var listResult = actionService.GetData<Hre_StopWorkingEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileSuspense, ref status).Translate<Hre_StopWorkingModel>();
            var lisClass = actionService.GetData<Cat_SalaryClassEntity>(lisObjClas,ConstantSql.hrm_cat_sp_get_SalaryClass, ref status);
            var lisRank = actionService.GetData<Cat_SalaryRankEntity>(lisObjRank, ConstantSql.hrm_cat_sp_get_SalaryRank, ref status);
            foreach (var item in listResult)
            {
               
                var lisClassbyproid = lisClass.Where(s => s.ID == item.SalaryClassID).FirstOrDefault();
                var lisRankbyclassid = lisRank.Where(s => lisClassbyproid !=null && s.SalaryClassID == lisClassbyproid.ID).FirstOrDefault();
                item.SalaryRankName = lisRankbyclassid != null ? lisRankbyclassid.SalaryRankName : string.Empty;
            }
            var profileServices = new Hre_ProfileServices();
           

            if (model.ExportId != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportId, listResult, listHeaderInfo, model.ExportType);
                return Json(fullPath);
            }
            return Json(listResult.ToDataSourceResult(request));
        }
Example #2
0
 public ActionResult GetProfileSuspenseList([DataSourceRequest] DataSourceRequest request, Hre_SuspenseSearchModel model)
 {
     return GetListDataAndReturn<Hre_StopWorkingModel, Hre_StopWorkingEntity, Hre_SuspenseSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_ProfileSuspense);
 }