Пример #1
0
        /// <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);
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
    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;
    }