public JsonResult SendEmailToResource(int ProjId, string EmpId, int OperationId) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { string jsonString = projectService.SendMailToResource(ProjId, EmpId, Convert.ToInt32(Session["EmpID"]), OperationId); 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 { projectService = null; } return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateClientInfo1(int contactId, string ContactPerson, string ContactNumber, string Extension, string Mobile, string Designation, string Email, string Fax, string Department) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { bool IsSuccess = projectService.UpdateContact(contactId, ContactPerson, ContactNumber, Extension, Mobile, Designation, Email, Fax, Department, 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; return(Json(Common_Library.Constants.JsonError)); } finally { projectService = null; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult UpdateClientInfo(int clientId, string CompanyName, string Website, string PurchaseOrderNumber, String CompanyLogo) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { bool IsSuccess = projectService.UpdateClient(clientId, CompanyName, Website, PurchaseOrderNumber, CompanyLogo, 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; return(Json(Common_Library.Constants.JsonError)); } finally { projectService = null; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult SaveNewClientAddress(int ClientId, string jsonData) { DataTable data = JsonConvert.DeserializeObject <DataTable>(jsonData); NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { bool IsSuccess = projectService.SetClientAddress(ClientId, jsonData); 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 { projectService = null; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult SaveNewClient(string CompanyName, string Website, string PurchaseOrder, string CompanyLogo) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { string ReturnId = projectService.CreateClient(Convert.ToInt32(Session["CompanyId"]), CompanyName, Website, PurchaseOrder, CompanyLogo, DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), 1); if (ReturnId != string.Empty) { return(Json(ReturnId)); } } 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 { projectService = null; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult SaveDocResources(int DocID, string jsonData, string EmpIdData) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { bool IsSuccess = projectService.SetCustomDocuments(DocID, jsonData, EmpIdData); 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 { projectService = null; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult addUserDocument(string DocumentName, int ProjectName, int SharedWith, string Description, string Attachment) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { string jsonString = projectService.ProjectDocumentsOper(0, ProjectName, DocumentName, SharedWith, 0, Description, Attachment, DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), 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, JsonRequestBehavior.AllowGet)); } finally { projectService = null; } return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet)); }
public JsonResult GetOpportunityDetails(string OppIds) { Dictionary <string, string> outData = new Dictionary <string, string>(); NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { string JsonString = projectService.GetTimeSheetReport(OppIds, DateTime.Now, DateTime.Now, 0, 0, 500, 3); 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; } outData = new Dictionary <string, string>(); outData.Add("Error", "Error"); return(Json(JsonConvert.SerializeObject(outData), JsonRequestBehavior.AllowGet)); }
public void UpdateManager(int projID, string jsonData) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; DataTable dt = new DataTable(), data = new DataTable(); try { dt = JsonConvert.DeserializeObject <DataTable>(jsonData); data.Columns.Add("FKProjectId", typeof(int)); data.Columns.Add("FKManagers", typeof(int)); data.Columns.Add("Status", typeof(int)); foreach (DataRow row in dt.Rows) { data.Rows.Add(projID, Convert.ToInt32(row["id"]), 1); } string temp = JsonConvert.SerializeObject(data); bool result = projectService.SetMangersForProjects(projID, JsonConvert.SerializeObject(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 { projectService.Dispose(); } }
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 ActionResult UpdateTask(string TaskName, string StartDate, string EndDate, float PlannedHours, string ProjectPhase, int taskstatusId, string TaskDetails, string Comments, string Priority, int Billable, string UploadedFileUrl, int TskId, int ProjectId, int UpdateFlag) { Dictionary <string, string> outData = new Dictionary <string, string>(); NuPortalProjectService.NuPortalProject empService = new NuPortalProjectService.NuPortalProject(); empService.Url = Constants.ProjectService; try { string ReturnId = empService.ProjectTaskOper(TskId, ProjectId, TaskName, Convert.ToDateTime(StartDate), Convert.ToDateTime(EndDate), PlannedHours, ProjectPhase, taskstatusId, TaskDetails, Comments, Priority, Billable, UploadedFileUrl, DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpId"]), Convert.ToInt32(Session["EmpId"]), 1, 2, 1, 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)); }
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)); }
public ActionResult NewContacts(NuPortal.Models.NewContacts contacts, string submit = null) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { //if (ModelState.IsValid) //{ bool IsSuccess = projectService.CreateContact(contacts.ClientId, contacts.ContactPerson, contacts.ContactNumber == null ? "" : contacts.ContactNumber, contacts.extn == null ? "": contacts.extn, contacts.Mobile == null?"": contacts.Mobile, contacts.Designation == null?"": contacts.Designation, contacts.Email == null?"": contacts.Email, contacts.Fax == null?"": contacts.Fax, contacts.Department == null?"": contacts.Department, DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), 1); if (IsSuccess) { ModelState.Clear(); ViewBag.saveMessage = "Contact Created Successfully"; if (submit == "Save") { return(RedirectToAction("Projects", "Projects")); } } else { ViewBag.validationMessage = "Error in saving data"; } //} //else // ViewBag.validationMessage = "Please fill mandatory fields!"; } 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 { contacts = null; projectService = null; } return(NewContacts()); }
public ActionResult SaveResources(int taskID, string jsonData, string EmpIdData) { NuPortalProjectService.NuPortalProject prjService = new NuPortalProjectService.NuPortalProject(); prjService.Url = Constants.ProjectService; try { DataTable data = JsonConvert.DeserializeObject <DataTable>(jsonData); bool IsSuccess = prjService.SetResourceForTask(taskID, jsonData, EmpIdData); if (IsSuccess) { return(Json(Common_Library.Constants.JsonSuccess)); } } catch (Exception ex) { return(Json(Common_Library.Constants.JsonError)); } finally { prjService = null; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult SubmitTimesheet(string ids, string jsonStr) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; try { bool isSuccess = projectService.SetTaskDetails(ids, jsonStr); 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 { projectService.Dispose(); } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult CreateProject(int projID, string jsonData) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; DataTable dt = new DataTable(); string IsSuccess = string.Empty; try { dt = JsonConvert.DeserializeObject <DataTable>(jsonData); if (dt != null && dt.Rows.Count > 0) { DataRow data = dt.Rows[0]; int ClientId = string.IsNullOrEmpty(Convert.ToString(data["ClientId"])) ? 0 : Convert.ToInt32(data["ClientId"]); int ContactId = string.IsNullOrEmpty(Convert.ToString(data["ContactId"])) ? 0 : Convert.ToInt32(data["ContactId"]); int Hours = string.IsNullOrEmpty(Convert.ToString(data["PlannedHours"])) ? 0 : Convert.ToInt32(data["PlannedHours"]); int DeptId = string.IsNullOrEmpty(Convert.ToString(data["DepartmentId"])) ? 0 : Convert.ToInt32(data["DepartmentId"]); //DateTime EndDate = string.IsNullOrEmpty(Convert.ToString(data["EndDate"])) ? Convert.ToDateTime(data["StartDate"]):Convert.ToDateTime(data["EndDate"]); if (projID == 0) { IsSuccess = projectService.CreateProject(Convert.ToInt32(Session["CompanyId"]), ClientId, ContactId, Convert.ToString(data["ProjectName"]), Convert.ToString(data["ProjectDescription"]), Convert.ToDateTime(data["StartDate"]), Convert.ToDateTime(data["EndDate"]), Convert.ToString(data["URL"]), Convert.ToString(data["Priority"]), Convert.ToString(data["Status"]), Convert.ToString(data["ProjectType"]), Convert.ToString(data["ProjectCategory"]), Hours, DeptId, Convert.ToString(data["CostCentre"]), Convert.ToString(data["Technologies"]), Convert.ToString(data["Attachments"]), DateTime.Now, DateTime.Now, Convert.ToInt32(Session["EmpID"]), Convert.ToInt32(Session["EmpID"]), 1); if (!string.IsNullOrEmpty(IsSuccess)) { return(Json(IsSuccess)); } } else { bool isSuccess = projectService.UpdateProject(projID, ClientId, ContactId, Convert.ToString(data["ProjectName"]), Convert.ToString(data["ProjectDescription"]), Convert.ToDateTime(data["StartDate"]), Convert.ToDateTime(data["EndDate"]), Convert.ToString(data["URL"]), Convert.ToString(data["Priority"]), Convert.ToString(data["Status"]), Convert.ToString(data["ProjectType"]), Convert.ToString(data["ProjectCategory"]), Hours, DeptId, Convert.ToString(data["CostCentre"]), Convert.ToString(data["Technologies"]), Convert.ToString(data["Attachments"]), DateTime.Now, Convert.ToInt32(Session["EmpID"]), 1); if (isSuccess) { return(Json("[{\"ProjectId\":\"" + projID + "\"}]")); } } } else { return(Json("{\"Result\":\"Empty 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; return(Json(ex.ToString())); } finally { projectService.Dispose(); dt.Dispose(); IsSuccess = string.Empty; } return(Json(Common_Library.Constants.JsonError)); }
public ActionResult GetTimesheetDetails(string weekendDate, int EmpId) { NuPortalProjectService.NuPortalProject projectService = new NuPortalProjectService.NuPortalProject(); projectService.Url = Constants.ProjectService; DataTable temp = new DataTable(), dt = new DataTable(); try { DateTime endDate = Convert.ToDateTime(weekendDate); temp = JsonConvert.DeserializeObject <DataTable>(projectService.selectTaskDetails(EmpId != 0? EmpId: Convert.ToInt32(Session["EmpId"]), endDate)); if (temp != null && temp.Rows.Count > 0) { int Assign = Convert.ToInt32(temp.Rows[0]["AssignedTo"]); dt.Columns.Add("ProjectName", typeof(string)); dt.Columns.Add("TaskName", typeof(string)); dt.Columns.Add("FK_TaskId", typeof(int)); dt.Columns.Add("TaskDetailsId", typeof(int)); dt.Columns.Add("Date", typeof(string)); dt.Columns.Add("Hour", typeof(float)); dt.Columns.Add("Status", typeof(int)); dt.Columns.Add("StartDate", typeof(string)); foreach (DataRow row in temp.Rows) { dt.Rows.Add(Convert.ToString(row["ProjectName"]), Convert.ToString(row["TaskName"]), Convert.ToInt32(row["FK_TaskId"]), Convert.ToInt32(row["TaskDetailsId"]), Convert.ToDateTime(row["Date"]).ToString("MM/dd/yyyy"), Convert.ToDecimal(row["Hour"]), Convert.ToInt32(row["TicketStatusId"]), Convert.ToDateTime(row["StartDate"]).ToString("MM/dd/yyyy")); } DateTime startDate = Convert.ToDateTime(weekendDate).AddDays(-6); DataTable taskDist = dt.DefaultView.ToTable(true, "FK_TaskId", "TaskName", "ProjectName", "Status", "StartDate"); DataTable resultDt = new DataTable(); resultDt.Columns.Add("ProjectName", typeof(string)); resultDt.Columns.Add("TaskName", typeof(string)); resultDt.Columns.Add("FK_TaskId", typeof(int)); resultDt.Columns.Add("Date0", typeof(string)); resultDt.Columns.Add("Date1", typeof(string)); resultDt.Columns.Add("Date2", typeof(string)); resultDt.Columns.Add("Date3", typeof(string)); resultDt.Columns.Add("Date4", typeof(string)); resultDt.Columns.Add("Date5", typeof(string)); resultDt.Columns.Add("Date6", typeof(string)); resultDt.Columns.Add("TaskDetailsId", typeof(string)); resultDt.Columns.Add("AssignedTo", typeof(int)); resultDt.Columns.Add("Status", typeof(int)); resultDt.Columns.Add("Date0Class", typeof(string)); resultDt.Columns.Add("Date1Class", typeof(string)); resultDt.Columns.Add("Date2Class", typeof(string)); resultDt.Columns.Add("Date3Class", typeof(string)); resultDt.Columns.Add("Date4Class", typeof(string)); resultDt.Columns.Add("Date5Class", typeof(string)); resultDt.Columns.Add("Date6Class", typeof(string)); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow task in taskDist.Rows) { DataRow resultRow = resultDt.NewRow(); resultRow["ProjectName"] = task["ProjectName"]; resultRow["TaskName"] = task["TaskName"]; resultRow["FK_TaskId"] = task["FK_TaskId"]; resultRow["Status"] = task["Status"]; int cnt = 0; string sheetIds = ""; for (DateTime dte = startDate; dte < startDate.AddDays(7); dte = dte.AddDays(1)) { DataRow[] timesheets = dt.Select("FK_TaskId=" + task["FK_TaskId"] + " And Date='" + dte.ToString("MM/dd/yyyy") + "'"); if (timesheets != null && timesheets.Length > 0 && Convert.ToDecimal(timesheets[0]["Hour"]) != 0) { resultRow["Date" + cnt] = timesheets[0]["Hour"]; sheetIds = sheetIds + Convert.ToString(timesheets[0]["TaskDetailsId"]) + "|"; } else { resultRow["Date" + cnt] = ""; } if (dte < Convert.ToDateTime(DateTime.ParseExact(Convert.ToString(task["StartDate"]), "MM/dd/yyyy", null).ToString("yyyy/MM/dd"))) { resultRow["Date" + cnt + "Class"] = "disabled"; } else { resultRow["Date" + cnt + "Class"] = ""; } cnt++; } resultRow["TaskDetailsId"] = sheetIds; resultRow["AssignedTo"] = Assign; resultDt.Rows.Add(resultRow); } return(Json(JsonConvert.SerializeObject(resultDt), JsonRequestBehavior.AllowGet)); } else { return(Json("", JsonRequestBehavior.AllowGet)); } } else { return(Json("", 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.Dispose(); dt = null; temp = null; } return(Json(Common_Library.Constants.JsonError, JsonRequestBehavior.AllowGet)); }