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);

        string filename = NoNull.GetString(Request["filename"], "");
        string message  = NoNull.GetString(Request["message"], "");

        if (!filename.Equals(""))
        {
            bool success = !message.Equals("fail");

            Affinity.Attachments        atts = new Affinity.Attachments(this.phreezer);
            Affinity.AttachmentCriteria attc = new Affinity.AttachmentCriteria();
            attc.Filepath = filename;
            atts.Query(attc);

            bool emailsent = false;

            foreach (Affinity.Attachment att in atts)
            {
                if (emailsent)
                {
                    continue;
                }
                MailMessage mm = new MailMessage("*****@*****.**", att.Request.Account.Email, "Agent Examination Form Fax", ((success) ? "Your recent Agent Examination Form has been faxed successfully." : "Your recent Agent Examination Form fax transmission failed."));
                mm.IsBodyHtml = true;
                mm.Priority   = MailPriority.Normal;

                SmtpClient sc = new SmtpClient("10.9.8.250");
                sc.Send(mm);
                emailsent = true;
            }
        }
    }
Example #2
0
    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;
            }
        }
    }
Example #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;
    }