private void AppendEvent(CDefect def, CEvent de) { // Add the event to defect's eventlist. if (def.eventlist == null || def.eventlist.Length == 0) { // No events, so we can just create a new list. def.eventlist = new CEvent[1]; def.eventlist[0] = de; } else { // Append new event to end of existing list. ArrayList list = new ArrayList(); for (int i = 0; i < def.eventlist.Length; ++i) { list.Add(def.eventlist[i]); } // add new event to list list.Add(de); def.eventlist = new CEvent[def.eventlist.Length + 1]; for (int i = 0; i < list.Count; ++i) { def.eventlist[i] = (CEvent)list[i]; } } }
/// <summary> /// Cretes the default defect. /// </summary> /// <param name="username">The username.</param> /// <param name="foundinversion">The foundinversion.</param> /// <param name="summary">The summary.</param> /// <param name="comments">The comments.</param> /// <param name="getHomeFile">if set to <c>true</c> [get home file].</param> private void CreteDefaultDefect(string username, string foundinversion, string summary, string comments, bool getHomeFile) { this.defect = new CDefect(); this.SetCustomValues(username, summary); this.AddReportedByRecord(username, foundinversion, comments); this.SetDates(); this.defect.eventlist = new CEvent[0]; this.defect.pSCCFileList = new CSCCFileRecord[0]; var customfields = new List <CField>(); var homeEnvironment = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); if (File.Exists(this.externalConfigFile)) { CreateRecordFromConfigurationFile( File.ReadAllLines(this.externalConfigFile), this.defect, customfields); } else { if (File.Exists(Path.Combine(homeEnvironment, "TesttrackSetup.cfg")) && getHomeFile) { CreateRecordFromConfigurationFile( File.ReadAllLines(Path.Combine(homeEnvironment, "TesttrackSetup.cfg")), this.defect, customfields); } } this.defect.customFieldList = customfields.ToArray(); this.timeD = CreateDefaultCDefect(username, foundinversion, summary, comments); }
/// <summary> /// The read tt item soap config. /// </summary> /// <param name="ConfigFile"> /// The config file. /// </param> /// <returns> /// The <see cref="CDefect"/>. /// </returns> public static CDefect ReadTTItemSoapConfig(string ConfigFile) { SerializableCDefect defect = null; using (Stream stream = File.Open(ConfigFile, FileMode.Open, FileAccess.Read)) { IFormatter formatter = new SoapFormatter(); defect = (SerializableCDefect)formatter.Deserialize(stream); } return(defect != null?defect.ToCDefect() : null); }
public void ReOpenDefect(long id, string userName, string comment) { CDefect def = this.ttSOAP.editDefect(this.ttCookie, id, "", true); try { CEvent de = CreateReopenEvent(userName); this.AppendEvent(def, de); this.ttSOAP.saveDefect(this.ttCookie, def); } catch (Exception) { this.ttSOAP.cancelSaveDefect(this.ttCookie, def.recordid); } }
public bool AttachComment(long id, string userName, string comment) { CDefect def = this.ttSOAP.editDefect(this.ttCookie, id, "", true); try { if (def.state.Equals("Closed")) { this.AppendEvent(def, this.CreateReopenEvent(userName)); } this.AppendEvent(def, this.CreateCommentEvent(userName, comment)); this.ttSOAP.saveDefect(this.ttCookie, def); return(true); } catch (Exception) { this.ttSOAP.cancelSaveDefect(this.ttCookie, def.recordid); return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="TtDefect"/> class. /// </summary> /// <param name="DefaultConfigFile"> /// The default config file. /// </param> public TtDefect(string DefaultConfigFile) { this.defect = ReadTTItemSoapConfig(DefaultConfigFile); this.SetDates(); }
/// <summary> /// Initializes a new instance of the <see cref="TtDefect"/> class. /// </summary> /// <param name="connection"> /// The connection. /// </param> /// <param name="TTNumber"> /// The tt number. /// </param> public TtDefect(IIssueManagementConnection connection, long TTNumber) { connection.EnableFormattedTextSupport(); this.defect = connection.getDefect(TTNumber); }
public static void CreateRecordFromConfigurationFile(string[] lines, CDefect defect, List <CField> customfields) { foreach (var line in lines) { if (line.Trim().StartsWith("//")) { continue; } var elems = line.Split(';'); if (line.Trim().StartsWith("CustomStringField")) { try { AddCustomStringField(customfields, elems[1].Trim(), elems[2].Trim()); } catch (Exception) { AddCustomStringField(customfields, elems[1].Trim(), string.Empty); } continue; } if (line.Trim().StartsWith("CustomIntField")) { try { AddCustomIntField(customfields, elems[1].Trim(), int.Parse(elems[2].Trim())); } catch (Exception) { AddCustomIntField(customfields, elems[1].Trim(), 0); } continue; } if (line.Trim().StartsWith("CustomDropdownField")) { try { AddCustomDropdownFieldField(customfields, elems[1].Trim(), elems[2].Trim()); } catch (Exception) { AddCustomDropdownFieldField(customfields, elems[1].Trim(), string.Empty); } continue; } if (line.Trim().StartsWith("Type")) { defect.type = elems[1].Trim(); continue; } if (line.Trim().StartsWith("Product")) { defect.product = elems[1].Trim(); continue; } if (line.Trim().StartsWith("Severity")) { defect.severity = elems[1].Trim(); continue; } if (line.Trim().StartsWith("State")) { defect.state = elems[1].Trim(); continue; } if (line.Trim().StartsWith("Disposition")) { try { defect.disposition = elems[1].Trim(); } catch (Exception) { defect.disposition = string.Empty; } continue; } } }
private CDefect CreateDefaultCDefect(string username, string foundinversion, string summary, string comments) { var defectInd = new CDefect(); defectInd.enteredby = username; defectInd.summary = summary; defectInd.createdbyuser = username; defectInd.modifiedbyuser = username; defectInd.type = "Incorrect functionality"; defectInd.product = "Product Development (for PD use only)"; defectInd.severity = "Automated Testing"; defectInd.state = "Open"; defectInd.disposition = "Bat"; defectInd.reportedbylist = new CReportedByRecord[1]; defectInd.reportedbylist[0] = new CReportedByRecord(); defectInd.reportedbylist[0].foundby = username; defectInd.reportedbylist[0].foundinversion = foundinversion; defectInd.reportedbylist[0].comments = comments; defectInd.dateentered = DateTime.Now; defectInd.dateenteredSpecified = true; defectInd.datetimecreated = DateTime.Now; defectInd.datetimecreatedSpecified = true; defectInd.datetimemodified = DateTime.Now; defectInd.datetimemodifiedSpecified = true; defectInd.reportedbylist[0].datefound = DateTime.Now; defectInd.reportedbylist[0].datefoundSpecified = true; defectInd.eventlist = new CEvent[0]; defectInd.pSCCFileList = new CSCCFileRecord[0]; var customfields = new List <CField>(); // ===== Maintenance AddCustomStringField(customfields, "Maintenance", string.Empty); // ===== Defective since v. AddCustomDropdownFieldField(customfields, "Defective since v.", "Work"); // ===== ProjectPlan AddCustomDropdownFieldField(customfields, "ProjectPlan", string.Empty); // ===== Work order AddCustomStringField(customfields, "Work order", string.Empty); // ===== Release blocker AddCustomDropdownFieldField(customfields, "Release blocker", string.Empty); // ===== Defect reason AddCustomDropdownFieldField(customfields, "Defect reason", string.Empty); // ===== SubTeam AddCustomDropdownFieldField(customfields, "SubTeam", string.Empty); // ===== Reproduced AddCustomDropdownFieldField(customfields, "Reproduced", "Always"); // ===== Maintenance - Area priorities AddCustomStringField(customfields, "Maintenance - Area priorities", string.Empty); // ===== Component AddCustomDropdownFieldField(customfields, "Component", "Drawings"); // ===== SubComponent AddCustomDropdownFieldField(customfields, "SubComponent", "Other"); // ===== Effect on usage AddCustomDropdownFieldField(customfields, "Effect on usage", "No workaround, work discontinued"); // ===== Severity AddCustomDropdownFieldField(customfields, "Severity", string.Empty); defectInd.customFieldList = customfields.ToArray(); return(defectInd); }
/// <summary> /// The create defect. /// </summary> /// <param name="Defect"> /// The defect. /// </param> /// <returns> /// The <see cref="long"/>. /// </returns> public long CreateDefect(CDefect Defect) { return(this.ttSOAP.addDefect(this.ttCookie, Defect)); }
public SerializableCDefect() { this._defect = new CDefect(); }
public SerializableCDefect(CDefect defect) { this._defect = defect; }