/// <summary> /// Returns the order as a response xml doc /// </summary> /// <param name="parent"></param> /// <returns></returns> public XmlDocument GetResponse() { XmlDocument rXml = new XmlDocument(); rXml.CreateXmlDeclaration("1.0", "utf-8", null); XmlElement rXmlRoot = rXml.CreateElement("response"); rXml.AppendChild(rXmlRoot); //rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "AccountInternalId", this.Account.InternalId)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "ClientName", this.ClientName)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "ClosingDate", this.ClosingDate.ToShortDateString())); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyUse", this.PropertyUse)); //rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "Created", this.Created.ToShortDateString())); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "CustomerId", this.CustomerId)); //rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "CustomerStatusCode", this.CustomerStatusCode)); //rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "Id", this.Id.ToString())); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "InternalId", this.InternalId)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "InternalATSId", this.InternalATSId)); //rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "InternalStatusCode", this.InternalStatusCode)); //rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "Modified", this.Modified.ToShortDateString())); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PIN", this.Pin)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "AdditionalPins", this.AdditionalPins)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyAddress", this.PropertyAddress)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyAddress2", this.PropertyAddress2)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyCity", this.PropertyCity)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyCounty", this.PropertyCounty)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyState", this.PropertyState)); rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, "PropertyZip", this.PropertyZip)); return(rXml); }
protected void UpdateSettings() { Affinity.Account me = this.GetAccount(); me.FirstName = txtFirstName.Text; me.LastName = txtLastName.Text; me.Email = txtEmail.Text; me.PreferencesXml = XmlForm.XmlToString(xmlForm.GetResponse(pnlPreferences)); me.Update(); if (txtPassword.Text != "") { // password change is being attempted if (txtPassword.Text == txtPasswordConfirm.Text) { me.Password = txtPassword.Text; me.SetPassword(); this.Master.ShowFeedback("Your preferences have been updated and your password has been changed", MasterPage.FeedbackType.Information); } else { // password fields don't match this.Master.ShowFeedback("The password confirmation did not match. Your password was not updated", MasterPage.FeedbackType.Error); } } else { // password was not changed this.Master.ShowFeedback("Your preferences have been updated", MasterPage.FeedbackType.Information); } me.ClearPreferenceCache(); // force preferences to be reloaded this.SetAccount(me); // refresh the session }
/// <summary> /// returns an XML Document with all key/value pairs for this request /// </summary> /// <param name="keyAttribute">the key attribute used for the hash key (name, sp_id, rei_id, etc)</param> /// <param name="includeOrder">true if the order fields should be included</param> /// <param name="includeBlankValues">true if blank values should be included</param> /// <returns>XmlDocument</returns> public XmlDocument GetTranslatedResponse(string keyAttribute, bool includeOrder, bool includeBlankValues) { Hashtable ht = this.GetTranslatedHashTable(keyAttribute, includeOrder, includeBlankValues); XmlDocument rXml = new XmlDocument(); rXml.CreateXmlDeclaration("1.0", "utf-8", null); XmlElement rXmlRoot = rXml.CreateElement("response"); rXml.AppendChild(rXmlRoot); ArrayList keys = new ArrayList(ht.Keys); keys.Sort(); foreach (string key in keys) { if (!key.EndsWith("_validator")) { rXmlRoot.AppendChild(XmlForm.GetXmlField(rXml, key.ToString(), ht[key].ToString())); } } return(rXml); }
override protected void PageBase_Init(object sender, System.EventArgs e) { // we have to call the base first so phreezer is instantiated base.PageBase_Init(sender, e); int id = NoNull.GetInt(Request["id"], 0); this.account = new Affinity.Account(this.phreezer); this.RequirePermission(Affinity.RolePermission.AffinityManager); if (!id.Equals(0)) { this.account.Load(id); } else { this.account.RoleCode = Affinity.Role.DefaultCode; this.account.CompanyId = Affinity.Company.DefaultId; } rtype = new Affinity.RequestType(this.phreezer); rtype.Load(Affinity.RequestType.UserPreferences); xmlForm = new XmlForm(this.account); LoadForm(); }
private IShapeHandler GetShapeHandler(Hashtable dictionary, Shape shape, string shapeName, string mode) { IShapeHandler shapeHandler = (IShapeHandler)dictionary[shape]; if (shapeHandler != null) { return(shapeHandler); } XmlForm form = new XmlForm(); form.LoadDefinition(shapeName, shape); form.SkipDesign = _skip; if (!_skip) { form.Design(mode); } shapeHandler = (IShapeHandler)form.Tag; shapeHandler.LoadProperties(); dictionary[shape] = shapeHandler; return(shapeHandler); }
/// <summary> /// Initializes a new instance of the BaseShape class. /// </summary> /// <param name="shape">Visio shape on which it is based.</param> /// <param name="form">Form </param> /// <param name="attributes">Configuration attributes.</param> public BaseShape(object shape, XmlForm form, XmlElement attributes) { _shape = (Shape)shape; _form = form; _attributes = attributes; _element = _attributes.Attributes["element"].Value; _type = (ModelShapeType)Enum.Parse(typeof(ModelShapeType), _attributes.Attributes["type"].Value, true); }
public Affinity.WsResponse SyncRequest(Affinity.WsToken token, System.Xml.XmlDocument doc) { Affinity.WsResponse resp = new Affinity.WsResponse(); Phreezer phreezer = new Phreezer(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString); try { Hashtable ht = new Hashtable(); XmlNodeList fields = doc.GetElementsByTagName("field"); // enumerate all the fields and convert to a hashtable foreach (XmlNode field in fields) { ht.Add(XmlForm.GetAttribute(field, "sp_id"), field.InnerText); } if (ht.ContainsKey("WEB_ID") == false || ht["WEB_ID"].Equals("")) { throw new Exception("WEB_ID is required"); } if (ht.ContainsKey("AFF_ID") == false || ht["AFF_ID"].Equals("")) { throw new Exception("AFF_ID is required"); } Affinity.Order order = new Affinity.Order(phreezer); order.Load(ht["WEB_ID"]); if (order.InternalId.Equals("")) { // the order doesn't have an AFF ID so this is a confirmation // we have to get the system settings to pass them in to the order confirm method Hashtable settings = (Hashtable)Application[Affinity.SystemSetting.DefaultCode]; resp = order.Confirm(ht["AFF_ID"].ToString(), settings); } else { resp.IsSuccess = true; resp.ActionWasTaken = false; resp.Message = "No action was taken"; } } catch (Exception ex) { resp.Message = ex.Message; } finally { phreezer.Close(); } return(resp); }
/// <summary> /// The form controls are created at this point. if we create them at page load /// then their viewstate will not be persisted. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> override protected void PageBase_Init(object sender, System.EventArgs e) { // we have to call the base first so phreezer is instantiated base.PageBase_Init(sender, e); rtype = new Affinity.RequestType(this.phreezer); rtype.Load(Affinity.RequestType.UserPreferences); xmlForm = new XmlForm(this.GetAccount()); LoadForm(); }
protected void UpdateSettings() { Affinity.SystemSetting ss = new Affinity.SystemSetting(this.phreezer); ss.Load(Affinity.SystemSetting.DefaultCode); ss.Data = XmlForm.XmlToString(xmlForm.GetResponse(pnlForm)); ss.Update(); // we have to update the application global as well because otherwise it won't // reflect the changes until the web application is restarted Application[Affinity.SystemSetting.DefaultCode] = ss.Settings; this.Master.ShowFeedback("System Settings have been updated", MasterPage.FeedbackType.Information); }
override protected void PageBase_Init(object sender, System.EventArgs e) { // we have to call the base first so phreezer is instantiated base.PageBase_Init(sender, e); int id = NoNull.GetInt(Request["id"], 0); request = new Affinity.Request(this.phreezer); this.request.Load(id); // add the form for the request details XmlForm xf = new XmlForm(this.request.Account); pnlDetails.Controls.Add(xf.GetFormFieldControl(request.RequestType.Definition, request.Xml)); }
/// <summary> /// returns a hashtable with all key/value pairs for this request /// </summary> /// <param name="keyAttribute">the key attribute used for the hash key (name, sp_id, rei_id, etc)</param> /// <param name="includeOrder">true if the order fields should be included</param> /// <param name="includeBlankValues">true if blank values should be included</param> /// <returns>Hashtable</returns> public Hashtable GetTranslatedHashTable(string keyAttribute, bool includeOrder, bool includeBlankValues) { Hashtable ht = new Hashtable(); if (keyAttribute.Equals("name")) { // this is faster because the reponse has the name attribute included ht = XmlForm.GetResponseHashtable(this.Xml); } else { // this is slower because we need the definition to translate ht = XmlForm.GetTranslatedHashtable(this.RequestType.GetDefDocument(), this.GetResponse(), keyAttribute, includeBlankValues); } // if the order should be included, include it - unless this is // the default change code, which contains all of the details of the order if (includeOrder && this.RequestTypeCode != Affinity.RequestType.DefaultChangeCode) { Hashtable oht = this.Order.GetTranslatedHashTable(keyAttribute, includeBlankValues); foreach (string key in oht.Keys) { if (ht.ContainsKey(key)) { if (ht[key].ToString() == oht[key].ToString() || oht[key].ToString() == "") { // we are inserting the exact same value twice, or else a previous value // was entered but the new value is blank. either way, this will just // clutter up the export, so we will ignore the new value } else if (ht[key].ToString() == "") { // the key exists, but is empty so don't prepend the comma ht[key] = oht[key]; } else { ht[key] = ht[key].ToString() + ", " + oht[key]; } } else { ht.Add(key, oht[key]); } } } return(ht); }
/// <summary> /// The form controls are created at this point. if we create them at page load /// then their viewstate will not be persisted. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> override protected void PageBase_Init(object sender, System.EventArgs e) { // we have to call the base first so phreezer is instantiated base.PageBase_Init(sender, e); rtype = new Affinity.RequestType(this.phreezer); rtype.Load(Affinity.RequestType.SystemSettings); xmlForm = new XmlForm(this.GetAccount()); LoadForm(); //Affinity.SystemSetting ss = new Affinity.SystemSetting(this.phreezer); //ss.Load("SYSTEM"); //pnlForm.Controls.Add(xmlForm.GetFormFieldControl(rtype.Definition, ss.Data)); }
/// <summary> /// Handles the marker events. /// </summary> /// <param name="context">Parsed event context.</param> private void HandleMarkerEvent(NameValueCollection context) { Shape shape = VisioUtils.GetShape(_application, context); if (shape == null) { return; } string shapeName = VisioUtils.GetProperty(shape, "User", "Midgard"); if (shapeName == null) { // se for um visio desenhado com a versão antiga (sem os layers) shapeName = VisioUtils.GetShapeType(shape); if (shapeName == null) { return; } } string command = context["cmd"]; if (command == null) { return; } /* * */ string mode = "live";// GetMode(); using (XmlForm form = new XmlForm()) { form.LoadDefinition(shapeName, shape); form.Design(mode, Application.ActivePage); IShapeHandler shapeHandler = (IShapeHandler)form.Tag; DisplaySettings newSettings = shapeHandler.Execute(command, context, _displaySettings, _forceFormChange); if (newSettings != null) { _displaySettings = newSettings; } } }
/// <summary> /// returns a hashtable with all the keys equal to the order fields /// </summary> /// <param name="keyAttribute"></param> /// <returns></returns> public Hashtable GetTranslatedHashTable(string keyAttribute, bool includeBlankValues) { Hashtable ht = new Hashtable(); if (keyAttribute.Equals("name")) { // this is faster because the reponse has the name attribute included ht = XmlForm.GetResponseHashtable(this.GetResponse()); } else { // this is slower because we need the definition to translate Affinity.RequestType rt = new Affinity.RequestType(this.phreezer); rt.Load(Affinity.RequestType.DefaultChangeCode); ht = XmlForm.GetTranslatedHashtable( rt.GetDefDocument(), this.GetResponse(), keyAttribute, includeBlankValues); } return(ht); }
/// <summary> /// Persist to DB /// </summary> protected void UpdateAccount(bool createNew) { this.account.Username = txtUsername.Text; this.account.FirstName = txtFirstName.Text; this.account.LastName = txtLastName.Text; this.account.StatusCode = "Active"; this.account.Modified = DateTime.Now; this.account.PasswordHint = txtPasswordHint.Text; // this.account.PreferencesXml = txtPreferencesXml.Text; this.account.RoleCode = ddRole.SelectedValue; this.account.CompanyId = int.Parse(ddCompany.SelectedValue); this.account.InternalId = txtInternalId.Text; this.account.Email = txtEmail.Text; this.account.BusinessLicenseID = txtBusinessLicenseId.Text; this.account.IndividualLicenseID = txtIndividualLicenseId.Text; // underwriter codes - convert the checkbox list into a comma-separated value this.account.UnderwriterCodes = ""; string delim = ""; foreach (ListItem cb in cblUnderwriterCodes.Items) { if (cb.Selected) { this.account.UnderwriterCodes += delim + cb.Value; delim = ","; } } this.account.UnderwriterEndorsements = ""; delim = ""; foreach (ListItem cb in Endorse100.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } foreach (ListItem cb in Endorse90.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } foreach (ListItem cb in Endorse88.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } foreach (ListItem cb in Endorse85.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } foreach (ListItem cb in Endorse80.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } foreach (ListItem cb in Endorse75.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } foreach (ListItem cb in Endorse70.Items) { if (cb.Selected) { this.account.UnderwriterEndorsements += delim + cb.Value; delim = ","; } } //Response.Write(this.account.UnderwriterCodes); //Response.End(); this.account.PreferencesXml = XmlForm.XmlToString(xmlForm.GetResponse(pnlPreferences)); if (this.account.Id > 0 && !createNew) { this.account.Update(); } else { Response.Write(this.account.Username); this.account.Insert(); this.account.Password = "******"; this.account.SetPassword(); this.Redirect("AdminAccount.aspx?id=" + this.account.Id.ToString()); } //update the password only if it was supplied if (!txtPassword.Text.Equals("")) { this.account.Password = txtPassword.Text; this.account.SetPassword(); } }
public string GetValue(string formData, string parameter) { var result = parameter; JObject jObj = new JObject(); if (!string.IsNullOrEmpty(formData)) { jObj = JObject.Parse(formData); } var node = parameter.Replace("field(", "").Replace("emailField(", "").Replace("role(", "").Replace("emailRole(", "").Replace("parameter(", ""); if (!string.IsNullOrEmpty(node) && node.Last() == ')') { node = node.Substring(0, node.Length - 1); } if (parameter.Contains("role(") && XmlForm == null) { LoadXmlForm(int.Parse(jObj["FormId"].ToString())); } if (parameter.Contains("field(") && jObj[node] != null) { if (node.Contains(",")) { var nodeSplit = node.Split(','); foreach (var field in nodeSplit) { if (jObj[field] != null && !string.IsNullOrEmpty(jObj[field].Value <string>())) { result = jObj[field].Value <string>(); break; } } } else { result = jObj[node].Value <string>(); } } else if (parameter.Contains("emailField(") && jObj["email" + node] != null) { if (node.Contains(",")) { var nodeSplit = node.Split(','); foreach (var field in nodeSplit) { if (jObj[field] != null && !string.IsNullOrEmpty(jObj["email" + field].Value <string>())) { result = jObj["email" + field].Value <string>(); break; } } } else { result = jObj["email" + node].Value <string>(); } } else if (parameter.Contains("role(")) { var users = XmlForm.SelectNodes("//body/roles/role[id='" + node + "']/users/user"); if (users.Count > 0) { result = ""; } for (var i = 0; i < users.Count; i++) { result += users[i].SelectSingleNode("name").InnerXml; if (i != users.Count - 1) { result += ","; } } } else if (parameter.Contains("emailRole(")) { var users = XmlForm.SelectNodes("//body/roles/role[id='" + node + "']/users/user"); if (users.Count > 0) { result = ""; } for (var i = 0; i < users.Count; i++) { result += users[i].SelectSingleNode("email").InnerXml; if (i != users.Count - 1) { result += ","; } } } else if (parameter.Contains("parameter(")) { result = XmlForm.SelectSingleNode("//body/parameters/parameter[id='" + node + "']/value").InnerXml; } return(result); }
/// <summary> /// submits the order /// </summary> protected void SubmitOrder() { this.header.InnerText = "Your order has been submitted"; this.Master.SetLayout(this.header.InnerText, MasterPage.LayoutStyle.ContentOnly); // parse the controls on the page and generate an xml doc XmlDocument doc = this.xmlForm.GetResponse(pnlForm); XmlNode TractSearchNode = doc.SelectSingleNode("//field[@name = 'TractSearch']"); XmlNode BuyerNameNode = doc.SelectSingleNode("//field[@name = 'Buyer']"); if (TractSearchNode != null && TractSearchNode.InnerText.Equals("Yes") && BuyerNameNode != null && BuyerNameNode.InnerText.Equals("")) { BuyerNameNode.InnerText = "."; } Affinity.Request req = new Affinity.Request(this.phreezer); req.OrderId = order.Id; req.OriginatorId = this.GetAccount().Id; req.RequestTypeCode = this.rtype.Code; req.StatusCode = (this.isChange || this.rtype.Code == Affinity.RequestType.DefaultChangeCode) ? Affinity.RequestStatus.ChangedCode : Affinity.RequestStatus.DefaultCode; req.Xml = XmlForm.XmlToString(doc).Replace("’", "'"); req.Insert(); string surveyServices = req.GetDataValue("SurveyServices"); // if this is a change, we have to update any previous requests of the // same type so they are no longer recognized as the most current and we // know that they have been replaced by a newer request if (this.isChange) { Affinity.Request cr = new Affinity.Request(this.phreezer); cr.Load(this.changeId); // just a safety check to block any querystring monkeybusiness if (cr.OrderId == order.Id) { cr.IsCurrent = false; cr.Update(); } if (surveyServices != cr.GetDataValue("SurveyServices")) { // the survey services has been changed. it's either new or cancelled SendSurveyNotification(req, (surveyServices != "REQUIRED"), (surveyServices == "REQUIRED")); } } else if (surveyServices == "REQUIRED") { // send a notification that a new survey service has been requested SendSurveyNotification(req, false, true); } // if this was a property change, we need to update the master order record // as well so the data on the datagrids shows correctly if (this.rtype.Code == Affinity.RequestType.DefaultChangeCode) { order.ClientName = FindOrderField(pnlForm, "ClientName", order.ClientName); order.Pin = FindOrderField(pnlForm, "PIN", order.Pin); // case is different order.AdditionalPins = FindOrderField(pnlForm, "AdditionalPins", order.AdditionalPins); order.PropertyAddress = FindOrderField(pnlForm, "PropertyAddress", order.PropertyAddress2); order.PropertyAddress2 = FindOrderField(pnlForm, "PropertyAddress2", order.PropertyAddress); order.PropertyCity = FindOrderField(pnlForm, "PropertyCity", order.PropertyCity); order.PropertyState = FindOrderField(pnlForm, "PropertyState", order.PropertyState); order.PropertyZip = FindOrderField(pnlForm, "PropertyZip", order.PropertyZip); order.CustomerId = FindOrderField(pnlForm, "CustomerId", order.CustomerId); order.PropertyCounty = FindOrderField(pnlForm, "PropertyCounty", order.PropertyCounty); string closingDate = FindOrderField(pnlForm, "ClosingDate", order.ClosingDate.ToShortDateString()); try { order.ClosingDate = DateTime.Parse(closingDate); } catch (FormatException ex) { // TODO: check this at an earlier stage so we can roll back the transaction this.Master.ShowFeedback("Your order was updated however the new closing date was ignored because it was not a valid date in the format 'mm/dd/yyyy'", MasterPage.FeedbackType.Error); } } // we have to sync the status of the order because any new requests may change it // this will also call Update on the order if we've made any changes order.SyncStatus(); // notify affinity if specified in system settings SendNotification(req); //TODO: redirect to a thank-you page instead of just showing the message ShowConfirmation(); }
/// <summary> /// The form controls are created at this point. if we create them at page load /// then their viewstate will not be persisted. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> override protected void PageBase_Init(object sender, System.EventArgs e) { bool isRefinance = (Request["Refinance"] != null && Request["Refinance"].Equals("True")); // we have to call the base first so phreezer is instantiated base.PageBase_Init(sender, e); int orderId = NoNull.GetInt(Request["id"], 0); string requestCode = NoNull.GetString(Request["code"], Affinity.RequestType.DefaultCode); this.order = new Affinity.Order(this.phreezer); order.Load(orderId); // make sure this user has permission to make updates to this order if (!order.CanUpdate(this.GetAccount())) { this.Crash(300, "Permission denied."); } this.rtype = new Affinity.RequestType(this.phreezer); rtype.Load(requestCode); this.xmlForm = new XmlForm(this.order.Account); this.changeId = NoNull.GetInt(Request["change"], 0); this.isChange = (!changeId.Equals(0)); if (this.rtype.Code.Equals("ClerkingRequest")) { ContentFooterSpan.InnerHtml = "© Copyright <%=DateTime.Now.Year.ToString() %>, Advocate Title Services, LLC"; } string busindxml = "<field name=\"BusinessLicenseID\">" + this.GetAccount().BusinessLicenseID + "</field>" + "<field name=\"IndividualLicenseID\">" + this.GetAccount().IndividualLicenseID + "</field>"; if (this.isChange) { // create a form for a change request Affinity.Request req = new Affinity.Request(this.phreezer); req.Load(changeId); pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, req.Xml.Replace("</response>", "") + busindxml + "</response>")); this.btnCancelChange.Visible = true; this.btnChange.Visible = true; this.btnCancelSubmit.Visible = false; this.btnSubmit.Visible = false; } else if (rtype.Code == Affinity.RequestType.DefaultChangeCode) { // this is a change to the main order, we store this as a request as well // but we treat it a little bit differently string resXml = XmlForm.XmlToString(order.GetResponse()); pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, resXml.Replace("</response>", "") + busindxml + "</response>")); this.btnCancelChange.Visible = true; this.btnChange.Visible = true; this.btnCancelSubmit.Visible = false; this.btnSubmit.Visible = false; } else { // create a form for a new request //string reqXml = XmlForm.XmlToString(order.GetResponse()); string reqXml = this.GetAccount().PreferencesXml; if (this.rtype.Code.Equals("ClerkingRequest")) { Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.RequestTypeCode = "Order"; Affinity.Requests reqs = order.GetOrderRequests(rc); if (reqs.Count > 0) { Affinity.Request r = (Affinity.Request)reqs[reqs.Count - 1]; //log.Debug(r.Xml); reqXml = reqXml.Replace("</response>", "") + busindxml + XmlForm.XmlToString(order.GetResponse()).Replace("<response>", "").Replace("</response>", "") + r.Xml.Replace("<response>", ""); pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, reqXml)); } else { reqXml = reqXml.Replace("</response>", "") + busindxml + XmlForm.XmlToString(order.GetResponse()).Replace("<response>", "").Replace("</response>", ""); pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, XmlForm.XmlToString(order.GetResponse()))); } } else { pnlForm.Controls.Add(this.xmlForm.GetFormFieldControl(rtype.Definition, reqXml)); } } }
public override string Render(string keyAttribute) { XmlDocument doc = this.request.GetTranslatedResponse(keyAttribute, true, true); return(XmlForm.XmlToString(doc).Replace("</field>", "</field>\r\n").Replace("<response>", "<response>\r\n")); }
/// <summary> /// Implementation of the marker event logic. /// </summary> /// <param name="app">Visio application.</param> /// <param name="sequenceNum">Sequence number.</param> /// <param name="contextString">Context string, as defined in shape.</param> private void Application_MarkerEventDo(Visio.Application app, int sequenceNum, string contextString) { /* * */ if (_initializedOk == false) { return; } if (contextString == null) { return; } if (contextString.Contains("/au=1") == false) { return; } /* * Don't process any marker events that are being fired as a result * of a redo. */ if (this.Application.IsUndoingOrRedoing == true) { return; } /* * */ Dictionary <string, string> ctx = VU.ParseContext(contextString); if (ctx.ContainsKey("cmd") == false) { return; } /* * */ Visio.Shape shape = VU.GetShape(app, ctx); if (shape == null) { return; } string modelName = VU.GetProperty(shape, "User", "ModelName"); string shapeName = VU.GetProperty(shape, "User", "ModelShape"); if (string.IsNullOrEmpty(modelName) == true || string.IsNullOrEmpty(shapeName) == true) { return; } /* * Model */ IModelDefinition model; try { model = ModelCache.Load(modelName); } catch (Exception ex) { ExceptionMessageBox.Show("Model failed to load.", ex); return; } if (model == null) { ExceptionMessageBox.Show($"Model '{ modelName }' not found."); return; } /* * */ IShapeDefinition shapeDef = model.Shapes.Where(x => x.Name == shapeName).FirstOrDefault(); if (shapeDef == null) { ExceptionMessageBox.Show($"No shape definition for '{ shapeName }' found."); return; } /* * Drop command */ if (ctx["cmd"] == "drop") { /* * .Id */ string shapeId = Guid.NewGuid().ToString(); VU.SetProperty(shape, "Prop", "ShapeId", shapeId); /* * .Code */ string shapeCode = null; if (string.IsNullOrEmpty(shapeDef.ShapeCodePrefix) == false) { int sequence = PageIncrementSequence(shape, shapeDef.ShapeCodePrefix); shapeCode = string.Format(CultureInfo.InvariantCulture, shapeDef.ShapeCodeFormat, shapeDef.ShapeCodePrefix, sequence); VU.SetProperty(shape, "Prop", "ShapeCode", shapeCode); } /* * .Text */ string shapeXml = VU.GetProperty(shape, "Prop", "ShapeXml"); string shapeText = shapeDef.TextGet(shapeCode, shapeXml); if (string.IsNullOrEmpty(shapeText) == false) { VU.TextSet(shape, shapeText); } } /* * */ if (ctx["cmd"] == "edit") { string mode = "analysis"; //_toolbar.CurrentMode; string shapeCode = VU.GetProperty(shape, "Prop", "ShapeCode"); string shapeXml = VU.GetProperty(shape, "Prop", "ShapeXml"); XmlForm form = new XmlForm(); form.Initialize(shapeDef, mode, shapeCode, shapeXml); DialogResult result = form.ShowDialog(); if (result == DialogResult.OK) { VU.SetProperty(shape, "Prop", "ShapeXml", form.ShapeXml); VU.ShapeColorSet(shape, Visio.VisDefaultColors.visBlack); string shapeText = shapeDef.TextGet(shapeCode, form.ShapeXml); if (string.IsNullOrEmpty(shapeText) == false) { VU.TextSet(shape, shapeText); } } } }
/// <summary> /// Initializes a new instance of the SubProcessShape class. /// </summary> public ParameterListShape(object shape, XmlForm form, XmlElement attributes) : base(shape, form, attributes) { }
protected void Page_Load(object sender, EventArgs e) { this.RequirePermission(Affinity.RolePermission.SubmitOrders); this.Master.SetLayout("Order Details", MasterPage.LayoutStyle.ContentOnly); string id = NoNull.GetString(Request["id"]); // this is used to track if a property changes was submitted int changeId = 0; Affinity.Order order = new Affinity.Order(this.phreezer); order.Load(id); // make sure this user has permission to make updates to this order if (!order.CanRead(this.GetAccount())) { this.Crash(300, "Permission denied."); } //order.CustomerStatusCode //order.InternalStatusCode lblWorkingId.Text = order.WorkingId; txtCustomerId.Text = order.CustomerId; txtClientName.Text = order.ClientName; txtPIN.Text = order.Pin; txtAdditionalPins.Text = order.AdditionalPins; txtPropertyAddress.Text = order.PropertyAddress; txtPropertyAddress2.Text = order.PropertyAddress2; txtPropertyCity.Text = order.PropertyCity; txtPropertyState.Text = order.PropertyState; txtPropertyZip.Text = order.PropertyZip; txtCustomerId.Text = order.CustomerId; txtPropertyCounty.Text = order.PropertyCounty; txtClosingDate.Text = order.ClosingDate.ToShortDateString(); // show any attachments that go with this order Affinity.Attachments atts = new Affinity.Attachments(this.phreezer); Affinity.AttachmentCriteria attc = new Affinity.AttachmentCriteria(); attc.OrderId = order.Id; atts.Query(attc); // see if the user has access to the attachment Affinity.AttachmentRole ardao = new Affinity.AttachmentRole(this.phreezer); Affinity.AttachmentRolesCriteria arcrit = new Affinity.AttachmentRolesCriteria(); arcrit.RoleCode = this.GetAccount().RoleCode; foreach (Affinity.Attachment att in atts) { arcrit.AttachmentPurposeCode = att.AttachmentPurpose.Code; Affinity.AttachmentRoles aroles = ardao.GetAttachmentRoles(arcrit); // if the user has permission to view this attachment if (aroles.Count > 0 || this.GetAccount().Id == order.OriginatorId) { pnlAttachments.Controls.Add(new LiteralControl("<div><a class=\"attachment\" href=\"MyAttachment.aspx?id=" + att.Id + "\">" + att.Name + "</a> (" + att.Created.ToString("M/dd/yyyy hh:mm tt") + ")</div>")); } } // show the entire order history Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.AppendToOrderBy("Created", true); rGrid.DataSource = order.GetOrderRequests(rc); rGrid.DataBind(); // show the available actions that can be done with this order Affinity.RequestTypes rts = order.GetAvailableRequestTypes(); pnlActions.Controls.Add(new LiteralControl("<div class=\"actions\">")); foreach (Affinity.RequestType rt in rts) { pnlActions.Controls.Add(new LiteralControl("<div><a class=\"add\" href=\"MyRequestSubmit.aspx?id=" + order.Id + "&code=" + rt.Code + "\">Add a " + rt.Description + " to this Order</a></div>")); } pnlActions.Controls.Add(new LiteralControl("<div><a class=\"add\" href=\"documents.aspx?id=" + order.Id + "\">Closing Document Manager – Forms</a></div>")); pnlActions.Controls.Add(new LiteralControl("</div>")); // show the details for the active requests Affinity.Requests rs = order.GetCurrentRequests(); foreach (Affinity.Request r in rs) { // we don't want to show changes to the property information if (r.RequestType.Code != Affinity.RequestType.DefaultChangeCode) { XmlForm xf = new XmlForm(this.GetAccount()); //Hashtable labels = xf.GetLabelHashtable(r.RequestType.Definition); Hashtable responses = XmlForm.GetResponseHashtable(r.Xml); pnlRequests.Controls.Add(new LiteralControl("<div class=\"groupheader\">" + r.RequestType.Description + " [<a href=\"MyRequestSubmit.aspx?change=" + r.Id + "&id=" + order.Id + "&code=" + r.RequestType.Code + "\">Edit</a>]" + "</div>")); pnlRequests.Controls.Add(new LiteralControl("<fieldset class=\"history\">")); // add the basic info pnlRequests.Controls.Add(NewLine("Request Status", r.RequestStatus.Description)); pnlRequests.Controls.Add(NewLine("Notes", r.Note)); pnlRequests.Controls.Add(NewLine("Submitted", r.Created.ToString("MM/dd/yyyy hh:mm tt"))); ArrayList keys = new ArrayList(responses.Keys); keys.Sort(); foreach (string key in keys) { // we check for fields ending with "_validator" due to a bug with order prior to 03/13/07 // if (responses[key].ToString().Equals("") == false) if (responses[key].ToString().Equals("") == false && key.EndsWith("_validator") == false) { //pnlRequests.Controls.Add(new LiteralControl("<div>" + labels[key].ToString() + ": " + responses[key].ToString() + "</div>")); pnlRequests.Controls.Add(NewLine(key, responses[key])); } } pnlRequests.Controls.Add(new LiteralControl("</fieldset>")); } else { changeId = r.Id; } } lnkChange.NavigateUrl = "MyRequestSubmit.aspx?id=" + order.Id + "&change=" + changeId + "&code=" + Affinity.RequestType.DefaultChangeCode; }
/// <summary> /// Initializes a new instance of the NodeShape class. /// </summary> public WebPage(object shape, XmlForm form, XmlElement attributes) : base(shape, form, attributes) { }
/// <summary> /// Persist to DB and send email notification /// </summary> /// <returns>result of email notification</returns> protected string UpdateRequest() { // see if the status was changed from it's previous value // note we are getting the full description here vs the code string oldStatus = this.request.RequestStatus.Description; string newStatus = ddStatus.SelectedItem.Text; bool filePosted = fuAttachment.HasFile; this.request.StatusCode = ddStatus.SelectedValue; // here we need the code, tho this.request.Note = txtNote.Text; // update the details XmlForm xf = new XmlForm(this.request.Account); this.request.Xml = XmlForm.XmlToString(xf.GetResponse(pnlDetails)); this.request.Update(); this.request.Order.SyncStatus(); // if a file was provided, then upload it if (filePosted) { string ext = System.IO.Path.GetExtension(fuAttachment.FileName); string fileName = "req_att_" + request.Id + "_" + DateTime.Now.ToString("yyyyMMddhhss") + "." + ext.Replace(".", ""); Affinity.Attachment att = new Affinity.Attachment(this.phreezer); att.RequestId = this.request.Id; att.Name = txtAttachmentName.Text != "" ? txtAttachmentName.Text : ddFilePurpose.SelectedItem.Text; att.PurposeCode = ddFilePurpose.SelectedValue; att.Filepath = fileName; att.MimeType = ext; att.SizeKb = 0; // fuAttachment.FileBytes.GetUpperBound() * 1024; att.Insert(); if (ddFilePurpose.SelectedValue.Equals("SearchPkg")) { Affinity.Schedule sched = new Affinity.Schedule(this.phreezer); sched.AttachmentID = att.Id; sched.AccountID = this.request.Account.Id; sched.UploadAccountID = this.GetAccount().Id; sched.OrderID = this.request.OrderId; sched.RequestID = this.request.Id; sched.Search_package_date = DateTime.Now; sched.Insert(); Affinity.Global.SetSchedule(); } //TODO: block any harmful file types Affinity.UploadLog ul = new Affinity.UploadLog(this.phreezer); ul.AttachmentID = att.Id; ul.AccountID = this.request.Account.Id; ul.UploadAccountID = this.GetAccount().Id; ul.OrderID = this.request.OrderId; ul.RequestID = this.request.Id; ul.Insert(); fuAttachment.SaveAs(Server.MapPath("./") + "attachments/" + fileName); txtEmailNote.Text = "A new file '" + att.Name + "' has been posted and is ready for your review. " + txtEmailNote.Text; } return(SendNotification(oldStatus, newStatus, filePosted, txtEmailNote.Text)); }
/// <summary> /// Initializes a new instance of the SubProcessShape class. /// </summary> public FieldItem(object shape, XmlForm form, XmlElement attributes) : base(shape, form, attributes) { }
/// <summary> /// Initializes a new instance of the NodeShape class. /// </summary> public NodeShape(object shape, XmlForm form, XmlElement attributes) : base(shape, form, attributes) { }
/// <summary> /// Given a reponse xml document, returns a Hashtable with all the responses /// as the values. The key is determined by the attribute parameter. For /// example this could be "name" "sp_id" or "rei_id" /// </summary> /// <param name="def">Request Definition</param> /// <param name="doc">Request Responses</param> /// <param name="keyAttribute"></param> /// <returns>Hashtable</returns> public static Hashtable GetTranslatedHashtable(XmlDocument def, XmlDocument doc, string keyAttribute) { return(XmlForm.GetTranslatedHashtable(def, doc, keyAttribute, false)); }
/// <summary> /// Initializes a new instance of the EventShape class. /// </summary> public TransitionShape(object shape, XmlForm form, XmlElement attributes) : base(shape, form, attributes) { }
private void LoadActions(string status) { //UpdateCulture(); var closeForm = (IActionViewModel)ActionViewModel.Clone(); HeaderViewModel.CloseForm = closeForm; //HeaderViewModel.CloseForm.Title = Resources.Language.lblCloseForm; HeaderViewModel.CloseForm.Title = Constants.Close; if (FormRequestViewModel.UserAssigned.ToLower() != UserUtil.DisplayUserName.ToLower()) { return; } var saveForm = (IActionViewModel)ActionViewModel.Clone(); HeaderViewModel.SaveForm = saveForm; //HeaderViewModel.SaveForm.Title = Resources.Language.lblSaveForm; HeaderViewModel.SaveForm.Title = Constants.Save; if (!string.IsNullOrEmpty(status) && XmlForm != null) { FormRequestViewModel.HeaderViewModel.FormActions = new List <IActionViewModel>(); var actionNodes = XmlForm.SelectNodes("//body/statuses/status[name='" + status + "']/actions/action"); foreach (XmlNode action in actionNodes) { var visibleCondition = ""; if (action["visible"] != null) { visibleCondition = action["visible"].InnerText; string[] functions = { "parameter(", "role(" }; foreach (var func in functions) { while (visibleCondition.Contains(func)) { var index = visibleCondition.IndexOf(func); var endIndex = visibleCondition.IndexOf(")", index); var parameter = visibleCondition.Substring(index, endIndex - index + 1); var value = FormXmlService.GetValue(FormRequestViewModel.JSonFormData, parameter); visibleCondition = visibleCondition.Replace(parameter, "'" + value + "'"); } } } var newStatusNode = XmlForm.SelectSingleNode("//body/statuses/status[name='" + action["targetStatus"].InnerText + "']"); var newAction = new ActionViewModel { Id = action["name"].InnerText, RequestFormId = FormRequestViewModel.Id, Title = action["displayName"].InnerText, RequiredFields = action["requiredFields"] == null ? null : action["requiredFields"].InnerText, SendEmailNotification = action["sendEmailNotification"] == null ? null : action["sendEmailNotification"].InnerText, ConfirmationText = action["confirmationText"] == null ? "Are you sure you want to realize this action?" : action["confirmationText"].InnerText, CommentRequired = action["commentRequired"] == null || action["commentRequired"].InnerText != "true" ? false : true, HistoryText = action["historyText"] == null ? string.Empty : action["historyText"].InnerText, VisibleValidation = action["visible"] == null ? "" : visibleCondition, JSFunction = action["jsFunction"] == null ? "" : action["jsFunction"].InnerText, AddCommentToList = action["addCommentToList"] == null ? "" : action["addCommentToList"].InnerText, CancelStatusChange = action["cancelStatusChange"] == null || string.IsNullOrEmpty(action["cancelStatusChange"].InnerText) || action["cancelStatusChange"].InnerText.ToLower() != "true" ? false : true, NewStatus = action["targetStatus"].InnerText, NewStatusDisplayName = newStatusNode["displayName"].InnerText }; FormRequestViewModel.HeaderViewModel.FormActions.Add(newAction); } } }