Exemple #1
0
        public ActionResult ExportExcelAssignings()
        {
            BaseAssigningsBLL AssigningBLL = AssigingsFactory.CreateAssigning(AssigningsTypesEnum.Internal);

            var data = Json(new
            {
                data = AssigningBLL.GetAssignings().Select(x => new
                {
                    x.AssigningID,
                    EmployeeCodeNo     = x.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                    EmployeeNameAr     = x.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,
                    AssigningStartDate = Globals.Calendar.GetUmAlQuraDate(x.AssigningStartDate),
                    AssigningEndDate   = x.AssigningEndDate.HasValue ? Globals.Calendar.GetUmAlQuraDate(x.AssigningEndDate.Value) : "",
                    OrganizationName   = x.AssigningType.AssigningTypeID == (int)AssigningsTypesEnum.Internal ? ((InternalAssigningBLL)x).Organization.FullOrganizationName : ((ExternalAssigningBLL)x).ExternalOrganization,
                    JobName            = x.AssigningType.AssigningTypeID == (int)AssigningsTypesEnum.Internal ? ((InternalAssigningBLL)x).Job.JobName : string.Empty,
                    IsFinished         = x.IsFinished,
                })
            }, JsonRequestBehavior.AllowGet);

            Dictionary <string, string> ColumnNames = new Dictionary <string, string>
            {
                { "AssigningID", Resources.Globalization.SequenceNoText },
                { "EmployeeCodeNo", Resources.Globalization.EmployeeCodeNoText },
                { "EmployeeNameAr", Resources.Globalization.EmployeeNameArText },
                { "AssigningStartDate", Resources.Globalization.AssigningStartDateText },
                { "AssigningEndDate", Resources.Globalization.AssigningEndDateText },
                { "IsFinished", Resources.Globalization.AssigningIsFinishedText },
                { "OrganizationName", Resources.Globalization.OrganizationNameText },
                { "JobName", Resources.Globalization.JobNameText }
            };

            string fileName = ExcelHelper.ExportToExcel(Json(data), ColumnNames);

            return(Json(new { DownLoadFile = fileName }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult GetAssignings()
        {
            BaseAssigningsBLL AssigningBLL = AssigingsFactory.CreateAssigning(AssigningsTypesEnum.Internal);

            AssigningBLL.Search   = Search;
            AssigningBLL.Order    = Order;
            AssigningBLL.OrderDir = OrderDir;
            AssigningBLL.StartRec = StartRec;
            AssigningBLL.PageSize = PageSize;

            var data = AssigningBLL.GetAssignings(out TotalRecordsOut, out RecFilterOut).Select(x => new
            {
                x.AssigningID,
                EmployeeCodeNo     = x.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                EmployeeNameAr     = x.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,
                AssigningStartDate = x.AssigningStartDate,
                AssigningEndDate   = x.AssigningEndDate,
                IsFinished         = x.IsFinished,
            });

            return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = data }, JsonRequestBehavior.AllowGet));
        }