private void Init(ActivityConfig.ACSeriesRow acsr) { this.SuspendLayout(); //flowLayoutPanel1.Controls.Clear(); if (myRF != null) { myRF.Dispose(); } myRF = null; MyACE = new ACEngine(FM); MyACE.myAcSeries = acsr; MyACE.myActivityCode = acsr.ActivityCodeRow; MyACE.DoRelFields(); MyACE.DoStep(ACEngine.Step.RelatedFields0, true); MyACE.DoStep(ACEngine.Step.RelatedFields1, true); MyACE.DoStep(ACEngine.Step.RelatedFields2, true); MyACE.DoStep(ACEngine.Step.RelatedFields3, true); MyACE.DoStep(ACEngine.Step.RelatedFields4, true); MyACE.DoStep(ACEngine.Step.RelatedFields5, true); MyACE.DoStep(ACEngine.Step.RelatedFields6, true); BuildForm(acsr); if (first) { foreach (DataView dv in MyACE.relTables.Values) { DataTable dt = dv.Table; dt.ColumnChanged += new DataColumnChangeEventHandler(dt_ColumnChanged); atLogic.ObjectBE obe = FM.GetBEFromTable(dt); obe.OnUpdate += new atLogic.UpdateEventHandler(ucSSTCase_OnUpdate); } first = false; } this.ResumeLayout(); }
public string A5JSON(int fileId, int acSeriesId) { atriumManager myAtmng = Helper.Atmng(); FileManager fm = myAtmng.GetFile(fileId); lmDatasets.ActivityConfig.ACSeriesRow acsr = fm.AtMng.acMng.DB.ACSeries.FindByACSeriesId(acSeriesId); atriumBE.ACEngine MyACE = new ACEngine(fm); MyACE.myAcSeries = acsr; MyACE.myActivityCode = acsr.ActivityCodeRow; MyACE.DoRelFields(); MyACE.DoStep(ACEngine.Step.RelatedFields0, true); MyACE.DoStep(ACEngine.Step.RelatedFields1, true); MyACE.DoStep(ACEngine.Step.RelatedFields2, true); MyACE.DoStep(ACEngine.Step.RelatedFields3, true); MyACE.DoStep(ACEngine.Step.RelatedFields4, true); MyACE.DoStep(ACEngine.Step.RelatedFields5, true); MyACE.DoStep(ACEngine.Step.RelatedFields6, true); string curobj = ""; string json = "{"; foreach (ActivityConfig.ActivityFieldRow arf in fm.AtMng.acMng.DB.ActivityField.Select("ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname")) { if (curobj != arf.ObjectAlias) { //start new row curobj = arf.ObjectAlias; json += "'" + arf.ObjectAlias + "':["; foreach (DataRowView dvr in MyACE.relTables[curobj]) { json += "{"; json += "'atrid':" + Newtonsoft.Json.JsonConvert.ToString(dvr.Row[dvr.Row.Table.PrimaryKey[0]]) + ","; foreach (ActivityConfig.ActivityFieldRow arfRow in fm.AtMng.acMng.DB.ActivityField.Select("ObjectAlias='" + curobj + "' and ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname")) { json += "'" + arfRow.FieldName + "':" + Newtonsoft.Json.JsonConvert.ToString(dvr.Row[arfRow.DBFieldName]) + ","; } json = json.TrimEnd(','); json += "},"; } json = json.TrimEnd(','); json += "]"; } else { } } return(json + "}"); // DataSet ds = new DataSet(); // foreach(DataView dv in MyACE.relTables.Values) // { // ds.Tables.Add(dv.ToTable()); // } // return Newtonsoft.Json.JsonConvert.SerializeObject(ds, Newtonsoft.Json.Formatting.Indented); //// return Json(ds,JsonRequestBehavior.AllowGet); }
public string A5JSONUpdate(int fileId, int acSeriesId, string json) { atriumManager myAtmng = Helper.Atmng(); FileManager fm = myAtmng.GetFile(fileId); lmDatasets.ActivityConfig.ACSeriesRow acsr = fm.AtMng.acMng.DB.ACSeries.FindByACSeriesId(acSeriesId); atriumBE.ACEngine MyACE = new ACEngine(fm); MyACE.myAcSeries = acsr; MyACE.myActivityCode = acsr.ActivityCodeRow; MyACE.DoRelFields(); MyACE.DoStep(ACEngine.Step.RelatedFields0, true); MyACE.DoStep(ACEngine.Step.RelatedFields1, true); MyACE.DoStep(ACEngine.Step.RelatedFields2, true); MyACE.DoStep(ACEngine.Step.RelatedFields3, true); MyACE.DoStep(ACEngine.Step.RelatedFields4, true); MyACE.DoStep(ACEngine.Step.RelatedFields5, true); MyACE.DoStep(ACEngine.Step.RelatedFields6, true); Newtonsoft.Json.Linq.JObject data = Newtonsoft.Json.Linq.JObject.Parse(json); //foreach (ActivityConfig.ActivityFieldRow arf in fm.AtMng.acMng.DB.ActivityField.Select("ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname")) foreach (string curobj in MyACE.relTables.Keys) { var table = data[curobj].Children().ToList(); MyACE.relTables[curobj].Sort = MyACE.relTables[curobj].Table.PrimaryKey[0].ColumnName; foreach (var row in table) { int rid = (int)row["atrid"]; int pos = MyACE.relTables[curobj].Find(row["atrid"]); DataRowView dvr = MyACE.relTables[curobj][pos]; //need to match up rows foreach (ActivityConfig.ActivityFieldRow arfRow in fm.AtMng.acMng.DB.ActivityField.Select("ObjectAlias='" + curobj + "' and ACSeriesId=" + acSeriesId.ToString() + " and TaskType in ('F','T')", "objectalias,fieldname")) { System.Diagnostics.Debug.WriteLine("{0}, {1}", dvr.Row[arfRow.DBFieldName], data[curobj][0][arfRow.FieldName]); } } } return(null); }
public void ExecuteAction(FileManager fm, DataRow dr2Validate, ActivityConfig.ACSeriesRow acsr) { dr2Validate.EndEdit(); ACEngine MyACE = new ACEngine(fm); MyACE.myAcSeries = acsr; MyACE.myActivityCode = acsr.ActivityCodeRow; MyACE.AddToRelTables(dr2Validate, "CONTEXT"); MyACE.DoRelFields(); if (MyACE.HasRel0) { MyACE.DoStep(ACEngine.Step.RelatedFields0, true); } if (MyACE.HasRel1) { MyACE.DoStep(ACEngine.Step.RelatedFields1, true); } if (MyACE.HasRel2) { MyACE.DoStep(ACEngine.Step.RelatedFields2, true); } if (MyACE.HasRel3) { MyACE.DoStep(ACEngine.Step.RelatedFields3, true); } if (MyACE.HasRel4) { MyACE.DoStep(ACEngine.Step.RelatedFields4, true); } if (MyACE.HasRel5) { MyACE.DoStep(ACEngine.Step.RelatedFields5, true); } if (MyACE.HasRel6) { MyACE.DoStep(ACEngine.Step.RelatedFields6, true); } if (MyACE.HasRel7) { MyACE.DoStep(ACEngine.Step.RelatedFields7, true); } if (MyACE.HasRel8) { MyACE.DoStep(ACEngine.Step.RelatedFields8, true); } if (MyACE.HasRel9) { MyACE.DoStep(ACEngine.Step.RelatedFields9, true); } if (MyACE.HasTimeline) { MyACE.DoStep(ACEngine.Step.Timeline, true); } //if (MyACE.HasDoc) //{ // docDB.DocumentRow dr = (docDB.DocumentRow)MyACE.relTables["Document0"][0].Row; // MyACE.DocumentDefaults(0 != 0); //} if (MyACE.HasBilling) { MyACE.DoStep(ACEngine.Step.Billing, true); } }
internal void DoACAllSteps(atriumDB.ActivityRow prevAC, ActivityConfig.ACSeriesRow asr, int revId, ACEngine.RevType revType, DateTime acDate, out ACEngine ace, out atriumDB.ActivityRow newAC, Stack <ParentChildStep> _flowQ, string conversationIndex) { atriumDB.ProcessRow pr = null; if (prevAC != null) { pr = prevAC.ProcessRow; } ace = Add(acDate, asr, pr, false, prevAC, ConnectorType.NextStep, _flowQ, revId, revType, conversationIndex, null); ace.ctx = ctx; newAC = ace.NewActivity; if (ace.HasRel0) { ace.DoStep(ACEngine.Step.RelatedFields0, true); } if (ace.HasRel1) { ace.DoStep(ACEngine.Step.RelatedFields1, true); } if (ace.HasRel2) { ace.DoStep(ACEngine.Step.RelatedFields2, true); } if (ace.HasRel3) { ace.DoStep(ACEngine.Step.RelatedFields3, true); } if (ace.HasRel4) { ace.DoStep(ACEngine.Step.RelatedFields4, true); } if (ace.HasRel5) { ace.DoStep(ACEngine.Step.RelatedFields5, true); } if (ace.HasRel6) { ace.DoStep(ACEngine.Step.RelatedFields6, true); } if (ace.HasRel7) { ace.DoStep(ACEngine.Step.RelatedFields7, true); } if (ace.HasRel8) { ace.DoStep(ACEngine.Step.RelatedFields8, true); } if (ace.HasRel9) { ace.DoStep(ACEngine.Step.RelatedFields9, true); } if (ace.HasTimeline) { ace.DoStep(ACEngine.Step.Timeline, true); } if (ace.HasDoc & !SkipDoc) { docDB.DocumentRow dr = (docDB.DocumentRow)ace.relTables["Document0"][0].Row; //if (TemplateCode != null) //only set the template if it is provided // dr.templateCode = TemplateCode; ace.DocumentDefaults(revId != 0); // if (dr.DocContentRow == null) //FM.GetDocMng().GetDocContent().Load(dr.DocRefId, dr.CurrentVersion); Doc0 = dr.DocContentRow.ContentsAsText; } else { ace.FM.GetDocMng().DB.RejectChanges(); ace.relTables.Remove("Document0"); ace.NewActivity.SetDocIdNull(); } if (ace.HasBilling) { ace.DoStep(ACEngine.Step.Billing, true); } }