public JsonResult TimesheetLoadData()
        {
            List <object> obj = new List <object>();

            try
            {
                var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
                using (var clientContext = spContext.CreateUserClientContextForSPHost())
                {
                    List <TIM_TaskModel>            lstTask            = new List <TIM_TaskModel>();
                    List <TIM_SubTaskModel>         lstSubTask         = new List <TIM_SubTaskModel>();
                    List <TIM_TimesheetParentModel> lstTimesheetParent = BalParentTimesheet.GetEmpTimesheetByEmpId(clientContext, BalEmp.GetEmpByLogIn(clientContext));
                    lstTask         = BalTask.GetAllTask(clientContext, BalEmp.GetEmpByLogIn(clientContext));
                    lstSubTask      = BalSubTask.GetAllSubTask(clientContext, BalEmp.GetEmpByLogIn(clientContext));
                    ViewBag.AllTask = lstTask.Cast <object>().Concat(lstSubTask).ToList();

                    ViewBag.Setting = BalSetting.GetSettingData(clientContext);


                    obj.Add("OK");
                    obj.Add(lstTimesheetParent);
                    obj.Add(ViewBag.AllTask);
                    obj.Add(ViewBag.Setting);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("An error occured while performing action. GUID: {0}", ex.ToString()));
            }
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
        public JsonResult LoadTimesheetData()
        {
            List <object> obj = new List <object>();

            try
            {
                var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
                using (var clientContext = spContext.CreateUserClientContextForSPHost())
                {
                    List <TIM_TimesheetParentModel> lstTimesheetParent = BalTimesheetParent.GetEmpTimesheetByManagerId(clientContext, BalEmp.GetEmpByLogIn(clientContext));
                    obj.Add("OK");
                    obj.Add(lstTimesheetParent);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("An error occured while performing action. GUID: {0}", ex.ToString()));
            }
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetReportData(string From, string To)
        {
            List <object> obj = new List <object>();

            try
            {
                var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
                using (var clientContext = spContext.CreateUserClientContextForSPHost())
                {
                    List <TIM_EmployeeTimesheetModel> lstEmployeeTimesheet = new List <TIM_EmployeeTimesheetModel>();
                    lstEmployeeTimesheet = BalEmpTimesheet.GetEmpTimesheetByEmpIdAndDateFilter(clientContext, BalEmp.GetEmpByLogIn(clientContext), From, To);
                    if (lstEmployeeTimesheet.Count > 0)
                    {
                        obj.Add("OK");
                        obj.Add(lstEmployeeTimesheet);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("An error occured while performing action. GUID: {0}", ex.ToString()));
            }

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }