/// <summary> /// Returns a collection of the current requests, hiding any that /// have been replaced with a change /// </summary> /// <returns></returns> public Requests GetCurrentRequests() { RequestCriteria rc = new RequestCriteria(); rc.OrderId = this.Id; rc.IsCurrent = 1; rc.AppendToOrderBy("Created", true); return(GetOrderRequests(rc)); /* * ArrayList buff = new ArrayList(); * Requests rsd = new Requests(this.phreezer); * foreach (Request r in rs) * { * if (!buff.Contains(r.RequestTypeCode)) * { * buff.Add(r.RequestTypeCode); * rsd.Add(r); * } * } * * return rsd; */ }
/* ~~~ CONSTRAINTS ~~~ */ /* ~~~ SETS ~~~ */ /// <summary> /// Returns a collection of Request objects /// </summary> /// <param name="criteria"></param> /// <returns>Requests</returns> public Requests GetStatusRequests(RequestCriteria criteria) { criteria.StatusCode = this.Code; Requests statusRequests = new Requests(this.phreezer); statusRequests.Query(criteria); return(statusRequests); }
/* ~~~ CONSTRAINTS ~~~ */ /* ~~~ SETS ~~~ */ /// <summary> /// Returns a collection of Request objects /// </summary> /// <param name="criteria"></param> /// <returns>Requests</returns> public Requests GetTypeRequests(RequestCriteria criteria) { criteria.RequestTypeCode = this.Code; Requests typeRequests = new Requests(this.phreezer); typeRequests.Query(criteria); return(typeRequests); }
/// <summary> /// Returns a collection of Request objects /// </summary> /// <param name="criteria"></param> /// <returns>Requests</returns> public Requests GetOrderRequests(RequestCriteria criteria) { criteria.OrderId = this.Id; Requests orderRequests = new Requests(this.phreezer); orderRequests.Query(criteria); return(orderRequests); }
/// <summary> /// syncs the status code of the order to match the outstanding requests /// </summary> public void SyncStatus() { RequestCriteria rc = new RequestCriteria(); rc.OrderId = this.Id; rc.IsCurrent = 1; rc.AppendToOrderBy("Created", false); Requests rs = GetOrderRequests(rc); bool hasChanged = false; bool hasNew = false; bool hasOpen = false; foreach (Request r in rs) { hasNew = (r.StatusCode == RequestStatus.DefaultCode) ? true : hasNew; hasChanged = (r.StatusCode == RequestStatus.ChangedCode) ? true : hasChanged; hasOpen = (r.RequestStatus.PermissionBit > 1) ? true : hasOpen; } string newCode = this.InternalStatusCode; // new is 1st priority // changed is 2nd priority // open is 3rd priority // otherwise everything is good if (hasNew) { newCode = OrderStatus.DefaultCode; } else if (hasChanged) { newCode = OrderStatus.ChangedCode; } else if (hasOpen) { newCode = OrderStatus.InProgressCode; } else { newCode = OrderStatus.ReadyCode; } if (newCode != this.InternalStatusCode) { this.InternalStatusCode = newCode; this.CustomerStatusCode = newCode; } // update every time this.Update(); }
/// <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); int id = NoNull.GetInt(Request["id"], 0); request = new Affinity.Request(this.phreezer); Affinity.Order order = new Affinity.Order(this.phreezer); order.Load(id); Affinity.RequestCriteria criteria = new Affinity.RequestCriteria(); Affinity.Requests reqs = order.GetOrderRequests(criteria); Affinity.Request req = (Affinity.Request)reqs[0]; this.request.Load(req.Id); }
/// <summary> /// If this is a change request, returns the previous request of the same type. This /// is useful for comparing the difference when a change is submitted. If no previous /// request exists, then null is returned /// </summary> /// <returns>Affinity.Request || null</returns> public Affinity.Request GetPreviousRequest() { RequestCriteria rc = new RequestCriteria(); rc.RequestTypeCode = this.RequestTypeCode; rc.IdLessThan = this.Id; rc.AppendToOrderBy("Id", true); Affinity.Requests rs = this.Order.GetOrderRequests(rc); Affinity.Request prev = null; if (rs.Count > 0) { prev = (Affinity.Request)rs[0]; } return(prev); }
/// <summary> /// This processed the order re-assign /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDoReAssign_Click(object sender, EventArgs e) { this.RequirePermission(Affinity.RolePermission.AffinityManager); Affinity.Account acct = new Affinity.Account(this.phreezer); acct.Load(ddNewOriginator.SelectedValue); txtOriginator.Text = acct.FullName; Affinity.Request request; int id = NoNull.GetInt(Request["id"], 0); Affinity.Requests requests = new Affinity.Requests(this.phreezer); Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.OrderId = id; requests.Query(rc); XmlDocument prefDoc = new XmlDocument(); prefDoc.LoadXml(acct.PreferencesXml); foreach (Affinity.Request req in requests) { req.OriginatorId = acct.Id; if (req.RequestTypeCode.Equals("Order")) { XmlDocument reqDoc = new XmlDocument(); reqDoc.LoadXml(req.Xml); // ApplicantName XmlNode reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantName']"); XmlNode prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantName']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantAttorneyName reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantAttorneyName']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAttorneyName']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantAddress reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantAddress']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAddress']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantAddress2 reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantAddress2']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAddress2']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantCity reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantCity']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantCity']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantState reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantState']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantState']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantZip reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantZip']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantZip']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantPhone reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantPhone']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantPhone']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantFax reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantFax']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantFax']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantEmail reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantEmail']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantEmail']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } // ApplicantAttentionTo reqNode = reqDoc.SelectSingleNode("//field[@name='ApplicantAttentionTo']"); prefNode = prefDoc.SelectSingleNode("//field[@name='ApplicantAttentionTo']"); if (prefNode != null && reqNode != null) { reqNode.InnerText = prefNode.InnerText; } req.Xml = reqDoc.OuterXml; req.Update(); } } this.order.OriginatorId = acct.Id; this.order.Update(); txtOriginator.Visible = true; //txtOriginator.Text = request.Id.ToString() + " - " + request.OrderId.ToString(); btnReAssign.Visible = true; ddNewOriginator.Visible = false; btnDoReAssign.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { PageBase pb = (PageBase)this.Page; Affinity.Account acc = pb.GetAccount(); this.Master.SetLayout("Process Order", MasterPage.LayoutStyle.ContentOnly); this.RequirePermission(Affinity.RolePermission.AdminSystem); this.btnClose.Attributes.Add("onclick", "return confirm('Mark this order as closed?');"); if (!Page.IsPostBack) { // populate current requests grid Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.AppendToOrderBy("Created", true); rGrid.DataSource = order.GetOrderRequests(rc); rGrid.DataBind(); // show any attachments that go with this order Affinity.Attachments atts = order.GetAttachments(); foreach (Affinity.Attachment att in atts) { 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") + ") <a class=\"delete\" onclick=\"return confirm('Delete this attachment?');\" href=\"AdminAttachment.aspx?a=delete&id=" + att.Id + "\">Delete</a></div>")); } // populate the form btnReAssign.Visible = acc.Role.HasPermission(Affinity.RolePermission.AffinityManager); Affinity.OrderStatuss codes = new Affinity.OrderStatuss(this.phreezer); Affinity.OrderStatusCriteria sc = new Affinity.OrderStatusCriteria(); sc.InternalExternal = 1; codes.Query(sc); /* * ddStatus.DataSource = codes; * ddStatus.DataTextField = "Description"; * ddStatus.DataValueField = "Code"; * ddStatus.SelectedValue = this.order.CustomerStatusCode; * ddStatus.DataBind(); */ lblStatus.Text = this.order.CustomerStatus.Description; txtId.Text = "WEB-" + this.order.Id.ToString(); txtInternalId.Text = this.order.InternalId.ToString(); txtInternalATSId.Text = this.order.InternalATSId.ToString(); txtCustomerId.Text = this.order.CustomerId.ToString(); txtPin.Text = this.order.Pin.ToString(); txtAdditionalPins.Text = this.order.AdditionalPins.ToString(); txtPropertyAddress.Text = this.order.PropertyAddress.ToString(); txtPropertyAddress2.Text = this.order.PropertyAddress2.ToString(); txtPropertyCity.Text = this.order.PropertyCity.ToString(); txtPropertyState.Text = this.order.PropertyState.ToString(); txtPropertyZip.Text = this.order.PropertyZip.ToString(); txtPropertyCounty.Text = this.order.PropertyCounty.ToString(); //txtInternalStatusCode.Text = this.order.InternalStatusCode.ToString(); //txtCustomerStatusCode.Text = this.order.CustomerStatusCode.ToString(); txtOriginator.Text = this.order.Account.FullName; txtCreated.Text = this.order.Created.ToString("MM/dd/yyyy hh:mm tt"); txtModified.Text = this.order.Modified.ToString("MM/dd/yyyy hh:mm tt"); txtClosingDate.Text = this.order.ClosingDate.ToShortDateString(); txtClientName.Text = this.order.ClientName.ToString(); radioResidential.Checked = (this.order.PropertyUse.Equals("Residential")); radioNonResidential.Checked = (this.order.PropertyUse.Equals("Nonresidential")); if (txtInternalId.Text.Trim().Equals("")) { txtInternalId.Focus(); txtInternalId.Text = "AFF-"; } else if (txtInternalATSId.Text.Trim().Equals("")) { txtInternalATSId.Focus(); } // the admin wants to see if there is a previous order from ANY user w/ the same PIN because // if the PIN was recently submitted, they may be able to use internal records and not have // to incur the expense of a full title search. Affinity.Order previousOrder = order.GetPrevious(false); // If there are any previous orders display a message to the admin if (previousOrder != null) { PreviousOrderNotice.InnerHtml = "This order has a potential duplicate submitted on " + previousOrder.Created.ToShortDateString() + " - order number <a href=\"AdminOrder.aspx?id=" + previousOrder.Id.ToString() + "\">" + previousOrder.Id.ToString() + "</a> " + previousOrder.InternalId.ToString(); PreviousOrderNotice.Visible = true; } } }
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> /// 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)); } } }
/// <summary> /// Hides the form and shows the results of the request submission /// </summary> protected void ShowConfirmation() { pnlResults.Visible = true; // hide all the form controls pnlForm.Visible = false; btnSubmit.Visible = false; btnChange.Visible = false; btnCancelChange.Visible = false; btnCancelSubmit.Visible = false; pnlResults.Controls.Add(new LiteralControl("<div class=\"actions\">")); bool isTaxStampsSet = false; Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.RequestTypeCode = "ClerkingRequest"; Affinity.Requests reqs = order.GetOrderRequests(rc); int requestCount = reqs.Count; string changeParameter = ""; // check to see if any Clerking Requests exist if (requestCount > 0) { Affinity.Request req = (Affinity.Request)reqs[requestCount - 1]; XmlDocument doc = new XmlDocument(); doc.LoadXml(req.Xml); XmlNode clerkingservicenode = doc.SelectSingleNode("//field[@name='ClerkingServicesSuburbanTransferStamps']"); if (clerkingservicenode != null) { string [] csnArry = clerkingservicenode.InnerText.ToLower().Split(','); int csnLen = csnArry.GetLength(0); for (int i = 0; i < csnLen; i++) { // verify if city is selected if (csnArry[i].Equals(order.PropertyCity.ToLower())) { isTaxStampsSet = true; break; } } } changeParameter = "change=" + req.Id.ToString() + "&"; } if (!isTaxStampsSet && order.IsTaxStampsRequired()) { if (changeParameter.Equals("")) { pnlResults.Controls.Add(new LiteralControl("<div class=\"notice\">The Tax District, " + order.PropertyCity + ", requires the purchase of tax stamps.<br>You can add tax stamps to this order by clicking on \"Add a Clerking Services Request to this Order\" below: </div>")); } else { pnlResults.Controls.Add(new LiteralControl("<div class=\"notice\">The Tax District, " + order.PropertyCity + ", requires the purchase of tax stamps.<br>You have an existing Clerking Request, but you didn't pick the stamp for your city.<br>You can add the tax stamp for your city to this order by clicking on \"Add a Clerking Services Request to this Order\" below and under the section heading \"SUBURBAN TRANSFER STAMPS\", check the checkbox next to " + order.PropertyCity + ": </div>")); } } else { isTaxStampsSet = true; } // show the available actions that can be done with this order Affinity.RequestTypes rts = order.GetAvailableRequestTypes(); pnlResults.Controls.Add(new LiteralControl("<div class=\"actions\">")); foreach (Affinity.RequestType rt in rts) { if (rt.Code.Equals("ClerkingRequest")) { isTaxStampsSet = true; } pnlResults.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>")); } if (!isTaxStampsSet) { pnlResults.Controls.Add(new LiteralControl("<div><a class=\"add\" href=\"MyRequestSubmit.aspx?" + changeParameter + "id=" + order.Id + "&code=ClerkingRequest\">Add a Clerking Services Request to this Order</a></div></div>")); } pnlResults.Controls.Add(new LiteralControl("</div>")); pnlResults.Controls.Add(new LiteralControl("<div><a class=\"order\" href=\"MyOrder.aspx?id=" + order.Id + "\">View My Order</a></div>")); pnlResults.Controls.Add(new LiteralControl("<div><a class=\"home\" href=\"MyAccount.aspx\">Return To My Account</a></div>")); pnlResults.Controls.Add(new LiteralControl("</div>")); }
protected void Page_Load(object sender, EventArgs e) { this.RequirePermission(Affinity.RolePermission.SubmitOrders); string id = NoNull.GetString(Request["id"]); string keyAttribute = NoNull.GetString(Request["key"], "sp_id"); string format = NoNull.GetString(Request["format"], "hash"); string exportformat = "PFT"; if (!format.Equals("entire")) { Affinity.Request r = new Affinity.Request(this.phreezer); r.Load(id); // make sure this user has permission to make updates to this order if (!r.Order.CanRead(this.GetAccount())) { this.Crash(300, "Permission denied."); } IBaseRenderer renderer = null; // depending on the format requested, get the correct renderer object switch (format) { case "entire": break; case "xml": exportformat = "Generic XML"; renderer = new XmlRenderer(r, this.GetSystemSettings()); break; case "rei": exportformat = "REI XML"; renderer = new XmlREIRenderer(r, this.GetSystemSettings()); break; case "change": exportformat = "PFT (Changes Only)"; renderer = new PFTChangeRenderer(r, this.GetSystemSettings()); break; case "TPS": exportformat = "TPS"; renderer = new TPSServicePFTRenderer(r, this.GetSystemSettings()); break; //case "special": // renderer = new XmlSpecialRenderer(r, this.GetSystemSettings()); // break; default: renderer = new PFTRenderer(r, this.GetSystemSettings()); break; } Affinity.ExportLog exportlog = new Affinity.ExportLog(this.phreezer); Affinity.Account account = this.GetAccount(); exportlog.AccountID = account.Id; exportlog.OrderID = r.OrderId; exportlog.RequestID = r.Id; exportlog.ExportFormat = exportformat; exportlog.Insert(); // output the results of the renderer OutputRenderer(renderer, keyAttribute); } else { Affinity.RequestTypes rts = new Affinity.RequestTypes(this.phreezer); Affinity.RequestTypeCriteria rtc = new Affinity.RequestTypeCriteria(); rtc.IsActive = 1; rts.Query(rtc); Object [] renderers = new Object[rts.Count]; IEnumerator i = rts.GetEnumerator(); int j = 0; bool isClerkingServices = false; Affinity.Account account = this.GetAccount(); exportformat = "Entire Order"; while (i.MoveNext()) { Affinity.RequestType rt = (Affinity.RequestType)i.Current; Affinity.Order order = new Affinity.Order(this.phreezer); order.Load(id); Affinity.RequestCriteria rc = new Affinity.RequestCriteria(); rc.RequestTypeCode = rt.Code; order.GetOrderRequests(rc); Affinity.Requests reqs = order.GetOrderRequests(rc); Affinity.Request r = null; if (reqs.Count > 0) { r = (Affinity.Request)reqs[0]; if (rt.Code.Equals("ClerkingRequest")) { isClerkingServices = true; } IBaseRenderer renderer = new PFTRenderer(r, this.GetSystemSettings()); renderers[j] = renderer; j++; } if (r != null) { Affinity.ExportLog exportlog = new Affinity.ExportLog(this.phreezer); exportlog.AccountID = account.Id; exportlog.OrderID = r.OrderId; exportlog.RequestID = r.Id; exportlog.ExportFormat = exportformat; exportlog.Insert(); } } OutputMultiRenderer(renderers, keyAttribute, isClerkingServices); } }