public Response SetResources(List <PM_TaskEntry> model) { Response res = new Response(); try { PM_TaskEntryBL te = new PM_TaskEntryBL(); for (int x = 0; x < model.Count; x++) { if (model[x].PMTRId != 0) { res.Value = te.ManageResources("UpdateResources", model[x].ResourceId, model[x].GroupId, model[x].RACIId, model[x].ProjectId, model[x].TaskId, model[x].PMTRId, model[x].RatePerHour, model[x].IsDeleted); } else { res.Value = te.ManageResources("InsertResources", model[x].ResourceId, model[x].GroupId, model[x].RACIId, model[x].ProjectId, model[x].TaskId, model[x].RatePerHour, model[x].IsDeleted); } } res.Status = "true"; res.Message = "Ok"; return(res); } catch (Exception ex) { res.Status = "false"; res.Message = ex.Message; return(res); } }
public JsonResult GetUEtypes(string Filter, int TaskId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); var list = te.Get_UE_Type_List(Filter); return(Json(list, JsonRequestBehavior.AllowGet)); }
public Response _LookupData(int _ProjectId) { Response _res = new Response(); PM_LookupData _lookup = new PM_LookupData(); try { PM_TaskEntryBL te = new PM_TaskEntryBL(); AD_DefinationBL db = new AD_DefinationBL(); _lookup.GroupResources = te.GET_Group_LIST("PopulateGroupResources").ToList(); _lookup.ProjectResources = te.GET_Group_LIST("PopulateUserResourcesProject", _ProjectId).Where(x => x.ResourceName != null && x.ResourceName != "").ToList(); _lookup.ProjectStatus = db.ToList("byDefinationType", "Project Task Status"); _lookup.Priorities = db.ToList("byDefinationType", "Priority"); Sec_UserBL ud = new Sec_UserBL(); _res.Message = "Ok"; _res.Status = "true"; _res.Value = _lookup; return(_res); } catch (Exception _ex) { _res.Message = _ex.Message; _res.Status = "false"; _res.Value = _lookup; return(_res); } }
public JsonResult GetSiteTaskInventoryHeader(string Filter, long TaskId, long SiteId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); var list = te.Get_SiteTask_InventoryHeader(Filter, TaskId, SiteId); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult GetUEItems(string Filter, long UETypeId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); var list = te.Get_UE_Items(Filter, UETypeId); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult SetResources(List <PM_TaskEntry> model) { Response res = new Response(); try { PM_TaskEntryBL te = new PM_TaskEntryBL(); for (int x = 0; x < model.Count; x++) { if (model[x].PMTRId != 0) { res.Value = te.ManageResources("UpdateResources", model[x].ResourceId, model[x].GroupId, model[x].RACIId, model[x].ProjectId, model[x].TaskId, model[x].PMTRId, model[x].RatePerHour); } else { res.Value = te.ManageResources("InsertResources", model[x].ResourceId, model[x].GroupId, model[x].RACIId, model[x].ProjectId, model[x].TaskId, model[x].RatePerHour); } res.Status = "success"; res.Message = "Save successfully"; } } catch (Exception ex) { res.Status = "danger"; res.Message = ex.Message; } return(Json("res", JsonRequestBehavior.AllowGet)); }
public JsonResult GetResources(int ProjectId, int TaskId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); var jsonReturn = te.GET_Group_LIST("GetResources", ProjectId, TaskId).ToList(); return(Json(jsonReturn, JsonRequestBehavior.AllowGet)); //return Json("ok", JsonRequestBehavior.AllowGet); }
public JsonResult PopulateUserResourcesProject(int id) { PM_TaskEntryBL te = new PM_TaskEntryBL(); var jsonReturn1 = te.GET_Group_LIST("PopulateUserResourcesProject", id).ToList(); return(Json(jsonReturn1, JsonRequestBehavior.AllowGet)); }
public ActionResult PopulateGroupResources(int ProjectId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); var jsonReturn1 = te.GET_Group_LIST("PopulateGroupResources", ProjectId).ToList(); return(Json(jsonReturn1, JsonRequestBehavior.AllowGet)); }
public JsonResult ManageSiteTaskInventory(string Filter, List <PM_SiteTaskInventory> STI_List, long SiteTaskId, long SiteId, long UserId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); dbDataTable ddt = new dbDataTable(); DataTable dt = ddt.List(); foreach (var item in STI_List) { myDataTable.AddRow(dt, "Value1", item.SiteTaskId, "Value2", item.CategoryId, "Value3", item.SiteId, "Value4", item.SiteTaskInventoryId, "Value5", item.IsModified, "Value6", item.ItemId, "Value7", item.Quantity, "Value8", item.BarCode, "Value11", item.Description); } DataTable res = te.Manage_SiteTask_Inventory(Filter, dt, SiteTaskId, SiteId, UserId); // Update Attachments Directory if (res.Rows.Count > 0) { for (int i = 0; i < res.Rows.Count; i++) { var ExistingPath = res.Rows[i]["SubDirectory"].ToString(); var NewPath = res.Rows[i]["InventoryId"].ToString(); SWI.AirView.Common.WebConfig wc = new SWI.AirView.Common.WebConfig(); var SiteTaskInventoryPath = wc.AppSettings("SiteTaskInventoryPath"); var path = Path.Combine(Server.MapPath("~/" + SiteTaskInventoryPath + "/" + ExistingPath)); string pathString = System.IO.Path.Combine(path.ToString()); bool isExists = System.IO.Directory.Exists(pathString); string NewPathString = (Path.Combine(Server.MapPath("~/" + SiteTaskInventoryPath + "/" + NewPath))).ToString(); if (isExists) { System.IO.Directory.Move(pathString, NewPathString); } } } Response response = new Response(); try { response.Status = "success"; response.Message = "Save successfully"; } catch (Exception ex) { response.Status = "danger"; response.Message = ex.Message; } return(Json(response, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSiteTaskInventoryAttachments(string Filter, long SiteTaskInventoryId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); List <PM_SiteTaskInventoryAttachments> list = te.Get_SiteTask_Inventory_Attachments(Filter, SiteTaskInventoryId); foreach (var item in list) { SWI.AirView.Common.WebConfig wc = new SWI.AirView.Common.WebConfig(); var SiteTaskInventoryPath = wc.AppSettings("SiteTaskInventoryPath"); string host = Request.Url.Authority; string connectionType = Request.Url.Scheme; var path = Path.Combine(connectionType + "://" + host + "/" + SiteTaskInventoryPath + "/" + item.SiteTaskInventoryId); item.SubDirectory = path; } return(Json(list, JsonRequestBehavior.AllowGet)); }
public Response GetResources(int ProjectId, int TaskId) { Response _response = new Response(); try { PM_TaskEntryBL te = new PM_TaskEntryBL(); _response.Value = te.GET_Group_LIST("GetResources", ProjectId, TaskId).ToList(); _response.Message = "Ok"; _response.Status = "true"; return(_response); } catch (Exception ex) { _response.Message = ex.Message; _response.Status = "false"; return(_response); } }
public Response DeleteResources(int ResourceId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); Response _res = new Response(); try { te.ManageResources("DeleteResources", ResourceId); _res.Status = "true"; _res.Message = "Ok"; return(_res); } catch (Exception ex) { _res.Status = "false"; _res.Message = ex.Message; return(_res); } }
public JsonResult DeleteResources(int id) { PM_TaskEntryBL te = new PM_TaskEntryBL(); Response res = new Response(); try { te.ManageResources("DeleteResources", id); res.Status = "success"; res.Message = "Save successfully"; } catch (Exception ex) { res.Status = "danger"; res.Message = ex.Message; } return(Json(res, JsonRequestBehavior.AllowGet)); //return Json("ok", JsonRequestBehavior.AllowGet); }
public JsonResult RemoveSiteTaskInventory(string Filter, int SiteTaskInventoryId, long CategoryId, long ItemId, string FileName) { PM_TaskEntryBL te = new PM_TaskEntryBL(); try { if (Filter == "DeleteAttachmentById") { SWI.AirView.Common.WebConfig wc = new SWI.AirView.Common.WebConfig(); var SiteTaskInventoryPath = wc.AppSettings("SiteTaskInventoryPath"); var SubDirectory = ""; if (SiteTaskInventoryId != 0) { SubDirectory = SiteTaskInventoryId.ToString(); } else { SubDirectory = (CategoryId + "_" + ItemId).ToString(); } var path = Path.Combine(Server.MapPath("~/" + SiteTaskInventoryPath + "/" + SubDirectory)); try { if ((System.IO.File.Exists(path + "/" + FileName))) { System.IO.File.Delete(path + "/" + FileName); } System.IO.DirectoryInfo di = new DirectoryInfo(path); if (di.GetFiles().Length == 0) { System.IO.Directory.Delete(path, true); } } catch {} te.Manage_SiteTask_Inventory("DeleteAttachmentById", null, 0, 0, 0, SiteTaskInventoryId, FileName, SubDirectory, 0); } else { SWI.AirView.Common.WebConfig wc = new SWI.AirView.Common.WebConfig(); var SiteTaskInventoryPath = wc.AppSettings("SiteTaskInventoryPath"); var SubDirectory = ""; if (SiteTaskInventoryId != 0) { SubDirectory = SiteTaskInventoryId.ToString(); } else { SubDirectory = (CategoryId + "_" + ItemId).ToString(); } var path = Path.Combine(Server.MapPath("~/" + SiteTaskInventoryPath + "/" + SubDirectory)); try { if (System.IO.Directory.Exists(path)) { System.IO.DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo file in di.GetFiles()) { file.Delete(); } System.IO.Directory.Delete(path, true); } } catch { } te.Manage_SiteTask_Inventory("DeleteSiteTaskInventory", null, 0, 0, 0, SiteTaskInventoryId, FileName, SubDirectory, 0); } } catch { } Response res = new Response() { Message = "Removed!", Status = "success" }; return(Json(res, JsonRequestBehavior.AllowGet)); }
public ActionResult UploadAttachments(int SiteTaskInventoryId, long CategoryId, long ItemId) { PM_TaskEntryBL te = new PM_TaskEntryBL(); bool isSavedSuccessfully = true; string fName = ""; string SubDirectory = ""; try { foreach (string fileName in Request.Files) { HttpPostedFileBase file = Request.Files[fileName]; fName = file.FileName; if (file != null && file.ContentLength > 0) { SWI.AirView.Common.WebConfig wc = new SWI.AirView.Common.WebConfig(); var SiteTaskInventoryPath = wc.AppSettings("SiteTaskInventoryPath"); if (SiteTaskInventoryId == 0) { SubDirectory = (CategoryId + "_" + ItemId).ToString(); } else { SubDirectory = SiteTaskInventoryId.ToString(); } var path = Path.Combine(Server.MapPath("~/" + SiteTaskInventoryPath + "/" + SubDirectory)); string pathString = System.IO.Path.Combine(path.ToString()); var fileName1 = Path.GetFileName(file.FileName); bool isExists = System.IO.Directory.Exists(pathString); if (!isExists) { System.IO.Directory.CreateDirectory(pathString); } var uploadpath = string.Format("{0}\\{1}", pathString, file.FileName); file.SaveAs(uploadpath); DataTable res = te.Manage_SiteTask_Inventory("Add_Attachments", null, 0, 0, 0, SiteTaskInventoryId, file.FileName, SubDirectory, file.ContentLength); if (res.Rows.Count == 0) { isSavedSuccessfully = false; } } } } catch (Exception ex) { isSavedSuccessfully = false; } if (isSavedSuccessfully) { return(Json(new { Message = fName })); } else { return(Json(new { Message = "Error in saving file" })); } }