public static string ValidateSubTaskNumber(int subTaskNumber, int parentTaskID) { var result = WTSPage.CreateDefaultResult(); WorkItem_Task task = new WorkItem_Task(); bool loaded = task.LoadByNumber(parentTaskID, subTaskNumber); if (loaded) { result["WORKITEMID"] = task.WorkItemID.ToString(); result["WORKITEM_TASKID"] = task.WorkItem_TaskID.ToString(); result["TASK_NUMBER"] = subTaskNumber.ToString(); result["title"] = task.Title; result["exists"] = "true"; } else { result["exists"] = "false"; } result["success"] = "true"; return(JsonConvert.SerializeObject(result, Newtonsoft.Json.Formatting.None)); }
public static string DeleteRQMTFromSet(int RQMTSetID, string checkedRQMTIDs, bool globalDelete) { var result = WTSPage.CreateDefaultResult(); string[] ids = checkedRQMTIDs.Split('|'); for (int i = ids.Length - 1; i >= 0; i--) // we go backwards so we can re-order as we go and not delete parents before children { int id = Int32.Parse(ids[i]); if (globalDelete) { DataTable dt = RQMT.RQMT_AssociatedSets_Get(id); foreach (DataRow row in dt.Rows) { RQMT.RQMTSet_DeleteRQMT((int)row["RQMTSetID"], id, 0, true); } } else { RQMT.RQMTSet_DeleteRQMT(RQMTSetID, id, 0, true); } } result["success"] = "true"; return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTDescription(int RQMTSet_RQMTSystemID, int RQMTSystemRQMTDescriptionID, string RQMTDescription, int RQMTDescriptionTypeID, bool editMode) { var result = WTSPage.CreateDefaultResult(); try { int RQMTDescriptionID = RQMT.RQMTSystem_SaveDescription(0, RQMTSet_RQMTSystemID, RQMTSystemRQMTDescriptionID, RQMTDescription, RQMTDescriptionTypeID, editMode, "all"); result["success"] = "true"; result["rqmtdescriptionid"] = RQMTDescriptionID.ToString(); } catch (Exception e) { if (e.Message.IndexOf("UNIQUE KEY") != -1) { result["error"] = "This description/type combination already exists in this RQMT."; } else { result["error"] = e.Message; } } return(WTSPage.SerializeResult(result)); }
public static string ValidateTaskID(int taskID) { var result = WTSPage.CreateDefaultResult(); DataTable dt = WorkloadItem.WorkItem_Get(taskID); if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; result["title"] = dr["TITLE"] != DBNull.Value ? HttpUtility.HtmlEncode(dr["TITLE"].ToString()) : ""; result["exists"] = "true"; DataTable aorDT = AOR.AORTaskAORList_Get(taskID); if (aorDT != null && aorDT.Rows.Count > 0) { Dictionary <string, string> aors = new Dictionary <string, string>(); for (int i = 0; i < aorDT.Rows.Count; i++) { DataRow aorRow = aorDT.Rows[i]; aors.Add(aorRow["AORID"].ToString(), aorRow["AORName"].ToString()); } result["aors"] = JsonConvert.SerializeObject(aors, Newtonsoft.Json.Formatting.None); } } else { result["exists"] = "false"; } result["success"] = "true"; return(JsonConvert.SerializeObject(result, Newtonsoft.Json.Formatting.None)); }
public static string DeleteDescriptionAttachment(int AttachmentID) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTDescriptionAttachment_Delete(0, 0, AttachmentID)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string TaskAddedToRQMTSet(int RQMTSetID, int WORKITEM_TASKID) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSet_Task_Add(RQMTSetID, WORKITEM_TASKID)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string DeleteRQMTDescription(int RQMTSystemRQMTDescriptionID) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSystem_DeleteDescription(RQMTSystemRQMTDescriptionID)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTAttributes(int RQMTSet_RQMTSystemID, int RQMTStageID, int CriticalityID, int RQMTStatusID, bool RQMTAccepted) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSystemAttributes_Save(RQMTSet_RQMTSystemID, RQMTStageID, CriticalityID, RQMTStatusID, RQMTAccepted)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string UpdateRQMTSetRQMTSystemUsage(int RQMTSet_RQMTSystemID, int month, bool selected) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSet_RQMTSystem_Usage_Update(RQMTSet_RQMTSystemID, month, selected)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string DeleteRQMTFunctionality(int RQMTSetID, int RQMTSet_RQMTSystemID, int RQMTSetFunctionalityID) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTFunctionality_Delete(RQMTSetID, RQMTSet_RQMTSystemID, RQMTSetFunctionalityID)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTSetOrdering(string order) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSet_ReorderRQMTs(0, order)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string DeleteRQMTBase(int RQMTID) { var result = WTSPage.CreateDefaultResult(); var deleteResult = RQMT.RQMT_Delete(RQMTID, false); result["success"] = deleteResult["deleted"]; result["hasdependencies"] = deleteResult["hasdependencies"]; return(WTSPage.SerializeResult(result)); }
public static string DeleteRQMTSet(int RQMTSetID) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSet_Delete(RQMTSetID)) { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTBase(int RQMTID, string txt) { var result = WTSPage.CreateDefaultResult(); var saveResult = RQMT.RQMT_Save(false, RQMTID, txt); result["success"] = saveResult["saved"].ToLower(); result["exists"] = saveResult["exists"].ToLower(); return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTChanges(string changes) { var result = WTSPage.CreateDefaultResult(); try { JObject jobj = (JObject)JsonConvert.DeserializeObject(changes); int RQMTID = 0; string addToSets = ""; string deleteFromSets = ""; string RQMTText = ""; foreach (KeyValuePair <string, JToken> token in (JObject)jobj) { string value = token.Value.ToString(); if (token.Key == "RQMTID") { RQMTID = Int32.Parse(value); } else if (token.Key == "adds") { addToSets = value; } else if (token.Key == "deletes") { deleteFromSets = value; } else if (token.Key == "RQMT") { RQMTText = value; } } int returnID = RQMT.RQMTBuilder_RQMTUpdate(RQMTID, RQMTText, addToSets, deleteFromSets); if (returnID != RQMTID) { result["error"] = "Change cannot be saved. Another RQMT already exists with the same text (RQMT #" + returnID + ")."; } else { result["success"] = "true"; } } catch (Exception e) { result["error"] = e.Message; } return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTFunctionality(int RQMTSetID, int RQMTSet_RQMTSystemID, string RQMTFunctionalities, int RQMTSetFunctionalityID, int FunctionalityID, int ComplexityID, string Justification) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTFunctionality_Save(RQMTSetID, RQMTSet_RQMTSystemID, RQMTFunctionalities, RQMTSetFunctionalityID, FunctionalityID, ComplexityID, Justification)) { result["success"] = "true"; result["RQMTSetID"] = RQMTSetID.ToString(); } return(WTSPage.SerializeResult(result)); }
public static string AddRQMTSet(string RQMTSetName, int WTS_SYSTEMID, int WorkAreaID, int RQMTTypeID) { var result = WTSPage.CreateDefaultResult(); var RQMTSetID = RQMT.RQMTSet_Save(0, RQMTSetName, WTS_SYSTEMID, WorkAreaID, RQMTTypeID, 0, null); if (RQMTSetID > 0) { result["success"] = "true"; } result["RQMTSetID"] = RQMTSetID.ToString(); return(WTSPage.SerializeResult(result)); }
public static string HideQuickAddWarning() { var result = WTSPage.CreateDefaultResult(); WTS_User u = WTSPage.GetLoggedInUser(); bool dup = false; string err = ""; u.UserSetting_Update(0, 2, 0, "0", out dup, out err); result["success"] = "true"; return(WTSPage.SerializeResult(result)); }
public static string RenameRQMTSetGroup(int RQMTSetNameID, string name) { var result = WTSPage.CreateDefaultResult(); if (RQMT.RQMTSetName_Save(RQMTSetNameID, name)) { result["success"] = "true"; } else { result["error"] = "Name already exists and could not be changed."; } return(WTSPage.SerializeResult(result)); }
public static string SaveRQMTSet(int RQMTSetID, string RQMTSetName, int WTS_SYSTEMID, int WorkAreaID, int RQMTTypeID, int RQMTComplexityID, string justification) { var result = WTSPage.CreateDefaultResult(); var postSaveRQMTSetID = RQMT.RQMTSet_Save(RQMTSetID, string.IsNullOrWhiteSpace(RQMTSetName) ? "" : RQMTSetName, WTS_SYSTEMID, WorkAreaID, RQMTTypeID, RQMTComplexityID, justification); if (postSaveRQMTSetID == RQMTSetID) { result["success"] = "true"; } else { result["exists"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string PasteRQMTs(int RQMTSetID, string options) { var result = WTSPage.CreateDefaultResult(); string previousCopiedRQMTs = (string)HttpContext.Current.Session["copied.rqmts"]; // RQMTS, SYSIDS, RSRSIDS if (options == null) { options = ""; } bool pasteAttributes = options.IndexOf("attr") != -1; bool pasteDefects = options.IndexOf("def") != -1; bool pasteDescriptions = options.IndexOf("desc") != -1; string pasteOptions = (pasteAttributes ? "attr," : "") + (pasteDefects ? "def," : "") + (pasteDescriptions ? "desc," : ""); if (pasteOptions.Length > 0) { pasteOptions = pasteOptions.Substring(0, pasteOptions.Length - 1); } if (!string.IsNullOrWhiteSpace(previousCopiedRQMTs)) { string[] arr = previousCopiedRQMTs.Split(','); string[] prevRQMTIDs = arr[0].Split('|'); string[] prevRQMTSet_RQMTSystemIDs = arr[2].Split('|'); for (int i = 0; i < prevRQMTIDs.Length; i++) { int RQMTID = Int32.Parse(prevRQMTIDs[i]); int RQMTSet_RQMTSystemID = Int32.Parse(prevRQMTSet_RQMTSystemIDs[i]); RQMT.RQMTSet_AddRQMT(RQMTSetID, RQMTID, null, false, RQMTSet_RQMTSystemID, pasteOptions); } RQMT.RQMTSet_ReorderRQMTs(RQMTSetID, null); // this forces us to reclaim space from previously deleted rqmts result["success"] = "true"; } else // we shouldn't get here; the UI should have disabled the paste button if there is nothing on the clipboard { result["success"] = "true"; } return(WTSPage.SerializeResult(result)); }
public static string AddRQMTToRQMTSet(int RQMTSetID, int RQMTID, string RQMTText, bool addAsChild) { var result = WTSPage.CreateDefaultResult(); try { RQMTID = RQMT.RQMTSet_AddRQMT(RQMTSetID, RQMTID, RQMTText, addAsChild, 0, null); result["success"] = "true"; result["RQMTID"] = RQMTID.ToString(); // only needed if we create a brand new RQMTID } catch (Exception e) { result["error"] = e.Message; } return(WTSPage.SerializeResult(result)); }
public static string CreateNewComponent(string compType, string txt) { var result = WTSPage.CreateDefaultResult(); try { if (compType == "rqmt") { txt = txt.Replace("|", "!"); txt = txt.Replace("\r", ""); txt = txt.Replace("\n", "|"); // we will be adding one rqmt for each | string[] txtarr = txt.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); txt = string.Join("|", txtarr); // rqmtsNeedingParents stores the indexes of the rqmts that had a > in front of them // after the saving is done, we make ajax calls to add the new rqmts to the sets displayed on the page, and will preserve parent-child relationships based on > characters string rqmtsNeedingParents = ""; for (int i = 0; i < txtarr.Length; i++) { if (i > 0) { rqmtsNeedingParents += ","; } rqmtsNeedingParents += txtarr[i].Trim().StartsWith(">") ? "1" : "0"; } var saveResult = RQMT.RQMT_Save(true, 0, txt); result["success"] = saveResult["saved"].ToLower(); result["rqmtid"] = saveResult["newID"]; result["rqmtids"] = saveResult["newIDs"]; result["exists"] = saveResult["exists"]; result["rqmtsneedingparents"] = rqmtsNeedingParents; } } catch (Exception e) { result["error"] = e.Message; } return(WTSPage.SerializeResult(result)); }
public static string FilterRQMTSets(int RQMTSetID, string RQMTSetName, int WTS_SYSTEMID, int WorkAreaID, int RQMTTypeID) { var result = WTSPage.CreateDefaultResult(); if (RQMTSetID < 0) { RQMTSetID = 0; } // when results from back from the server, they come back as a data set containing the following tables: // [0] = RQMT // [1] = DESC // [2] = FUNC // [3] = DEFECT // [4] = TASK DataSet ds = RQMT.RQMTBuilder_Data_Get(RQMTSetID, !string.IsNullOrWhiteSpace(RQMTSetName) ? RQMTSetName : null, WTS_SYSTEMID, WorkAreaID, RQMTTypeID, 0); return(WTSPage.SerializeResult(ds)); }
public static string Save(int RQMTID, string RQMTName, string addToSets, string deleteFromSets, string attrChanges, string usageChanges, string funcChanges, string descChanges, int ParentRQMTID) { var result = WTSPage.CreateDefaultResult(); RQMTName = RQMTName.Replace("|", "!"); RQMTName = RQMTName.Replace("\r", ""); RQMTName = RQMTName.Replace("\n", ""); // new ID will be 0 if fail, RQMTID if updating, or a new RQMTID if new int savedID = RQMT.RQMTEditData_Save(RQMTID, RQMTName, addToSets, deleteFromSets, attrChanges, usageChanges, funcChanges, StringUtil.UndoStrongEscape(descChanges), RQMTID == 0 ? ParentRQMTID : 0); if (savedID > 0) { result["success"] = "true"; if (RQMTID == 0) { result["newid"] = savedID.ToString(); } } return(WTSPage.SerializeResult(result)); }
public static string CopyRQMTs(string RQMTIDs, string SystemIDs, string RQMTSet_RQMTSystemIDs) { var result = WTSPage.CreateDefaultResult(); if (string.IsNullOrWhiteSpace(RQMTIDs) || string.IsNullOrWhiteSpace(RQMTSet_RQMTSystemIDs)) { HttpContext.Current.Session["copied.rqmts"] = ""; result["rqmtids"] = ""; result["rqmtidsstr"] = ""; result["systemids"] = ""; result["rqmtsetrqmtsystmeids"] = ""; } else { string previousCopiedRQMTs = (string)HttpContext.Current.Session["copied.rqmts"]; if (string.IsNullOrWhiteSpace(previousCopiedRQMTs)) { HttpContext.Current.Session["copied.rqmts"] = RQMTIDs + "," + SystemIDs + "," + RQMTSet_RQMTSystemIDs; } else { string[] arr = previousCopiedRQMTs.Split(','); string prevRQMTIDs = arr[0]; string prevSystemIDs = arr[1]; string prevRQMTSet_RQMTSystemIDs = arr[2]; string[] newRQMTIdArr = RQMTIDs.Split('|'); string[] newSystemIdArr = SystemIDs.Split('|'); string[] newRQMTSet_RQMTSystemArr = RQMTSet_RQMTSystemIDs.Split('|'); string newRQMTIDs = prevRQMTIDs; string newSystemIDs = prevSystemIDs; string newRQMTSet_RQMTSystemIDs = prevRQMTSet_RQMTSystemIDs; for (int i = 0; i < newRQMTSet_RQMTSystemArr.Length; i++) { if (!("|" + prevRQMTIDs + "|").Contains("|" + newRQMTIdArr[i] + "|")) { newRQMTSet_RQMTSystemIDs += "|" + newRQMTSet_RQMTSystemArr[i]; newSystemIDs += "|" + newSystemIdArr[i]; if (("|" + prevRQMTIDs.Replace("*", "") + "|").Contains("|" + newRQMTIdArr[i] + "|")) { newRQMTIDs += "|" + newRQMTIdArr[i] + "*"; } else { newRQMTIDs += "|" + newRQMTIdArr[i]; } } } RQMTIDs = newRQMTIDs; SystemIDs = newSystemIDs; RQMTSet_RQMTSystemIDs = newRQMTSet_RQMTSystemIDs; HttpContext.Current.Session["copied.rqmts"] = newRQMTIDs + "," + newSystemIDs + "," + newRQMTSet_RQMTSystemIDs; } result["rqmtids"] = RQMTIDs; result["rqmtidsstr"] = RQMTIDs.Replace("|", ", "); result["systemids"] = SystemIDs; result["rqmtsetrqmtsystmeids"] = RQMTSet_RQMTSystemIDs; } result["success"] = "true"; return(WTSPage.SerializeResult(result)); }