Ejemplo n.º 1
0
        public ActionResult utl_Grid_PermissionExportExcel(string filter)
        {
            int       Language = Global.CurrentLanguage;
            DataTable dt       = new DataTable("Grid");

            dt.Columns.AddRange(new DataColumn[13]
            {
                new DataColumn(AppRes.TableName),
                new DataColumn(AppRes.Permission),
                new DataColumn(AppRes.IsAdd),
                new DataColumn(AppRes.IsEdit),
                new DataColumn(AppRes.Timekeeping_DelTitle),
                new DataColumn(AppRes.isAction),
                new DataColumn(AppRes.Search),
                new DataColumn(AppRes.btnExcel),
                new DataColumn(AppRes.btnImportExcel),
                new DataColumn(AppRes.Timekeeping_SubmitTitle),
                new DataColumn(AppRes.IsApproval),
                new DataColumn(AppRes.IsDisApproval),
                new DataColumn(AppRes.btnCopy),
            });
            dt.Columns[0].DataType  = typeof(string);
            dt.Columns[1].DataType  = typeof(string);
            dt.Columns[2].DataType  = typeof(bool);
            dt.Columns[3].DataType  = typeof(bool);
            dt.Columns[4].DataType  = typeof(bool);
            dt.Columns[5].DataType  = typeof(bool);
            dt.Columns[6].DataType  = typeof(bool);
            dt.Columns[7].DataType  = typeof(bool);
            dt.Columns[8].DataType  = typeof(bool);
            dt.Columns[9].DataType  = typeof(bool);
            dt.Columns[10].DataType = typeof(bool);
            dt.Columns[11].DataType = typeof(bool);
            dt.Columns[12].DataType = typeof(bool);


            var db           = new utl_Grid_Permission_DAL();
            int total        = 0;
            int LanguageCode = Global.CurrentUser.CurrentLanguageID;
            var lstData      = db.utl_Grid_Permission_GetList(1, 5000, filter, out total, Language);

            foreach (var item in lstData)
            {
                dt.Rows.Add(item.GridName, item.PermissionName, item.IsAdd, item.IsEdit, item.IsDelete, item.IsActive, item.IsFilterButton,
                            item.IsExportExcel, item.IsImportExcel, item.IsSubmit, item.IsApproval, item.IsDisApproval, item.IsCopy);
            }

            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", " utl_Grid_Permission.xlsx"));
        }
Ejemplo n.º 2
0
        public ActionResult utl_Grid_Permission_Delete(int ID)
        {
            var db     = new utl_Grid_Permission_DAL();
            var result = db.utl_Grid_Permission_Delete(ID);

            if (result.IsSuccess == true)
            {
                result.Message = AppRes.MS_Update_success;
            }
            else
            {
                result.Message = AppRes.MS_Update_error;
            }
            return(Content(JsonConvert.SerializeObject(new
            {
                result
            })));
        }
Ejemplo n.º 3
0
        public ActionResult TableServerSideGetData(int pageIndex, int pageSize, string filter = "")
        {
            var db       = new utl_Grid_Permission_DAL();
            int total    = 0;
            int Language = Global.CurrentLanguage;
            var result   = db.utl_Grid_Permission_GetList(pageIndex, pageSize, filter, out total, Language);
            var lstTotal = new TableColumnsTotalModel();

            lstTotal.Total1 = "15";
            lstTotal.Total2 = "25";
            lstTotal.Total3 = "35";
            return(Content(JsonConvert.SerializeObject(new
            {
                employees = result,
                totalCount = total,
                lstTotal = lstTotal
            })));
        }