public JsonResult AllManagerInfoList(string startDate = "", string endDate = "", string Empid = "", int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
 {
     try
     {
         try
         {
             ManagerinfoEntity _Model = new ManagerinfoEntity();
             _Model.EMPID = Empid;
             _Model.StartDate = startDate;
             _Model.EndDate = endDate;
             DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetAllManagerInfoRecord, _Model);
             List<ManagerinfoEntity> ItemList = null;
             ItemList = new List<ManagerinfoEntity>();
             int iCount = 0;
             int offset = 0;
             offset = jtStartIndex / jtPageSize;
             foreach (DataRow dr in dt.Rows)
             {
                 if (iCount >= jtStartIndex && iCount < (jtPageSize * (offset + 1)))
                 {
                     ItemList.Add(new ManagerinfoEntity()
                     {
                         PDate = dr["PDate"].ToString(),
                         EMPID = dr["EMPID"].ToString(),
                         EName = dr["EName"].ToString(),
                         Designation = dr["Designation"].ToString(),
                         DeptName = dr["DeptName"].ToString(),
                         Intime = dr["Intime"].ToString(),
                         Outtime = dr["Outtime"].ToString(),
                         Status = dr["Status"].ToString(),
                     });
                 }
                 iCount += 1;
             }
             var RecordCount = dt.Rows.Count;
             var Record = ItemList;
             Session["INDMGR"] = ItemList;
             return Json(new { Result = "OK", Records = Record, TotalRecordCount = RecordCount });
         }
         catch (Exception ex)
         {
             return Json(new { Result = "ERROR", Message = ex.Message });
         }
     }
     catch (Exception ex)
     {
         return Json(new { Result = "ERROR", Message = ex.Message });
     }
 }
 public ActionResult ManagerDept()
 {
     ManagerinfoEntity Model = new ManagerinfoEntity();
     ViewData["DeptName"] = GetAllDepatementListItem();
     Model.StartDate = DateTime.Today.ToString("dd/MM/yyyy");
     Model.EndDate = DateTime.Today.Date.ToString("dd/MM/yyyy");
     return View(Model);
 }
 public ActionResult MgrwiseExcel(string EX1 = "", string EX2 = "", string EX3 = "")
 {
     // DataTable dt = -- > get your data
     ManagerinfoEntity _Model = new ManagerinfoEntity();
     _Model.StartDate = EX1;
     _Model.EndDate = EX2;
     _Model.EMPID = EX3;
     DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetAllManagerInfoRecord, _Model);
     ERP.Utility.Excelimport.ExcelFileResult actionResult = new ERP.Utility.Excelimport.ExcelFileResult(dt) { FileDownloadName = "MgrempwiseExcel.xls" };
     return actionResult;
 }
 public ActionResult ManagerWise()
 {
     ManagerinfoEntity Model = new ManagerinfoEntity();
     ViewData["EMPID"] = GetAllManagerListItem();
     Model.StartDate = DateTime.Today.ToString("dd/MM/yyyy");
     Model.EndDate = DateTime.Today.Date.ToString("dd/MM/yyyy");
     return View(Model);
 }
        public ActionResult ManagerRPTEXCELall(string startDate = "", string endDate="")
        {
            ManagerinfoEntity _Model = new ManagerinfoEntity();
            _Model.StartDate = startDate;
            _Model.EndDate = endDate;
            ALLManagerrptEntity obj;

            ReportClass rptH = new ReportClass();
            ArrayList al = new ArrayList();
            rptH.FileName = Server.MapPath("/Reports/ALLManagerrpt.rpt");
            rptH.Load();

            DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetManagerRecord, _Model);
            List<ManagerinfoEntity> ItemList = null;
            ItemList = new List<ManagerinfoEntity>();

            foreach (DataRow dr in dt.Rows)
            {

                    ItemList.Add(new ManagerinfoEntity()
                    {
                        PDate = dr["PDate"].ToString(),
                        EMPID = dr["EMPID"].ToString(),
                        EName = dr["EName"].ToString(),
                        Designation = dr["Designation"].ToString(),
                        DeptName = dr["DeptName"].ToString(),
                        Intime = dr["Intime"].ToString(),
                        Outtime = dr["Outtime"].ToString(),
                        Status = dr["Status"].ToString(),
                    });

            }
            foreach (ManagerinfoEntity dr in ItemList)
            {
                obj = new ALLManagerrptEntity();

                obj.PDate = dr.PDate;
                obj.EMPID = dr.EMPID;
                obj.EName = dr.EName;
                obj.Designation = dr.Designation;
                obj.DeptName = dr.DeptName;
                obj.Intime = dr.Intime;
                obj.Outtime = dr.Outtime;
                obj.Status = dr.Status;
                al.Add(obj);
            }

            rptH.SetDataSource(al);
            MemoryStream stream = (MemoryStream)rptH.ExportToStream(ExportFormatType.Excel);
            return File(stream, "application/octet-stream", "ManagerAttend.xls");
        }
 public ActionResult ManagerInfo()
 {
     ManagerinfoEntity Model = new ManagerinfoEntity();
     Model.StartDate = DateTime.Today.ToString("dd/MM/yyyy");
     Model.EndDate = DateTime.Today.Date.ToString("dd/MM/yyyy");
     return View(Model);
 }
 //public ActionResult MGRExcelReport(string startDate = "", string endDate = "")
 // {
 //      ManagerinfoEntity _Model = new ManagerinfoEntity();
 //     _Model.StartDate = startDate;
 //     _Model.EndDate = endDate;
 //     DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetManagerRecord, _Model);
 //     StringBuilder sb = new StringBuilder();
 //     sb.Append("<table border='" + "2px" + "'b>");
 //     //write column headings
 //     sb.Append("<tr>");
 //     foreach (System.Data.DataColumn dc in dt.Columns)
 //     {
 //         sb.Append("<td><b><font face=Arial size=2>" + dc.ColumnName + "</font></b></td>");
 //     }
 //     sb.Append("</tr>");
 //     foreach (System.Data.DataRow dr in dt.Rows)
 //     {
 //         sb.Append("<tr>");
 //         foreach (System.Data.DataColumn dc in dt.Columns)
 //         {
 //             sb.Append("<td><font face=Arial size=" + "14px" + ">" + dr[dc].ToString() + "</font></td>");
 //         }
 //         sb.Append("</tr>");
 //     }
 //     sb.Append("</table>");
 //     //this.Response.AddHeader("Content-Disposition", "Employees.xls");
 //     this.Response.ContentType = "application/vnd.ms-excel";
 //     byte[] buffer = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
 //     return File(buffer, "application/vnd.ms-excel", "MGRAttendance.xls");
 // }
 public ActionResult MGRExcelReport(string startDate = "", string endDate = "")
 {
     ManagerinfoEntity _Model = new ManagerinfoEntity();
     _Model.StartDate = startDate;
     _Model.EndDate = endDate;
     DataTable dt = (DataTable)ExecuteDB(ERPTask.AG_GetManagerRecord, _Model);
     ERP.Utility.Excelimport.ExcelFileResult actionResult = new ERP.Utility.Excelimport.ExcelFileResult(dt) { FileDownloadName = "MGRAttendance.xls" };
     return actionResult;
 }