Example #1
0
        public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter = "")
        {
            var        db           = new OrganizationUnitPlanImplementation_DAL();
            ToTalMonth ToTalMonth   = new ToTalMonth();
            int        total        = 0;
            int        LanguageCode = Global.CurrentLanguage;
            var        result       = db.OrganizationUnitPlanImplementation_GetList(pageIndex, pageSize, filter, LanguageCode, out total, out ToTalMonth);
            var        lstTotal     = new TableColumnsTotalModel();

            lstTotal.Total1 = "15";
            lstTotal.Total2 = "25";
            lstTotal.Total3 = "35";
            lstTotal.Total4 = "45";
            lstTotal.Total5 = "55";
            return(Content(JsonConvert.SerializeObject(new
            {
                employees = result,
                totalCount = total,
                lstTotal = lstTotal,
                ToTalMonth = ToTalMonth
            })));
        }
Example #2
0
        public ActionResult OrganizationUnitPlanImplementationExportExcel(string filter = "")
        {
            DataTable dt = new DataTable("Grid");

            if (filter.Contains("!!") == true)
            {
                filter = filter.Replace("!!", "%");
            }
            dt.Columns.AddRange(new DataColumn[]
            {
                new DataColumn(AppRes.OrganizationUnit),
                new DataColumn(AppRes.Currency),
                new DataColumn(AppRes.Contract),
                new DataColumn(AppRes.Year),
                new DataColumn(AppRes.StatusName),
                new DataColumn(AppRes.L1),
                new DataColumn(AppRes.L2),
                new DataColumn(AppRes.L3),
                new DataColumn(AppRes.L4),
                new DataColumn(AppRes.L5),
                new DataColumn(AppRes.L6),
                new DataColumn(AppRes.L7),
                new DataColumn(AppRes.L8),
                new DataColumn(AppRes.L9),
                new DataColumn(AppRes.L10),
                new DataColumn(AppRes.L11),
                new DataColumn(AppRes.L12),
                new DataColumn(AppRes.R_Total),
                new DataColumn(AppRes.StatusInput),
            });
            dt.Columns[0].DataType  = typeof(string);
            dt.Columns[1].DataType  = typeof(string);
            dt.Columns[2].DataType  = typeof(string);
            dt.Columns[3].DataType  = typeof(string);
            dt.Columns[4].DataType  = typeof(string);
            dt.Columns[5].DataType  = typeof(string);
            dt.Columns[6].DataType  = typeof(double);
            dt.Columns[7].DataType  = typeof(double);
            dt.Columns[8].DataType  = typeof(double);
            dt.Columns[9].DataType  = typeof(double);
            dt.Columns[10].DataType = typeof(double);
            dt.Columns[11].DataType = typeof(double);
            dt.Columns[12].DataType = typeof(double);
            dt.Columns[13].DataType = typeof(double);
            dt.Columns[14].DataType = typeof(double);
            dt.Columns[15].DataType = typeof(double);
            dt.Columns[16].DataType = typeof(double);
            dt.Columns[17].DataType = typeof(double);
            dt.Columns[18].DataType = typeof(string);

            var        db         = new OrganizationUnitPlanImplementation_DAL();
            ToTalMonth ToTalMonth = new ToTalMonth();

            int total        = 0;
            int LanguageCode = Global.CurrentUser.CurrentLanguageID;
            var lstData      = db.OrganizationUnitPlanImplementation_GetList(1, 100000, filter, LanguageCode, out total, out ToTalMonth);

            if (lstData != null && lstData.Count() > 0)
            {
                foreach (var item in lstData)
                {
                    dt.Rows.Add(item.OrganizationUnitName, item.CurrencyName, item.ContractTypeName, item.Year, item.StatusName, item.M1, item.M2, item.M3, item.M4, item.M5, item.M6, item.M7, item.M8, item.M9, item.M10, item.M11, item.M12, item.SumValue, item.StatusInputName);
                }
            }


            var wb = new XLWorkbook();

            wb.Worksheets.Add(dt);
            byte[] data = null;
            using (var stream = new MemoryStream())
            {
                wb.SaveAs(stream);
                data = stream.ToArray();
            }
            return(File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", " OrganizationUnitPlanImplementation.xlsx"));
        }