Esempio n. 1
0
        public ActionResult SaveStatus(int taskstatusId, string Comments, string UploadedFileUrl, int TskId, int ProjectId, string TaskName, int Flag, int UpdateFlag)
        {
            Dictionary <string, string> outData = new Dictionary <string, string>();

            NuPortalProjectService.NuPortalProject empService = new NuPortalProjectService.NuPortalProject();
            empService.Url = Constants.ProjectService;
            Common_Library.GeneralFunctions general = new Common_Library.GeneralFunctions();
            try
            {
                if (TskId != 0)
                {
                    string ReturnId = empService.ProjectTaskOper(TskId, ProjectId, TaskName, general.SetDateVal(""), general.SetDateVal(""), 0, "", taskstatusId, "", Comments,
                                                                 "", 0, UploadedFileUrl, DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpId"]), Convert.ToInt32(Session["EmpId"]), 1, 3, Flag, UpdateFlag);
                    if (ReturnId != string.Empty)
                    {
                        return(Json(ReturnId));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(Common_Library.Constants.JsonError));
            }
            finally
            {
                empService = null;
            }
            return(Json(Common_Library.Constants.JsonError));
        }
Esempio n. 2
0
        public JsonResult LoadTimeSheetGrid(int Id, int Operation, int OffSet, int RowCount)
        {
            Dictionary <string, string> outData = new Dictionary <string, string>();

            NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject();
            projectService.Url = Constants.ProjectService;
            Common_Library.GeneralFunctions gen = new Common_Library.GeneralFunctions();
            try
            {
                string JsonString = projectService.GetTimeSheetReport(Convert.ToString(Session["Resources"]),
                                                                      gen.SetDateVal(Convert.ToString(Session["StartDate"])),
                                                                      gen.SetDateVal(Convert.ToString(Session["EndDate"])), Id, OffSet, RowCount, Operation);
                if (JsonString != "")
                {
                    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;
            }
            finally
            {
                projectService = null;
                gen            = null;
            }
            outData = new Dictionary <string, string>();
            outData.Add("Error", "Error");
            return(Json(JsonConvert.SerializeObject(outData), JsonRequestBehavior.AllowGet));
        }
 public JsonResult UpdateNewEmployeeMail(string JsonStr, string Email)
 {
     NuPortalRecruitmentService.Recruitment     recService = new NuPortalRecruitmentService.Recruitment();
     NuPortalEmpService.NuPortalEmployeeService empService = new NuPortalEmpService.NuPortalEmployeeService();
     recService.Url = Constants.RecruitmentService;
     empService.Url = Constants.EmpService;
     Common_Library.GeneralFunctions general = new Common_Library.GeneralFunctions();
     try
     {
         DataTable NewEmpDetails = JsonConvert.DeserializeObject <DataTable>(JsonStr);
         string    jsonString    = recService.UspUpdateJoinedEmpolyee(Email, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(NewEmpDetails.Rows[0]["FK_NewAppId"]), 1);
         if (jsonString != string.Empty)
         {
             string JsonData = empService.CreateEmployee(Convert.ToString(NewEmpDetails.Rows[0]["FirstName"]), Convert.ToString(NewEmpDetails.Rows[0]["LastName"]), Convert.ToString(NewEmpDetails.Rows[0]["Title"]), Convert.ToString(NewEmpDetails.Rows[0]["EmployeeCode"]),
                                                         Convert.ToInt32(NewEmpDetails.Rows[0]["FK_DesignationId"]), Convert.ToInt32(NewEmpDetails.Rows[0]["Manager"]), Convert.ToString(NewEmpDetails.Rows[0]["ProfilePicUrl"]), Convert.ToString(NewEmpDetails.Rows[0]["QuotesPictureUrl"]),
                                                         Convert.ToString(NewEmpDetails.Rows[0]["BackGroundPicUrl"]), general.SetDateVal(Convert.ToString(NewEmpDetails.Rows[0]["HireDate"])), general.SetDateVal(Convert.ToString(NewEmpDetails.Rows[0]["ConfirmationDate"])), Email, Convert.ToInt32(NewEmpDetails.Rows[0]["OfficeLocation"]),
                                                         Convert.ToString(NewEmpDetails.Rows[0]["WorkLocation"]), Convert.ToInt32(NewEmpDetails.Rows[0]["FK_EmptTypeId"]), general.SetDateVal(Convert.ToString(NewEmpDetails.Rows[0]["RelievingDate"])), Convert.ToInt32(NewEmpDetails.Rows[0]["FK_CompanyId"]),
                                                         Convert.ToInt32(NewEmpDetails.Rows[0]["Fk_EmpStatus"]), DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(NewEmpDetails.Rows[0]["WeekOffDays"]), Convert.ToString(NewEmpDetails.Rows[0]["StartTime"]),
                                                         Convert.ToString(NewEmpDetails.Rows[0]["EndTime"]), Convert.ToString(NewEmpDetails.Rows[0]["QuotesText"]));
             if (!string.IsNullOrEmpty(JsonData))
             {
                 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
     {
         recService.Dispose(); empService.Dispose();
     }
     return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet));
 }
        public ActionResult addAllowance(float Amount, string AttachmentUrl, string StartDate,
                                         string EndDate, string Description, int CategoryId, int CategoryTypeId)
        {
            NuPortalRequestService.NuPortalRequestService requestService = new NuPortalRequestService.NuPortalRequestService();
            requestService.Url = Constants.RequestService;
            Common_Library.GeneralFunctions general = new Common_Library.GeneralFunctions();
            DateTime StartDateS;
            DateTime EndDateS;

            try
            {
                StartDateS = Convert.ToDateTime(StartDate);
                EndDateS   = general.SetDateVal(EndDate);

                bool IsSuccess = requestService.AddAllowanceReimbursement(Amount, AttachmentUrl, StartDateS,
                                                                          EndDateS, Description, CategoryId, CategoryTypeId, DateTime.Now, Convert.ToInt32(Session["EmpID"]), DateTime.Now, Convert.ToInt32(Session["EmpID"]), 1);

                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;
            }
            finally
            {
                requestService = null;
            }
            return(Json(Common_Library.Constants.JsonError));
        }
        public ActionResult EmpInfoAdminView(HttpPostedFileBase file, NuPortal.Models.EmpInfoAdminView empDetails, int?hdnId)
        {
            string path = string.Empty;

            Common_Library.GeneralFunctions            general    = new Common_Library.GeneralFunctions();
            NuPortalEmpService.NuPortalEmployeeService empService = new NuPortalEmpService.NuPortalEmployeeService();
            NuPortalRecruitmentService.Recruitment     recService = new NuPortalRecruitmentService.Recruitment();
            empService.Url = Constants.EmpService;
            recService.Url = Constants.RecruitmentService;
            Dictionary <string, int> dictEmpData = new Dictionary <string, int>();

            try
            {
                if (hdnId == null)
                {
                    //DateTime JDate= Convert.ToDateTime(DateTime.ParseExact(empDetails.joiningDate, "yyyy/MM/dd", null).ToString("dd/MM/yyyy"));
                    DateTime      JDate         = Convert.ToDateTime(DateTime.ParseExact(empDetails.joiningDate, "MM/dd/yyyy", null).ToString("yyyy/MM/dd"));
                    bool          IsSuccess     = false;
                    string[]      imageUrlArray = new string[] { };
                    string[]      quoteArray    = new string[] { };
                    StringBuilder sb            = new StringBuilder();
                    if (empDetails.applicantId == 0)
                    {
                        string JsonData = empService.CreateEmployee(empDetails.firstName, empDetails.lastName == null ? "" : empDetails.lastName, empDetails.titleId == null ? "" : empDetails.titleId,
                                                                    empDetails.employeeCode,
                                                                    Convert.ToInt32(empDetails.designationId), empDetails.reportingTo, empDetails.profilePicUrl == null ? "" : empDetails.profilePicUrl,
                                                                    empDetails.passPicUrl == null ? "" : empDetails.passPicUrl, empDetails.bgPicUrl == null ? "" : empDetails.bgPicUrl,
                                                                    JDate, general.SetDateVal(empDetails.confirmationDate), empDetails.officeEmailId,
                                                                    Convert.ToInt32(empDetails.officeLocationId), empDetails.workLocation == null ? "" : empDetails.workLocation,
                                                                    empDetails.employementId == null ? 0 : Convert.ToInt32(empDetails.employementId), general.SetDateVal(empDetails.relievingDate), 1, empDetails.employmentStatusId != null ? Convert.ToInt32(empDetails.employmentStatusId) : 0,
                                                                    DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), empDetails.weekOffDays,
                                                                    empDetails.workStartTime == null ? "" : empDetails.workStartTime, empDetails.workEndTime == null ? "" : empDetails.workEndTime, empDetails.quotes == null ? "" : empDetails.quotes);
                        dictEmpData = JsonConvert.DeserializeObject <Dictionary <string, int> >(JsonData);
                        if (!string.IsNullOrEmpty(empDetails.imageUrl) && dictEmpData["EmpId"] > 0)
                        {
                            imageUrlArray = empDetails.imageUrl.Split('|');
                            quoteArray    = empDetails.quoteText.Split('|');
                            sb.Append("[");
                            for (int i = 0; i < imageUrlArray.Length - 1; i++)
                            {
                                sb.Append("{\"FK_EmpId\":" + dictEmpData["EmpId"] + ",\"QuotesPictureUrl\":\"" + imageUrlArray[i] + "\",\"QuotesText\":\"" + quoteArray[i] + "\"},");
                            }
                            sb.Length--;
                            sb.Append("]");
                            IsSuccess = empService.SetEmpGallery(dictEmpData["EmpId"], Convert.ToString(sb).TrimEnd('}').TrimStart('{'));
                        }
                    }
                    else
                    {
                        var newId = recService.CreateJoinedEmployee(empDetails.applicantId, empDetails.firstName, empDetails.lastName == null ? "" : empDetails.lastName, empDetails.titleId == null ? "" : empDetails.titleId,
                                                                    empDetails.employeeCode, Convert.ToInt32(empDetails.designationId), empDetails.reportingTo, empDetails.profilePicUrl == null ? "" : empDetails.profilePicUrl,
                                                                    empDetails.passPicUrl == null ? "" : empDetails.passPicUrl, empDetails.bgPicUrl == null ? "" : empDetails.bgPicUrl, JDate, general.SetDateVal(empDetails.confirmationDate), empDetails.officeEmailId == null ? "" : empDetails.officeEmailId,
                                                                    Convert.ToInt32(empDetails.officeLocationId), empDetails.workLocation == null ? "" : empDetails.workLocation, empDetails.employementId == null ? 0 : Convert.ToInt32(empDetails.employementId), general.SetDateVal(empDetails.relievingDate), 1, empDetails.employmentStatusId != null ? Convert.ToInt32(empDetails.employmentStatusId) : 0,
                                                                    DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), empDetails.weekOffDays,
                                                                    empDetails.workStartTime == null ? "" : empDetails.workStartTime, empDetails.workEndTime == null ? "" : empDetails.workEndTime, empDetails.quotes == null ? "" : empDetails.quotes);
                        if (!string.IsNullOrEmpty(newId))
                        {
                            IsSuccess = true;
                        }
                    }
                    if (empDetails.applicantId == 0 && dictEmpData["EmpId"] > 0 && dictEmpData["MailStatus"] == 1)
                    {
                        ModelState.Clear();
                        ViewBag.Message = "Employee Created Successfully";
                    }
                    else if (empDetails.applicantId == 0 && dictEmpData["EmpId"] > 0 && dictEmpData["MailStatus"] == 0)
                    {
                        ViewBag.Message = "Error in sending mail";
                    }
                    else if (empDetails.applicantId > 0 && IsSuccess)
                    {
                        ModelState.Clear();
                        ViewBag.Message = "Employee Created Successfully";
                    }
                    else
                    {
                        ViewBag.Message = "Error in saving data";
                    }
                }
            }
            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
            {
                empDetails  = null;
                empService  = null;
                general     = null;
                dictEmpData = null;
            }
            return(EmpInfoAdminView(hdnId));
        }