public ICard(string name, int cost, EForm requiredForm, EForm shiftsInto) { this.name = name; this.cost = cost; this.requiredForm = requiredForm; this.shiftsInto = shiftsInto; }
/// <summary> /// Updates the EForm's HTML Transform and Current Status /// </summary> /// <param name="eformId"></param> /// <param name="narrative"></param> /// <param name="currentStatus"></param> /// <param name="userName"></param> /// <returns></returns> public bool UpdateEFormReport(int eformId, string narrative, string currentStatus, string userName) { bool returnVal = false; if (CanEditEForm()) { // update EForm record EForm eform = new EForm(); eform.Get(eformId); eform[EForm.EFormReport] = narrative; eform[EForm.CurrentStatus] = currentStatus; eform.Save(); // add log entry LogEForm(eformId, currentStatus); return(true); // add call to update EFormLog //returnVal = _da.UpdateEFormReport(eformId, narrative, currentStatus, userName); } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } return(returnVal); }
override protected void Page_Load(object sender, System.EventArgs e) { // view state is disabled in base control if (IsPreview) { _patientId = int.MinValue; } else { _patientId = int.Parse(Session[SessionKey.PatientId].ToString()); } // get eform id and name from url vars if (Request.QueryString["eformId"] != null) { _eformId = int.Parse(Request.QueryString["eformId"]); EForm eb = new EForm(); eb.Get(_eformId); _eformName = eb[EForm.EFormName].ToString(); } else { _eformName = Request.QueryString["eform"]; } if (!Page.IsPostBack) { this.OverrideLookupCodes(); this.PopulateEform(); } }
public Material(EElement element, EForm form, double quantityInKg) { Element = element; Form = form; PricePerKgInEur = ((int)element * 1.62M) + ((int)form * 3.14M); QuantityInKg = quantityInKg; }
/// <summary> /// Inserts a new EForm record /// </summary> /// <param name="userId"></param> /// <param name="patientId"></param> /// <param name="eformName"></param> /// <param name="eformXml"></param> /// <param name="currentStatus"></param> /// <param name="eformApptTime"></param> /// <param name="eformApptPhysician"></param> /// <returns></returns> public int InsertRecord(int userId, int patientId, string eformName, XmlDocument eformXml, string currentStatus, object eformApptTime, string eformApptPhysician) { int eformId; if (CanEditEForm()) { // create new EForm record EForm eform = new EForm(); eform[EForm.UserId] = userId; eform[EForm.PatientId] = patientId; eform[EForm.EFormName] = eformName; eform[EForm.EFormXML] = eformXml.InnerXml; eform[EForm.CurrentStatus] = currentStatus; eform[EForm.EformApptTime] = eformApptTime; eform[EForm.EformApptPhysician] = eformApptPhysician; // optional EForm Appt Fields SetEFormApptFields(eform, eformXml); // insert eform.Save(); eformId = (int)eform[EForm.EFormId]; // add log entry LogEForm(eformId, currentStatus); // newPrimKey = _da.InsertEFormsRecord(userId, patientId, eformName, eFormXmlString, currentStatus, _eformApptTime, _eformApptPhysician, userName); } else { throw new ClientException("Please contact your administrator to create this eform.", true); } return(eformId); }
/// <summary> /// Updates the EForm record with the XML, HTML Transform and Current Status. /// </summary> /// <param name="eformId"></param> /// <param name="eformXml"></param> /// <param name="eformHtml"></param> /// <param name="currentStatus"></param> public void UpdateEFormRecord(int eformId, XmlDocument eformXml, string eformHtml, string currentStatus) { if (CanEditEForm()) { // load existing EForm record EForm eform = new EForm(); eform.Get(eformId); eform[EForm.EFormXML] = eformXml.InnerXml; eform[EForm.EFormReport] = eformHtml; eform[EForm.CurrentStatus] = currentStatus; // optional EForm Appt Fields SetEFormApptFields(eform, eformXml); // update eform.Save(); // add log entry LogEForm(eformId, currentStatus); // _da.UpdateEFormRecord(eformId, eFormXmlString, eformHtml, currentStatus, userName); } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } }
public void PlayCards(Player player, Stack <ICard> playedCards) { if (waitForAction) { EForm predictedForm = CurrentPlayer.Form; //validate played cards foreach (ICard card in playedCards) { if (CurrentPlayer.AP >= card.Cost && (card.RequiredForm == EForm.NONE || predictedForm == card.RequiredForm)) { foreach (IAction action in card.Actions()) { actionStack.Push(action); } if (card.ShiftsInto != EForm.NONE) { predictedForm = card.ShiftsInto; } CurrentPlayer.AP -= card.Cost; } } actionStack.Push(new ExecuteTurn()); } }
/// <summary> /// Updates the EForm's Current Status /// </summary> /// <param name="eformId"></param> /// <param name="currentStatus"></param> /// <param name="userName"></param> public void UpdateEFormStatus(int eformId, string currentStatus, string userName) { if (CanEditEForm()) { // add call to update EFormLog // RULE :once an eform is approved, it can no longer be updated string status = this.GetEFormStatus(eformId); if (status != "" && status.IndexOf("Approved") == -1) // -1 then approved was not present, update { // update EForm status EForm eform = new EForm(); eform.Get(eformId); eform[EForm.CurrentStatus] = currentStatus; eform.Save(); // add log entry LogEForm(eformId, currentStatus); // _da.UpdateEFormStatus(eformId, currentStatus, userName); } } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UpdateEformStatuses(object sender, EventArgs e) { // manually update eform statuses foreach (int dirtyRowIndex in dirtyRows) { Control row = EFormActivityRptr.Items[dirtyRowIndex]; // get status text ICaisisInputControl eformIdField = row.FindControl("EFormId") as ICaisisInputControl; ICaisisInputControl statusField = row.FindControl("StatusField") as ICaisisInputControl; ICaisisInputControl EFormApptPhysicianField = row.FindControl("EFormApptPhysicianField") as ICaisisInputControl; ICaisisInputControl EFormApptTimeField = row.FindControl("EFormApptTimeField") as ICaisisInputControl; // load record and update status field int eformId = int.Parse(eformIdField.Value); BOL.EForm biz = new EForm(); biz.Get(eformId); biz[BOL.EForm.CurrentStatus] = statusField.Value; biz[BOL.EForm.EformApptPhysician] = EFormApptPhysicianField.Value; biz[BOL.EForm.EformApptTime] = EFormApptTimeField.Value; biz.Save(); } // rebind list to show updated statuses BuildEformStatusList(BOL.EForm.EFormId, SortDirection.Ascending); }
public EFormController() { _da = new EFormsDa(); // v4 _primKeyName = _da.PrimaryKeyName; EForm eform = new EForm(); _primKeyName = eform.PrimaryKeyName; }
protected void DeleteEform(object sender, CommandEventArgs e) { // delete eform int eformId = int.Parse(e.CommandArgument.ToString()); BOL.EForm eForm = new EForm(); eForm.Delete(eformId); // rebind eform list BuildEformStatusList(BOL.EForm.EFormId, SortDirection.Ascending); }
protected override bool VLoadGame() { EForm.LoadComponentDefinitions(); Logic.UnloadScene(null); Logic.LoadScene(CurrentScene, CurrentResourceBundle, "Root"); EForm.InitializeSceneEntities(); EForm.InitializeTools(); EForm.InitializeAssets(); EForm.InitializeEntityTypes(); return(true); }
public void Reset(EForm startForm = EForm.GRAY) { handCards = new List <ICard>(); deck = new Stack <ICard>(); selectedCards = new Stack <ICard>(); indices = new Stack <int>(); health = MAX_HEALTH; Form = EForm.GRAY; Position = SpawnPosition; ap = 0; }
/// <summary> /// For the given EForm, set Appt fields based on optional XML overrides /// </summary> /// <param name="eform"></param> /// <param name="eformXml"></param> public void SetEFormApptFields(EForm eform, XmlDocument eformXml) { Dictionary <string, object> eFormApptFields = GetEFormApptFields(eformXml); if (eFormApptFields.ContainsKey(EForm.EformApptTime)) { eform[EForm.EformApptTime] = eFormApptFields[EForm.EformApptTime]; } if (eFormApptFields.ContainsKey(EForm.EformApptPhysician)) { eform[EForm.EformApptPhysician] = eFormApptFields[EForm.EformApptPhysician]; } }
/// <summary> /// Returns the XmlDocuemnt represented in the eform record /// </summary> /// <returns></returns> private XmlDocument GetEformXml() { // load eform XmlDocument eformXML = new XmlDocument(); int eformId = int.Parse(EformId); EForm eForm = new EForm(); eForm.Get(eformId); if (!eForm.IsNull(BOL.EForm.EFormXML)) { eformXML.LoadXml(eForm[BOL.EForm.EFormXML].ToString()); } return(eformXML); }
private object TranslateData(EForm attributeForm, object data) { switch (attributeForm) { case EForm.DW_FORM_strp: return(_data.StringSection.GetString(Convert.ToInt64(data))); case EForm.DW_FORM_flag: return(Convert.ToInt64(data) != 0); case EForm.DW_FORM_indirect: var form = (EForm)Enum.Parse(typeof(EForm), (string)data); data = ParseForm(form); return(TranslateData(form, data)); } return(data); }
protected void Page_Load(object sender, EventArgs e) { string docType = Request.QueryString["docType"]; string eFormId = Request.QueryString["eFormId"]; if (!string.IsNullOrEmpty(eFormId)) { int id = int.Parse(eFormId); if (!string.IsNullOrEmpty(docType)) { docType = docType == "xml" ? "text/xml" : "text/html"; } else { docType = "text/html"; } Response.ContentType = docType; EForm biz = new EForm(); biz.Get(id); if (docType == "text/xml") { Response.Write(biz[EForm.EFormXML]); } else { object s = biz[EForm.EFormReport]; if (s != null) { if (s.ToString() != "" && s != DBNull.Value) { Response.Write(biz[EForm.EFormReport]); } } else { Response.Write("<html><head></head><body></body></html>"); } } } else { Response.Write("<html><head></head><body></body></html>"); } }
/// <summary> /// Updates the EForm's XML and Current Status /// </summary> /// <param name="eformId"></param> /// <param name="s"></param> /// <param name="currentStatus"></param> /// <param name="userName"></param> /// <returns></returns> public int UpdateEFormXml(int eformId, string s, string currentStatus, string userName) { if (CanEditEForm()) { // update the EForm record EForm eform = new EForm(); eform.Get(eformId); eform[EForm.EFormXML] = s; eform[EForm.CurrentStatus] = currentStatus; eform.Save(); // add log entry LogEForm(eformId, currentStatus); // possibly add call to update EFormLog ; will update very often //_da.UpdateEFormXml(eformId, s, currentStatus, userName); } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } // should return xml string used to repopulate form return(eformId); }
/// <summary> /// Create a new instance of a GenericEFormViewer /// </summary> /// <param name="eformId">The Eform Id to create a generic eform view</param> public GenericEFormViewer(int eformId) { biz = new EForm(); biz.Get(eformId); }
/// <summary> /// Insert EForm /// </summary> /// <param name="obj">EForm</param> /// <returns>Message</returns> public Message InsertEForm(EForm obj) { Message msg = null; obj.CreateDate = DateTime.Now; // Get max index then add 1; //obj.FormIndex = GetMaxIndex(obj.MasterID, obj.PersonID, obj.PersonType) + 1; try { if (obj != null) { int result = dbContext.sp_InsertEForm(obj.MasterID, obj.PersonID, obj.PersonType, obj.FormIndex, obj.CreatedBy); dbContext.SubmitChanges(); // new EFormLogDao().WriteLogForEForm(null, obj, ELogAction.Insert); msg = new Message(MessageConstants.I0001, MessageType.Info, "New record(s) ", "added"); } } catch (Exception) { dbContext.SubmitChanges(); // Show system error msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
private object ParseForm(EForm form) { return(sFormReaders.ContainsKey(form) ? sFormReaders[form](_stream) : null); }
public Message Update(PerformanceReview pr, string eformMasterId) { Message msg = null; EmployeeDao empDao = new EmployeeDao(); EformDao eformDao = new EformDao(); DbTransaction trans = null; try { if (dbContext.Connection.State == System.Data.ConnectionState.Closed) { dbContext.Connection.Open(); } trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; EForm oldEform = null; PerformanceReview prDB = GetById(pr.ID); //Update eform EForm eform = new EForm(); if (!pr.EForm.MasterID.Equals(eformMasterId)) { //Delete old eform oldEform = pr.EForm; //Insert new eform eform.MasterID = eformMasterId; eform.PersonID = pr.EmployeeID; eform.PersonType = (int)Constants.PersonType.Employee; eform.FormIndex = 1; eform.CreateDate = DateTime.Now; eform.CreatedBy = pr.CreatedBy; dbContext.EForms.InsertOnSubmit(eform); dbContext.SubmitChanges(); pr.EForm = eform; } //Update performance Review prDB.AssignID = pr.AssignID; prDB.EForm = pr.EForm; prDB.AssignRole = pr.AssignRole; prDB.CCEmail = pr.CCEmail; prDB.InvolveDate = pr.InvolveDate; prDB.InvolveID = pr.InvolveID; prDB.InvolveResolution = pr.InvolveResolution; prDB.InvolveRole = pr.InvolveRole; prDB.NextReviewDate = pr.NextReviewDate; prDB.PRDate = pr.PRDate; prDB.UpdateDate = DateTime.Now; prDB.UpdatedBy = pr.UpdatedBy; prDB.WFResolutionID = pr.WFResolutionID; if(oldEform!=null) dbContext.EForms.DeleteOnSubmit(oldEform); dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance Review \"" + pr.ID + "\"", "updated"); trans.Commit(); } catch { trans.Rollback(); msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
/// <summary> /// Insert performance review /// </summary> /// <param name="pr">PerformanceReview</param> /// <param name="eformMasterId">string</param> /// <returns>Message</returns> public Message Insert(PerformanceReview pr, string eformMasterId) { Message msg = null; EmployeeDao empDao = new EmployeeDao(); EformDao eformDao = new EformDao(); DbTransaction trans = null; try { if (dbContext.Connection.State == System.Data.ConnectionState.Closed) { dbContext.Connection.Open(); } trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; EForm eform = new EForm(); eform.MasterID = eformMasterId; eform.PersonID = pr.EmployeeID; eform.PersonType = (int)Constants.PersonType.Employee; eform.FormIndex = 1; eform.CreateDate = DateTime.Now; eform.CreatedBy = pr.CreatedBy; dbContext.EForms.InsertOnSubmit(eform); dbContext.SubmitChanges(); pr.ID = GetNewPrId(pr.EmployeeID); pr.EFormID = eform.ID; dbContext.PerformanceReviews.InsertOnSubmit(pr); msg = new Message(MessageConstants.I0001, MessageType.Info, "PR", "setup"); dbContext.SubmitChanges(); trans.Commit(); } catch { trans.Rollback(); msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
public Shapeshift(EForm targetForm) { actionName = "ShapeShift"; this.targetForm = targetForm; }
// REALLY ugly hack due deadline public Sprite getAnimation(string name, EForm form) { switch (form) { case EForm.GRAY: { switch (name) { case "idle": { return(gray_idle); break; } case "run": { return(gray_run); break; } case "blast": { return(gray_blast); break; } case "guard": { return(gray_guard); break; } case "boom_0": { return(gray_boom_0); break; } case "boom_1": { return(gray_boom_1); break; } case "boom_2": { return(gray_boom_2); break; } } break; } case EForm.GREEN: { switch (name) { case "idle": { return(green_idle); break; } case "fireblast": { return(green_fireblast); break; } case "pierce_shot": { return(green_pierce_shot); break; } case "yellowblast": { return(green_yellowblast); break; } case "guard": { return(green_guard); break; } } break; } case EForm.YELLOW: { switch (name) { case "idle": { return(yellow_idle); break; } case "run": { return(yellow_run); break; } case "punch": { return(yellow_punch); break; } case "dash": { return(yellow_dash); break; } case "serious_punch": { return(yellow_serious_punch); break; } case "blast": { return(yellow_blast); break; } case "ura_0": { return(yellow_ura_0); break; } case "ura_1": { return(yellow_ura_1); break; } case "ura_2": { return(yellow_ura_2); break; } case "guard": { return(yellow_guard); break; } } break; } case EForm.RED: { switch (name) { case "idle": { return(red_idle); break; } case "run": { return(red_run); break; } case "slash": { return(red_slash); break; } case "spear_dash": { return(red_spear_dash); break; } case "guard": { return(red_guard); break; } } break; } } return(null); }
/// <summary> /// Implementation of <see cref="IWorkflowScript.OnWorkflowScriptExecute" />. /// <seealso cref="IWorkflowScript" /> /// </summary> /// <param name="app">Unity Application object</param> /// <param name="args">Workflow event arguments</param> // public void OnWorkflowScriptExecute(Application app, WorkflowEventArgs args) //public void OnWorkflowScriptExecute(Application app, WorkflowEventArgs args = null) public void OnWorkflowScriptExecute(Hyland.Unity.Application app, Hyland.Unity.WorkflowEventArgs args) { try { // Initialize global settings IntializeScript(ref app, ref args); KeywordType kwtLicenseType = _currentDocument.DocumentType.KeywordRecordTypes.FindKeywordType(gParamLicType); string strLicenseType = ""; if (kwtLicenseType != null) { KeywordRecord keyRecLicenseType = _currentDocument.KeywordRecords.Find(kwtLicenseType); if (keyRecLicenseType != null) { Keyword kwdLicenseType = keyRecLicenseType.Keywords.Find(kwtLicenseType); if (kwdLicenseType != null) { strLicenseType = CleanSeedKW(kwdLicenseType.ToString()); } } } KeywordType kwtLicenseNum = _currentDocument.DocumentType.KeywordRecordTypes.FindKeywordType(gParamFileNumber); string strFileNum = ""; if (kwtLicenseNum != null) { KeywordRecord keyRecLicenseNum = _currentDocument.KeywordRecords.Find(kwtLicenseNum); if (keyRecLicenseNum != null) { Keyword kwdLicenseNum = keyRecLicenseNum.Keywords.Find(kwtLicenseNum); if (kwdLicenseNum != null) { strFileNum = CleanSeedKW(kwdLicenseNum.ToString()); } } } if ((strFileNum == "") || (strLicenseType == "")) { throw new Exception(string.Format("Either {0} or {1} is blank.", gParamFileNumber, gParamLicType)); } //access Config Item for LicEase User string gUSER = ""; if (app.Configuration.TryGetValue("LicEaseUser", out gUSER)) { } //access Config Item for LicEase Password string gPASS = ""; if (app.Configuration.TryGetValue("LicEasePassword", out gPASS)) { } /* COMMENT THIS SECTION OUT WHEN MOVING TO PROD */ //access Config Item for LicEase UAT ODBC string gODBC = ""; if (app.Configuration.TryGetValue("LicEaseUAT", out gODBC)) { } /* UNCOMMENT THIS SECTION WHEN MOVING TO PROD * //access Config Item for LicEase PROD ODBC * string gODBC = ""; * if (app.Configuration.TryGetValue("LicEasePROD", out gODBC)) * { * } */ string connectionString = string.Format("DSN={0};Uid={1};Pwd={2};", gODBC, gUSER, gPASS); app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Verbose, string.Format("Connection string: {0}", connectionString)); StringBuilder strSql = new StringBuilder(); strSql.Append(@"select * from (select distinct(c.cmpln_nbr) as CASENUMBER, becec.enf_cde as ACTYPE, c.rcv_dte as ISSUEDATE, to_char(cacat.actv_strt_dte, 'MM/DD/YYYY') as CLERKEDDATE, ccscs.cmpln_sta_cde as COMPSTATUS, c.clnt_cde as LICTYPE "); strSql.Append(@", c1_mc.chrg_amt as FINEAMT from cmpln c inner join (select ec.enf_cde, bec.clnt_enf_cde_id from brd_enf_cde bec inner join enf_cde ec on bec.enf_cde_id = ec.enf_cde_id where (ec.enf_cde like 'CLOS' or ec.clnt_cde like 'AD%' or ec.enf_cde like 'AC%') ) becec on c.clnt_cmpln_cls_id = becec.clnt_enf_cde_id inner join "); strSql.Append(@"(select cs.cmpln_sta_cde, ccs.clnt_cmpln_sta_id from clnt_cmpln_sta ccs inner join cmpln_sta cs on ccs.cmpln_sta_id = cs.cmpln_sta_id ) ccscs on c.clnt_cmpln_sta_id = ccscs.clnt_cmpln_sta_id inner join (select l.file_nbr, l.clnt_cde, l.lic_id, r.cmpln_id from rspn r inner join lic l on r.lic_id = l.lic_id ) rl "); strSql.Append(@" on c.cmpln_id = rl.cmpln_id left outer join (select ca.actv_strt_dte, ca.cmpln_id from cmpln_actv ca inner join cmpln_actv_typ cat on ca.cmpln_actv_typ_id = cat.cmpln_actv_typ_id where cat.cmpln_actv_typ_cde = 'A400' ) cacat on c.cmpln_id = cacat.cmpln_id left outer join (select mc.chrg_amt, c1.cmpln_id from cmply_ordr c1 inner join misc_chrg mc on c1.misc_chrg_id = mc.misc_chrg_id ) c1_mc on c.cmpln_id = c1_mc.cmpln_id where rl.file_nbr = '"); strSql.Append(strFileNum); strSql.Append(@"' and rl.clnt_cde = '"); strSql.Append(strLicenseType); strSql.Append(@"' and c.rcv_dte > (SYSDATE - 1826) and c.clnt_cde like '20%' and c.cmpln_nbr > '2010%') order by 1 desc "); using (OdbcConnection con = new OdbcConnection(connectionString)) { try { con.Open(); using (OdbcCommand command = new OdbcCommand(strSql.ToString(), con)) using (OdbcDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { lstProp1.Add(reader["CASENUMBER"].ToString()); lstProp2.Add(reader["ACTYPE"].ToString()); lstProp3.Add(reader["ISSUEDATE"].ToString()); lstProp4.Add(reader["CLERKEDDATE"].ToString()); lstProp5.Add(reader["COMPSTATUS"].ToString()); lstProp6.Add(reader["LICTYPE"].ToString()); lstProp7.Add(reader["FINEAMT"].ToString()); } // Create keyword modifier object to hold keyword changes EForm currentForm = _currentDocument.EForm; FieldModifier fieldModifier = currentForm.CreateFieldModifier(); foreach (string props in lstProp1) { if (props != null) { fieldModifier.UpdateField("CASENUMBER", props); } } foreach (string props in lstProp2) { if (props != null) { fieldModifier.UpdateField("ACTYPE", props); } } foreach (string props in lstProp3) { if (props != null) { fieldModifier.UpdateField("ISSUEDATE", props); } } foreach (string props in lstProp4) { if (props != null) { fieldModifier.UpdateField("CLERKEDDATE", props); } } foreach (string props in lstProp5) { if (props != null) { fieldModifier.UpdateField("COMPSTATUS", props); } } foreach (string props in lstProp6) { if (props != null) { fieldModifier.UpdateField("LICTYPE", props); } } foreach (string props in lstProp7) { if (props != null) { fieldModifier.UpdateField("FINEAMT", props); } } using (DocumentLock documentLock = _currentDocument.LockDocument()) { // Ensure lock was obtained if (documentLock.Status != DocumentLockStatus.LockObtained) { throw new Exception("Document lock not obtained"); } // Apply keyword change to the document fieldModifier.ApplyChanges(); documentLock.Release(); } } else { throw new Exception(string.Format("No records found in database for {0}='{1}' and {4}{2}='{3}' ", gParamLicType, strLicenseType, gParamFileNumber, strFileNum, Environment.NewLine)); } } } catch (Exception ex) { throw new ApplicationException("Error during database operations!", ex); } finally { if (con.State == ConnectionState.Open) { con.Close(); } } } } catch (Exception ex) { // Handle exceptions and log to Diagnostics Console and document history HandleException(ex, ref app, ref args); } finally { // Log script execution end app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Info, string.Format("End Script - [{0}]", ScriptName)); } }
/// <summary> /// /// </summary> /// <param name="bizObj">The Eform Biz Object to create a generic eform view</param> public GenericEFormViewer(EForm bizObj) { biz = bizObj; }
private void Save() { // required string sourceTable = SourceTables.SelectedValue; string destTable = DestTableName; int? destPriKey = null; Dictionary <string, Dictionary <int, string> > tablesRecordsAndKeys = new Dictionary <string, Dictionary <int, string> >(); tablesRecordsAndKeys.Add(sourceTable, new Dictionary <int, string>()); var recordsAndKeys = tablesRecordsAndKeys[sourceTable]; // determine if using actual records or eform if (IsActualRecord) { destPriKey = int.Parse(DestTablePrimaryKey); } foreach (RepeaterItem item in TableRecordsRptr.Items) { // get related record if (if it exists) HiddenField srcTableKeyField = item.FindControl("SrcTablePriKey") as HiddenField; HiddenField relatedRecordIdField = item.FindControl("RelatedRecordId") as HiddenField; // get dest key (should always exist) int srcPriKey = int.Parse(srcTableKeyField.Value); // get existing related record (if exists) int?relatedRecordId = null; if (!string.IsNullOrEmpty(relatedRecordIdField.Value)) { relatedRecordId = int.Parse(relatedRecordIdField.Value); } // iterate relation strengths and insert/update/delete relation (if applicable) bool doDelete = true; // mark inital strength for update/insert/delete, empty recordsAndKeys[srcPriKey] = string.Empty; foreach (int relationStrength in RelationStrengths) { RadioButton relationRadio = item.FindControl("Relation_Radio_" + relationStrength) as RadioButton; if (relationRadio.Checked) { // once an item is checked, no need to delete doDelete = false; // mark updated relation recordsAndKeys[srcPriKey] = relationStrength.ToString(); // if record exists (updated strength) if (relatedRecordId.HasValue) { RelatedRecord biz = new RelatedRecord(); biz.Get(relatedRecordId.Value); biz[RelatedRecord.RelationStrength] = relationStrength; biz.Save(); } // if there is a destination, update else if (destPriKey.HasValue) { RelatedRecord biz = RelatedRecordController.CreateRelatedRecord(RelatedRecordController.SOURCE_SYSTEM, sourceTable, srcPriKey, destTable, destPriKey.Value, relationStrength, true); } else if (IsEform) { // handled by update map } // only 1 checked radio per row break; } } // if no items have been checked, remove related record if (doDelete) { // delete real relation if (relatedRecordId.HasValue) { RelatedRecord biz = new RelatedRecord(); biz.Delete(relatedRecordId.Value); // update keys relatedRecordId = null; relatedRecordIdField.Value = string.Empty; } // delete eform reation else if (IsEform) { // handled by update map } } } // for eforms, insert/update/delete relationships if (IsEform) { // udpate xml XmlDocument eformXML = GetEformXml(); rc.UpdateEformRelatedRecords(eformXML, DestTableName, EformRecordId, tablesRecordsAndKeys); // update record EForm biz = new EForm(); biz.Get(int.Parse(EformId)); biz[EForm.EFormXML] = eformXML.OuterXml; biz.Save(); } // Register update script if (!string.IsNullOrEmpty(RelatedClientId))// && sourceTable == SrcTableName) { var relationStrengths = tablesRecordsAndKeys.SelectMany(a => a.Value.Select(b => b.Value)).Where(a => !string.IsNullOrEmpty(a)); string clientRelationArray = "[" + string.Join(",", relationStrengths.ToArray()) + "]"; Page.ClientScript.RegisterStartupScript(this.GetType(), "refreshAndCloseRelatedRecords", "refreshAndCloseRelatedRecords('" + RelatedClientId + "', " + clientRelationArray + ");", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "refreshAndCloseRelatedRecords", "refreshAndCloseRelatedRecords();", true); } }