public async Task <IHttpActionResult> PostCadJob([FromBody] Job job) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } CadJob cadJob = new CadJob() { LCID = job.LCID, ProductID = job.ProductID, VersionID = job.VersionID, ComponentID = job.ComponentID, Description = job.Description, }; cadJob.StatusID = (byte)JobStatus.Submitted; cadJob.OwnerID = 4; cadJob.CreatedTime = DateTime.Now; db.CadJobs.Add(cadJob); db.SaveChanges(); int jobId = cadJob.ID; //add a new map about job id and pattern id into JobPattern table. JobPattern jobPattern = new JobPattern(); jobPattern.JobId = jobId; jobPattern.PatternId = job.PatternID; int retVal = DBUtil.executeCommand(jobPattern.ToSQLString()); if (!string.IsNullOrEmpty(job.Trace)) { string[] splitTraces = job.Trace.Split(new char[] { ';' }).Distinct <string>().ToArray <string>(); foreach (string aTrace in splitTraces) { var rawTraceFile = new RawTraceFile() { FileName = "", FilePath = aTrace, FileTypeID = 1, ResultTable = "", JobID = jobId, ProductVersionID = job.VersionID, ProductComponentID = job.ComponentID }; db.RawTraceFiles.Add(rawTraceFile); } } /* * if (!string.IsNullOrEmpty(job.PDB)) * { * string[] splitPDBs = job.PDB.Split(new char[] { ';' }).Distinct<string>().ToArray<string>(); * foreach (string aPDB in splitPDBs) * { * db.RawPDBDirs.Add(new RawPDBDir() * { * DirName = aPDB, * JobID = jobId * }); * } * } */ if (!string.IsNullOrEmpty(job.TMF)) { string[] splitTMFs = job.TMF.Split(new char[] { ';' }).Distinct <string>().ToArray <string>(); foreach (string aTMF in splitTMFs) { db.RawTMFDirs.Add(new RawTMFDir() { DirName = aTMF, JobID = jobId }); } } /* * if (!string.IsNullOrEmpty(job.Source)) * { * string[] splitSources = job.Source.Split(new char[] { ';' }).Distinct<string>().ToArray<string>(); * foreach (string aSource in splitSources) * { * db.RawSourceDirs.Add(new RawSourceDir() * { * DirName = aSource, * JobID = jobId * }); * } * } */ await db.SaveChangesAsync(); return(Ok(jobId)); }
public static float InspectorJobPattern(Rect position, JobPattern jp) { GUI.changed = false; int cc = EditorGUI.IntField(new Rect(position.x, position.y, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Critical", jp.m_cc); int frag = EditorGUI.IntField(new Rect(position.x + position.width * 0.5f, position.y, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Fragmentation", jp.m_frag); int force = EditorGUI.IntField(new Rect(position.x, position.y+25, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Force", jp.m_force); int res = EditorGUI.IntField(new Rect(position.x + position.width * 0.5f, position.y+25, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Resistance", jp.m_res); int vit = EditorGUI.IntField(new Rect(position.x, position.y+50, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Vitality", jp.m_vit); int level = EditorGUI.IntField(new Rect(position.x + position.width * 0.5f, position.y+50, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Level", jp.m_level); int diffuser = EditorGUI.IntField(new Rect(position.x, position.y+75, position.width * 0.5f, EditorGUIUtility.singleLineHeight), "Diffuser", jp.m_diffuser); string displayName = EditorGUI.TextField(new Rect(position.x, position.y+100, position.width, EditorGUIUtility.singleLineHeight), "Display Name", jp.m_displayName); position.y += EditorGUIUtility.singleLineHeight; float usedHeight = 0.0f; usedHeight += EditorGUIUtility.singleLineHeight; jp.m_cc = cc; jp.m_force = force; jp.m_frag = frag; jp.m_res = res; jp.m_vit = vit; jp.m_level = level; jp.m_diffuser = diffuser; jp.m_displayName = displayName; if (GUI.changed) EditorUtility.SetDirty(jp); return usedHeight; }