public override void execute() { Console.WriteLine("this is process start command"); //Console.WriteLine("assigned to" + this.AssignTo); TeamInfo teamInfo = TeamInfoAccess.getTeam(0); string bugId = "N/A"; using (PSDataAccess psDataAccess = new PSDataAccess(teamInfo.domain, teamInfo.product)) { bugId = "bug12345"; } TrackingDataContext tdc = new TrackingDataContext(); CommonResource.Tracking t = new CommonResource.Tracking(); t.wfname = this.WFName; t.bugid = bugId; t.wfinstanceid = new Guid(this.InstanceId); t.lastmodified = DateTime.Now; t.assignedto = this.AssignedTo; t.title = this.Title; t.qfestatus = this.qFEStatus; //t.qfestatus= t.lastmodifiedby = AuthenticationHelper.GetCurrentUser(); tdc.Trackings.InsertOnSubmit(t); tdc.SubmitChanges(); }
public ParameterList GetParameters(string CommandName) { ParameterList pList = new ParameterList(); CommandInteraction ci = new CommandInteraction(); try { List <string> requierdInputs = ci.getRequiredInputs(CommandName); foreach (string i in requierdInputs) { Parameter p = new Parameter(); p.Name = i; pList.Add(p); } TeamInfo teamInfo = TeamInfoAccess.getTeam(0); using (PSDataAccess psDataAccess = new PSDataAccess(teamInfo.domain, teamInfo.product)) { string psFieldNames = string.Empty; foreach (Parameter p in pList) { p.Name = p.Name.Replace("__", " "); if (psFieldNames == string.Empty) { psFieldNames = p.Name;//"__" is for the white space issue } else { psFieldNames = string.Format("{0};{1}", psFieldNames, p.Name); } } List <PSFieldDefinition> fieldDefinitions = psDataAccess.LoadingPSFields(psFieldNames); foreach (Parameter p in pList) { if (p.Name.Equals("AssignedTo")) { p.Values.AddRange(new string[] { "t-limliu", "yuanzhua", "zachary", "zichsun" }); } foreach (PSFieldDefinition definition in fieldDefinitions) { if (p.Name.Equals(definition.Name)) { List <object> values = definition.GetAllowedValues(); foreach (object v in values) { p.Values.Add(v.ToString()); } break; } } } } } catch (Exception e) { throw new WebFaultException <string>(e.ToString(), HttpStatusCode.InternalServerError); } return(pList); }