Esempio n. 1
0
        public void TMSEmployeeExportExcel(string searchprm, int PageSize)
        {
            EMPTMSPara ObjPara = JsonConvert.DeserializeObject <EMPTMSPara>(searchprm,
                                                                            new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                DateFormatString  = "dd/MM/yyyy"
            });

            ObjPara.OrderBy        = "EmployeeNo";
            ObjPara.OrderDirection = "Desc";
            ObjPara.Page           = 1;
            ObjPara.PageSize       = PageSize;
            DataTable dt = new DataTable();

            dt = ReportManager.EmployeeTMSSummaryReport(ObjPara);
            string fileName = "TMS_Employee_Summary_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");

            string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" };
            for (int i = 0; i < RemoveColumn.Length; i++)
            {
                if (dt.Columns.Contains(RemoveColumn[i]))
                {
                    dt.Columns.Remove(RemoveColumn[i]);
                }
            }
            List <ExcelCellModel> listd = new List <ExcelCellModel>();

            ExcelCellModel ex          = new ExcelCellModel();
            DateTime       mytime      = ObjPara.FromDate.Value;
            List <int>     columnIndex = new List <int>();
            int            b           = 9;

            for (DateTime day = ObjPara.FromDate.Value; day < ObjPara.ToDate.Value; day = day.AddDays(1.0))
            {
                if (BDatetime.isWeekDay(day))
                {
                    columnIndex.Add(b);
                }
                b = b + 1;
            }

            ex.BackgroundColorInfo.ColunmIndex     = columnIndex;
            ex.BackgroundColorInfo.BackgorundColor = XLColor.FromHtml("#FFFFCC");
            ex.BackgroundColorInfo.FontColor       = XLColor.Black;
            //ex. = XLColor.Black;// CellValue(0,PageSize)

            listd.Add(ex);
            FileInputHelper.ExportExcel(dt, fileName, "TMS Employee Summary", true, listd);
            //  return fileName;
        }
Esempio n. 2
0
        public static System.Data.DataTable EmployeeTMSSummaryReport(EMPTMSPara WebPara)
        {
            System.Data.DataTable items = new System.Data.DataTable();

            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PostAsJsonAsync(string.Format("Report?Event=tms"), WebPara).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <System.Data.DataTable>().GetAwaiter().GetResult();
                }
            }

            return(items);
        }
Esempio n. 3
0
        public ContentResult GetEmpTMS([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)//, int EntityID = 10002,  DateTime? fromdate = null, DateTime? todate = null)
        {
            EMPTMSPara ObjPara = JsonConvert.DeserializeObject <EMPTMSPara>(searchprm,
                                                                            new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore,
                DateFormatString  = "dd/MM/yyyy"
            });

            //EMPTMSPara SearchKey = new EMPTMSPara()
            //{
            //    EntityID = 10002,
            //    DeptID = 0,
            //    @FromDate = fromdate ,
            //    @ToDate = todate,
            //    OrderBy = "EmployeeNo",
            //    OrderDirection = "DESC",
            //    Page = (requestModel.Start / requestModel.Length) + 1,
            //    PageSize = requestModel.Length,
            //};
            //fromdate = fromdate == null ? SystemConfig.CurrentDate : fromdate;
            //todate = todate == null ? SystemConfig.CurrentDate : todate;
            ObjPara.OrderBy        = "DeptName";
            ObjPara.OrderDirection = "ASC";
            ObjPara.Page           = (requestModel.Start / requestModel.Length) + 1;
            ObjPara.PageSize       = requestModel.Length;
            DataTable collection = new DataTable();

            collection = ReportManager.EmployeeTMSSummaryReport(ObjPara);
            int TotalRecord = 0;

            if (collection.Rows.Count > 0)
            {
                TotalRecord = Convert.ToInt32(collection.Rows[0]["TotalRecord"]);
            }

            IEnumerable <DataRow> rows = collection.AsEnumerable().ToList();
            object temp = new object();

            foreach (var item in rows)
            {
                temp = item.Table;
            }
            //DataTablesResponseExtend results = new DataTablesResponseExtend(requestModel.Draw, temp, TotalRecord, TotalRecord);
            return(Content(JsonConvert.SerializeObject(new DataTablesResponseExtend(requestModel.Draw, temp, TotalRecord, TotalRecord)), "application/json"));
        }
Esempio n. 4
0
 public System.Data.DataTable Post(EMPTMSPara objPara, string Event)
 {
     return(MissingScanTimeManager.EmployeeTMSReport(objPara));
 }