Ejemplo n.º 1
0
 public ActionResult saveOfficePollResult(string jsonOptions)
 {
     NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
     hrService.Url = Constants.HRService;
     try
     {
         bool IsSuccess = hrService.SaveOptionsPollResult(jsonOptions);
         if (IsSuccess)
         {
             return(Json(Common_Library.Constants.JsonSuccess));
         }
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
         return(Json(Common_Library.Constants.JsonError));
     }
     finally
     {
         hrService = null;
     }
     return(Json(Common_Library.Constants.JsonError));
 }
 public JsonResult CheckIfLeaveApplied(string LeaveStartDate, string LeaveEndDate, int Operation)
 {
     NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
     hrService.Url = Constants.HRService;
     try
     {
         string jsonData = hrService.GetDataForCalendar(Convert.ToInt32(Session["EmpID"]), Convert.ToDateTime(LeaveStartDate), Convert.ToDateTime(LeaveEndDate), Operation);
         if (jsonData != string.Empty)
         {
             return(Json(jsonData, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
     }
     finally
     {
         hrService = null;
     }
     return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 3
0
 public ActionResult savePollResultTextBox(int QuestionId, string TextValue, int Operation)
 {
     NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
     hrService.Url = Constants.HRService;
     try
     {
         bool IsSuccess = hrService.SaveTbPollResult(QuestionId, TextValue, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), Operation);
         if (IsSuccess)
         {
             return(Json(Common_Library.Constants.JsonSuccess));
         }
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
         return(Json(Common_Library.Constants.JsonError));
     }
     finally
     {
         hrService = null;
     }
     return(Json(Common_Library.Constants.JsonError));
 }
Ejemplo n.º 4
0
        public ActionResult saveOfficePoll(string Title, string Note, string AttachmentPath, DateTime EndDate)
        {
            NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
            hrService.Url = Constants.HRService;
            try
            {
                string jsonString = hrService.SaveOfficePoll(Title, Note, Convert.ToInt32(Session["CompanyId"]), AttachmentPath,
                                                             Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), EndDate, 0, 1, 1);
                if (jsonString != string.Empty)
                {
                    return(Json(jsonString, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                GeneralFunctions genFun = new GeneralFunctions();
                genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                                Convert.ToString(ControllerContext.RouteData.Values["action"]),
                                Convert.ToString(ControllerContext.RouteData.Values["controller"]));
                genFun = null;
                return(Json(Common_Library.Constants.JsonError));
            }
            finally
            {
                hrService = null;
            }

            return(Json(Common_Library.Constants.JsonError));
        }
Ejemplo n.º 5
0
        public ActionResult saveQuestion(int PollId, int QuestionTypeId, string Question)
        {
            NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
            hrService.Url = Constants.HRService;
            try
            {
                string jsonString = hrService.SaveQuestion(PollId, QuestionTypeId, Question, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), 2);
                if (jsonString != string.Empty)
                {
                    return(Json(jsonString, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                GeneralFunctions genFun = new GeneralFunctions();
                genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                                Convert.ToString(ControllerContext.RouteData.Values["action"]),
                                Convert.ToString(ControllerContext.RouteData.Values["controller"]));
                genFun = null;
                return(Json(Common_Library.Constants.JsonError));
            }
            finally
            {
                hrService = null;
            }

            return(Json(Common_Library.Constants.JsonError));
        }
Ejemplo n.º 6
0
        public ActionResult EditTickets(int idval, int Operation)
        {
            NuPortalHRService.NuPortalHRService hrservice = new NuPortalHRService.NuPortalHRService();
            hrservice.Url = Constants.HRService;

            try
            {
                string jsonString = hrservice.UpdateTrainingTicket(0, 0, Convert.ToInt32(Session["EmpID"]), idval, Convert.ToInt32(Session["EmpID"]), 0, 0, Operation);
                if (jsonString != string.Empty)
                {
                    return(Json(jsonString, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                GeneralFunctions genFun = new GeneralFunctions();
                genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                                Convert.ToString(ControllerContext.RouteData.Values["action"]),
                                Convert.ToString(ControllerContext.RouteData.Values["controller"]));
                genFun = null;
                return(Json(Common_Library.Constants.JsonError));
            }
            finally
            {
                hrservice = null;
            }

            return(Json(Common_Library.Constants.JsonError));
        }
Ejemplo n.º 7
0
        public JsonResult updateTrainingDetails(int id, string Subject, int Trainer, DateTime StartDate, DateTime EndDate, string StartTime, string EndTime, string Details, string Attachment)
        {
            NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
            hrService.Url = Constants.HRService;
            try
            {
                string jsonString = hrService.SaveTraining(id, Attachment, Convert.ToInt32(Session["EmpID"]), Details, EndDate, EndTime, Convert.ToInt32(Session["CompanyID"]),
                                                           Trainer, 0, Convert.ToInt32(Session["EmpID"]), StartDate, StartTime, 1, Subject, 2);
                if (jsonString != string.Empty)
                {
                    return(Json(jsonString, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                GeneralFunctions genFun = new GeneralFunctions();
                genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                                Convert.ToString(ControllerContext.RouteData.Values["action"]),
                                Convert.ToString(ControllerContext.RouteData.Values["controller"]));
                genFun = null;
                return(Json(Common_Library.Constants.JsonError));
            }
            finally
            {
                hrService = null;
            }

            return(Json(Common_Library.Constants.JsonError));
        }
Ejemplo n.º 8
0
 public ActionResult UpdateAnnouncement(string Title, string UploadedFileUrl, string StartDate, string EndDate, string Description,
                                        int announcementId)
 {
     NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
     hrService.Url = Constants.HRService;
     try
     {
         string jsonString = hrService.AnnouncementOrEventsOper(announcementId, UploadedFileUrl, Convert.ToInt32(Session["EmpID"]),
                                                                Description, Convert.ToDateTime(EndDate), Convert.ToInt32(Session["CompanyId"]),
                                                                Convert.ToInt32(Session["EmpID"]), Convert.ToDateTime(StartDate), 1, Title, string.Empty, string.Empty, 3);
         if (jsonString != string.Empty)
         {
             return(Json(jsonString, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
         return(Json(Common_Library.Constants.JsonError));
     }
     finally
     {
         hrService = null;
     }
     return(Json(Common_Library.Constants.JsonError));
 }
Ejemplo n.º 9
0
 public JsonResult DeleteOfficePoll(int PollId, int Operation)
 {
     NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
     hrService.Url = Constants.HRService;
     try
     {
         string jsonString = hrService.DeleteOfficePoll(PollId, Operation);
         if (jsonString != string.Empty)
         {
             return(Json(jsonString, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         GeneralFunctions genFun = new GeneralFunctions();
         genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                         Convert.ToString(ControllerContext.RouteData.Values["action"]),
                         Convert.ToString(ControllerContext.RouteData.Values["controller"]));
         genFun = null;
         return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
     }
     finally
     {
         hrService = null;
     }
     return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
 }
        public JsonResult GetAllLeaves(int month, int year)
        {
            NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
            hrService.Url = Constants.HRService;
            DataTable events      = new DataTable();
            DataTable monthEvents = new DataTable();

            try
            {
                DateTime monthStart = new DateTime(year, month, 1);
                DateTime monthEnd   = new DateTime(year, month, DateTime.DaysInMonth(year, month));
                monthStart = monthStart.AddDays(DayOfWeek.Sunday - monthStart.DayOfWeek);
                monthEnd   = monthEnd.AddDays(DayOfWeek.Saturday - monthEnd.DayOfWeek);
                events     = JsonConvert.DeserializeObject <DataTable>(hrService.GetDataForCalendar(Convert.ToInt32(Session["EmpID"]), monthStart, monthEnd, 2));

                monthEvents.Columns.Add("EventDate");
                monthEvents.Columns.Add("Name");
                monthEvents.Columns.Add("Month");
                if (events != null && events.Rows.Count > 0)
                {
                    foreach (DataRow row in events.Rows)
                    {
                        if (Convert.ToDateTime(row["LeaveStartDate"]) <= monthEnd && Convert.ToDateTime(row["LeaveEndDate"]) >= monthStart)
                        {
                            for (DateTime dt = Convert.ToDateTime(row["LeaveStartDate"]); dt <= Convert.ToDateTime(row["LeaveEndDate"]); dt = dt.AddDays(1))
                            {
                                if (dt >= monthStart && dt <= monthEnd)
                                {
                                    monthEvents.Rows.Add(dt.ToString("yyyy/MM/dd"), Convert.ToString(row["FirstName"]) + " " + Convert.ToString(row["LastName"]), dt.Month == month ? "currentmonth" : dt.Month <= month ? "prevmonth" : "nextmonth");
                                }
                            }
                        }
                    }
                }
                return(Json(JsonConvert.SerializeObject(monthEvents), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                GeneralFunctions genFun = new GeneralFunctions();
                genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                                Convert.ToString(ControllerContext.RouteData.Values["action"]),
                                Convert.ToString(ControllerContext.RouteData.Values["controller"]));
                genFun = null;
            }
            finally
            {
                hrService   = null;
                events      = null;
                monthEvents = null;
            }
            return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 11
0
        public JsonResult GetLeaveCalendar(int Id, int year, int month)
        {
            NuPortalHRService.NuPortalHRService hrService = new NuPortalHRService.NuPortalHRService();
            hrService.Url = Constants.HRService;
            DataTable leave      = new DataTable();
            DataTable monthLeave = new DataTable();

            try
            {
                DateTime monthStart = new DateTime(year, month, 1);
                DateTime monthEnd   = new DateTime(year, month, DateTime.DaysInMonth(year, month));
                monthStart = monthStart.AddDays(DayOfWeek.Sunday - monthStart.DayOfWeek);
                monthEnd   = monthEnd.AddDays(DayOfWeek.Saturday - monthEnd.DayOfWeek);
                leave      = JsonConvert.DeserializeObject <DataTable>(hrService.GetDataForCalendar(Id, monthStart, monthEnd, 5));


                monthLeave.Columns.Add("DisplayName");
                monthLeave.Columns.Add("Date");
                monthLeave.Columns.Add("Month");
                monthLeave.Columns.Add("TaskStatus");

                if (leave != null && leave.Rows.Count > 0)
                {
                    foreach (DataRow row in leave.Rows)
                    {
                        if (Convert.ToDateTime(row["LeaveStartDate"]) <= monthEnd && Convert.ToDateTime(row["LeaveEndDate"]) >= monthStart)
                        {
                            for (DateTime dt = Convert.ToDateTime(row["LeaveStartDate"]); dt <= Convert.ToDateTime(row["LeaveEndDate"]); dt = dt.AddDays(1))
                            {
                                if (dt >= monthStart && dt <= monthEnd)
                                {
                                    monthLeave.Rows.Add(row["DisplayName"], dt.ToString("yyyy/MM/dd"), dt.Month == month ? "currentmonth" : dt.Month <= month ? "prevmonth" : "nextmonth", row["StatusId"]);
                                }
                            }
                        }
                    }
                }
                return(Json(JsonConvert.SerializeObject(monthLeave), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                GeneralFunctions genFun = new GeneralFunctions();
                genFun.LogError(ControllerContext.HttpContext, ex.Message, ex.TargetSite.Name,
                                Convert.ToString(ControllerContext.RouteData.Values["action"]),
                                Convert.ToString(ControllerContext.RouteData.Values["controller"]));
                genFun = null;
                return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
            }
            finally { hrService.Dispose(); monthLeave.Dispose(); }
        }