Ejemplo n.º 1
0
        public ActionResult GetReportClassList([DataSourceRequest] DataSourceRequest request, Tra_ReportClassSearchModel model)
        {
            string status = string.Empty;
            var service = new ActionService(UserLogin);
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.StartDate };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.EndDate };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            List<object> paraClass = new List<object>();
            paraClass.AddRange(new object[10]);
            paraClass[3] = model.StartDate;
            paraClass[4] = model.EndDate;
            paraClass[5] = model.ScheduleTimeStart;
            paraClass[6] = model.ScheduleTimeEnd;
            paraClass[7] = model.RequirementTrainID;
            paraClass[8] = 1;
            paraClass[9] = int.MaxValue - 1;
            var listClass = service.GetData<Tra_ClassEntity>(paraClass, ConstantSql.hrm_tra_sp_get_Class, ref status);
            var ReportServices = new Tra_ReportServices();
            var result = ReportServices.GetReportClass(listClass, model.ClassID,model.IsCreateTemplate);
            var isDataTable = false;
            object obj = new DataTable();
            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportClassEntity",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportId != Guid.Empty)
            {
                var fullPath = string.Empty;
                if (headerInfo1.Value == null || headerInfo2.Value == null)
                {
                    fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);
                }
                else
                {
                    fullPath = ExportService.Export(model.ExportId, result, listHeaderInfo, model.ExportType);
                }
                return Json(fullPath);
            }
            #region mapping dataTable to dataList
            List<Tra_ReportClassModel> dataList = new List<Tra_ReportClassModel>();
            Tra_ReportClassModel aTSource = null;

            if (result.Rows.Count > 0)
            {
                const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic;
                var objFieldNames = (from PropertyInfo aProp in typeof(Tra_ReportClassModel).GetProperties(flags)
                                     select new
                                     {
                                         Name = aProp.Name,
                                         Type = Nullable.GetUnderlyingType(aProp.PropertyType) ?? aProp.PropertyType
                                     }).ToList();
                var dataTblFieldNames = (from DataColumn aHeader in result.Columns
                                         select new { Name = aHeader.ColumnName, Type = aHeader.DataType }).ToList();
                var commonFields = objFieldNames.Intersect(dataTblFieldNames).ToList();
                foreach (DataRow dataRow in result.AsEnumerable().ToList())
                {
                    aTSource = new Tra_ReportClassModel();
                    foreach (var aField in commonFields)
                    {
                        PropertyInfo propertyInfos = aTSource.GetType().GetProperty(aField.Name);
                        if (dataRow[aField.Name] == DBNull.Value)
                            continue;
                        propertyInfos.SetValue(aTSource, dataRow[aField.Name], null);
                    }
                    dataList.Add(aTSource);
                }
            }
            #endregion
            return Json(dataList.ToDataSourceResult(request));
        }
Ejemplo n.º 2
0
        public ActionResult GetReportTraineeUnAttend([DataSourceRequest] DataSourceRequest request, Tra_ReportTraineeUnAttendModel model)
        {

            string status = string.Empty;

            Tra_ReportServices service = new Tra_ReportServices();
            Cat_PayrollGroupServices payrollGroupServices = new Cat_PayrollGroupServices();
            ActionService service1 = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();
            Guid[] courseID = null;
            if (!string.IsNullOrEmpty(model.CourseID))
            {
                courseID = model.CourseID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }

            Guid[] classID = null;
            if (!string.IsNullOrEmpty(model.ClassID))
            {
                classID = model.ClassID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            Guid[] RequirementTrainIDs = null;
            if(!string.IsNullOrEmpty(model.RequirementTrainID))
            {               
                RequirementTrainIDs = model.RequirementTrainID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            DataTable result = service.GetReportTraineeUnAttend(model.CodeEmp, model.ProfileName, model.OrgStructureID, courseID, classID, model.StartDate, model.EndDate, model.IsCreateTemplate, RequirementTrainIDs, UserLogin);

            #region Xử lý cách export mới
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportTraineeUnAttendEntity",
                    OutPutPath = path,
                    //     HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #endregion
            if (model.ExportId != Guid.Empty)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));

        }
Ejemplo n.º 3
0
        public ActionResult GetReportTraineeNotInRequirementDetail([DataSourceRequest] DataSourceRequest request, Tra_ReportTraineeNotInRequirementDetailModel model)
        {

            string status = string.Empty;

            Tra_ReportServices service = new Tra_ReportServices();

            ActionService service1 = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();

            Guid[] _ClassIDs = null;
            Guid[] _CourseIDs = null;
            Guid[] _RequirementTrainIDs = null;
            if (model.ClassIDs != null)
                _ClassIDs = model.ClassIDs.Split(',').Select(s => Guid.Parse(s)).ToArray();
            if (model.CourseIDs != null)
                _CourseIDs = model.CourseIDs.Split(',').Select(s => Guid.Parse(s)).ToArray();
            //if (model.RequirementTrainID != null)
            //    _RequirementTrainIDs = model.RequirementTrainID.Split(',').Select(s => Guid.Parse(s)).ToArray();

            //DataTable result = service.GetReportTraineeNotInRequirementDetail(model.Month, model.OrgStructureID, _ClassIDs, model.IsCreateTemplate, _CourseIDs, _RequirementTrainIDs);
            DataTable result = service.GetReportTraineeNotInRequirementDetail(model.Month, model.OrgStructureID, _ClassIDs, model.IsCreateTemplate, _CourseIDs, UserLogin);
            #region Xử lý cách export mới
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportTraineeNotInRequirementDetailModel",
                    OutPutPath = path,
                    //     HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #endregion
            if (model.ExportId != Guid.Empty)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));

        }
Ejemplo n.º 4
0
        public ActionResult GetReportTransferTrainee([DataSourceRequest] DataSourceRequest request, Tra_ReportTransferTraineeModel model)
        {

            string status = string.Empty;

            Tra_ReportServices service = new Tra_ReportServices();
            Cat_PayrollGroupServices payrollGroupServices = new Cat_PayrollGroupServices();
            ActionService service1 = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();

            DataTable result = service.GetReportTransferTrainee(model.CodeEmp, model.ProfileName, model.OrgStructureID, model.CourseID, model.ClassID, model.ClassOldID, model.IsCreateTemplate, UserLogin);

            #region Xử lý cách export mới
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {
                //var col = result.Columns.Count;
                //result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportTransferTraineeEntity",
                    OutPutPath = path,
                    //     HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #endregion
            if (model.ExportId != Guid.Empty)
            {
                //var col = result.Columns.Count;
                //result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));

        }
Ejemplo n.º 5
0
         public ActionResult GetReportTraineeResult([DataSourceRequest] DataSourceRequest request, Tra_ReportTraineeResultSearchModel model)
         {
             List<Tra_TraineeEntity> lstresult = new List<Tra_TraineeEntity>();
             //if (model.IsCreateTemplate != true)
             //{
             //    string status = string.Empty;
             //    var traineeServices = new ActionService(UserLogin);
             //    var objTrainee = new List<object>();
             //    objTrainee.AddRange(new object[15]);
             //    objTrainee[1] = model.CodeEmp;
             //    objTrainee[3] = model.DateFrom;
             //    objTrainee[4] = model.DateTo;
             //    objTrainee[8] = model.OrgStructureID;
             //    objTrainee[9] = model.ProfileName;
             //    objTrainee[10] = model.Status;
             //    objTrainee[11] = model.RequirementTrainName;
             //    objTrainee[13] = 1;
             //    objTrainee[14] = int.MaxValue - 1;
             //    lstresult = traineeServices.GetData<Tra_TraineeEntity>(objTrainee, ConstantSql.hrm_tra_sp_get_Trainee, ref status).ToList();
             //    Guid[] classID = null;
             //    if (!string.IsNullOrEmpty(model.ClassID))
             //    {
             //        classID = model.ClassID.Split(',').Select(s => Guid.Parse(s)).ToArray();
             //        if (classID != null)
             //        {
             //            lstresult = lstresult.Where(s => classID.Contains(s.ClassID)).ToList();
             //        }
             //    }
             //    Guid[] courseID = null;
             //    if (!string.IsNullOrEmpty(model.CourseID))
             //    {
             //        courseID = model.CourseID.Split(',').Select(s => Guid.Parse(s)).ToArray();
             //        if (courseID != null)
             //        {
             //            lstresult = lstresult.Where(s => courseID.Contains(s.CourseID)).ToList();
             //        }
             //    }
             //}
            Tra_ReportServices service = new Tra_ReportServices();

             //DataTable result = service.GetReportTraineeResult(lstresult, model.IsCreateTemplate, model.ScoreTypeID);
            model.OrgStructureID = Common.DotNetToOracle(model.OrgStructureID);
            model.CourseID = Common.DotNetToOracle(model.CourseID);
            model.ClassID = Common.DotNetToOracle(model.ClassID);
            model.ScoreTypeID = Common.DotNetToOracle(model.ScoreTypeID);
            model.RequirementTrainIDs = Common.DotNetToOracle(model.RequirementTrainIDs);
            DataTable result = service.GetReportTraineeResultNew(model.Copy<Tra_ReportTraineeResultSearchEntity>(), UserLogin, model.IsCreateTemplate);


            #region Xử lý cách export mới
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
             //   result.Columns.RemoveAt(col - 1);
                obj = result;
                isDataTable = true;
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportTraineeResultEntity",
                    OutPutPath = path,
                    //     HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #endregion
            if (model.ExportId != Guid.Empty)
            {
                var col = result.Columns.Count;
              //  result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));


        }
Ejemplo n.º 6
0
        public ActionResult GetReportTraineeJoinCoursePass([DataSourceRequest] DataSourceRequest request, Tra_ReportTraineeJoinCourseModel model)
        {

            string status = string.Empty;

            Tra_ReportServices service = new Tra_ReportServices();
            Cat_PayrollGroupServices payrollGroupServices = new Cat_PayrollGroupServices();
            ActionService service1 = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();
            Guid[] _RankIDs = null;
            if (model.RankID != null)
                _RankIDs = model.RankID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            Guid[] _CourseIDs = null;
            if (model.CourseID != null)
                _CourseIDs = model.CourseID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            Guid[] _RequirementTrainIDs = null;
            if (model.RequirementTrainID != null)
            {
                _RequirementTrainIDs = model.RequirementTrainID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }

            //List<object> strOrgIDs = new List<object>();
            //strOrgIDs.AddRange(new object[3]);
            //strOrgIDs[0] = (object)model.OrgStructureID;

            //List<Guid> lstProfileIDs = hrService.GetData<Hre_ProfileIdEntity>(strOrgIDs, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();

            DataTable result = service.GetReportTraineeJoinCoursePass(_CourseIDs, model.OrgStructureID, model.IsCreateTemplate, _RequirementTrainIDs, UserLogin);
            //HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom };
            //HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo };
            //List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            #region Xử lý cách export mới
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {

                obj = result;
                isDataTable = true;
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportTraineeJoinCourseEntity",
                    OutPutPath = path,
                    // HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #endregion
            if (model.ExportId != Guid.Empty)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));

        }
Ejemplo n.º 7
0
        public ActionResult GetReportTraineeJoinCourse([DataSourceRequest] DataSourceRequest request, Tra_ReportTraineeJoinCourseModel model)
        {

            string status = string.Empty;

            Tra_ReportServices service = new Tra_ReportServices();
            Cat_PayrollGroupServices payrollGroupServices = new Cat_PayrollGroupServices();
            ActionService service1 = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();
            Guid[] _RankIDs = null;
            if (model.RankID != null)
                _RankIDs = model.RankID.Split(',').Select(s => Guid.Parse(s)).ToArray();
            string[] _CourseIDs = null;
            if (model.CourseID != null)
                _CourseIDs = model.CourseID.Split(',').ToArray();


            List<object> strOrgIDs = new List<object>();
            strOrgIDs.AddRange(new object[3]);
            strOrgIDs[0] = (object)model.OrgStructureID;

           // List<Guid> lstProfileIDs = hrService.GetData<Hre_ProfileIdEntity>(strOrgIDs, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();

            DataTable result = service.GetReportTraineeJoinCourse(_RankIDs, _CourseIDs, model.OrgStructureID, model.IsCreateTemplate, model.DateSeniory, UserLogin);

            #region Xử lý cách export mới
            var isDataTable = false;
            DataTable obj = null;
            if (model.IsCreateTemplateForDynamicGrid)
            {

                obj = result;
                isDataTable = true;
            }

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Tra_ReportTraineeJoinCourseEntity",
                    OutPutPath = path,
                    //     HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            #endregion
            if (model.ExportId != Guid.Empty)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);

                var fullPath = ExportService.Export(model.ExportId, result, null, model.ExportType);

                return Json(fullPath);
            }
            if (model.IsAllPage)
            {
                string strCodeEmp = "";
                foreach (DataRow item in result.Rows)
                {
                    strCodeEmp += item[Tra_ReportTraineeJoinCourseEntity.FieldNames.CodeEmp] + ",";
                }
                return Json(strCodeEmp, JsonRequestBehavior.AllowGet);
                //ViewBag.checkAll = strCodeEmp;
            }
            return new JsonResult() { Data = result.ToDataSourceResult(request), MaxJsonLength = Int32.MaxValue, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
            //    return Json(result.ToDataSourceResult(request));

        }
Ejemplo n.º 8
0
        public ActionResult GetTraineeByClassIDList([DataSourceRequest] DataSourceRequest request, Guid ClassID)
        {
            
            string status = string.Empty;
            var baseService = new ActionService(UserLogin);
            var traineeCertificateServices = new Tra_TraineeCertificateServices();
            var objTraineeCertificate = new List<object>();
            objTraineeCertificate.Add(1);
            objTraineeCertificate.Add(int.MaxValue - 1);
            var lstTraineeCertificate = baseService.GetData<Tra_TraineeCertificateEntity>(objTraineeCertificate, ConstantSql.hrm_tra_sp_get_TraineeCertificate, ref status).ToList();
            var objs = new List<object>();
            objs.Add(ClassID);
            var lstresult = baseService.GetData<Tra_TraineeEntity>(objs, ConstantSql.hrm_cat_sp_get_TraineeByClassID, ref status);
            var lstTrainee = new List<Tra_TraineeEntity>();
            foreach (var item in lstresult)
            {
                var traineeEntity = new Tra_TraineeEntity();
                traineeEntity = item.CopyData<Tra_TraineeEntity>();
                var traineeCertificate = lstTraineeCertificate.Where(s => item.ID == s.TraineeID.Value).FirstOrDefault();
                if (traineeCertificate == null)
                {
                    traineeEntity.CertificateName = string.Empty;
                    traineeEntity.DateCertificate = null;
                    traineeEntity.DateExpireCertificate = null;
                }
                lstTrainee.Add(traineeEntity);
            }

            Tra_ReportServices service = new Tra_ReportServices();
            DataTable result = service.GetTraineeByClassID(lstresult, false);

            return Json(result.ToDataSourceResult(request));
        }