Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;

            int farmId = 0;
            if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null))
            {
                int.TryParse(Request.QueryString["farmId"], out farmId);
            }

            if (farmId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            FarmIdHiddenField.Value = farmId.ToString();
            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForFarm(farmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " ";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId);
                FarmNameLabel.Text         = farm.FarmName;
                MailingPlanLabel.Text      = farm.MailingPlan.Title;
                CreateDateLabel.Text       = farm.CreateDate.ToShortDateString();
                FarmContactCountLabel.Text = farm.ContactCount.ToString();
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (IsPrinterRole)
            {
                DeleteContactButton.Enabled = false;
                EditContactButton.Enabled   = false;
            }

            Int64 contactId = 0;
            if ((Request.QueryString["contactId"] != "") && (Request.QueryString["contactId"] != null))
            {
                Int64.TryParse(Request.QueryString["contactId"], out contactId);
            }

            if (contactId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            if ((Request.QueryString["parentPage"] != "") && (Request.QueryString["parentPage"] != null))
            {
                ParentPageHiddenField.Value = Request.QueryString["parentPage"];
            }
            else
            {
                ParentPageHiddenField.Value = "";
            }

            try
            {
                //Get the common web service instance.
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();

                //Getting Required Data
                FarmService.ContactInfo contact = farmService.GetContactDetails(contactId);
                FarmService.PlotInfo    plot    = farmService.GetPlotDetail(contact.PlotId);
                FarmService.FarmInfo    farm    = farmService.GetFarmDetail(plot.FarmId);
                int contactCount = farmService.GetContactCountForPlot(contact.PlotId);

                int userId = farmService.GetUserIdForFarm(plot.FarmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " ";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                //Header Details
                FarmNameLabel.Text            = farm.FarmName;
                PlotNameLabel.Text            = plot.PlotName;
                ContactCountLabel.Text        = contactCount.ToString();
                ContactCountHiddenField.Value = contactCount.ToString();

                if (farmService.IsDefaultPlot(plot.PlotId))
                {
                    DefaultPlotFlagHiddenField.Value = "true";
                }
                else
                {
                    DefaultPlotFlagHiddenField.Value = "false";
                }

                CreatedOnLabel.Text  = contact.CreateDate.ToShortDateString();
                ModifiedOnLable.Text = contact.LastModifyDate.ToShortDateString();

                //Hidden Fields
                FarmIdHiddenField.Value    = farm.FarmId.ToString();
                PlotIdHiddenField.Value    = plot.PlotId.ToString();
                ContactIdHiddenField.Value = contact.ContactId.ToString();

                //Contact Details
                ContactIdLabel.Text        = contact.ContactId.ToString();
                ScheduleNumberLabel.Text   = contact.ScheduleNumber.ToString();
                OwnerFullNameLabel.Text    = contact.OwnerFullName;
                LotNumberLabel.Text        = contact.Lot.ToString();
                BlockLabel.Text            = contact.Block;
                SubdivisionLabel.Text      = contact.Subdivision;
                FilingLabel.Text           = contact.Filing;
                SiteAddressLabel.Text      = contact.SiteAddress;
                BedroomsLabel.Text         = contact.Bedrooms.ToString();
                FullBathLabel.Text         = contact.FullBath.ToString();
                ThreeQuarterBathLabel.Text = contact.ThreeQuarterBath.ToString();
                HalfBathLabel.Text         = contact.HalfBath.ToString();
                AcresLabel.Text            = contact.Acres.ToString();
                ActMktComboLabel.Text      = contact.ActMktComb;
                OwnerFirstNameLabel.Text   = contact.OwnerFirstName;
                OwnerLastNameLabel.Text    = contact.OwnerLastName;
                OwnerAddress1Label.Text    = contact.OwnerAddress1;
                OwnerArrdess2Label.Text    = contact.OwnerAddress2;
                OwnerCityLabel.Text        = contact.OwnerCity;
                OwnerStateLabel.Text       = contact.OwnerState;
                OwnerZipLabel.Text         = contact.OwnerZip;
                OwnerCountryLabel.Text     = contact.OwnerCountry;
                SaleDateLabel.Text         = contact.SaleDate.ToShortDateString();
                TransAmountLabel.Text      = contact.TransAmount.ToString();
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
                ErrorLiteral.Text = "UNKNOWN ERROR: Contact Administrator";
            }
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (IsPrinterRole)
            {
                DeleteFarmButton.Enabled = false;
                EditFarmButton.Enabled   = false;
                FirmUpButton.Enabled     = false;
                CreatePlotButton.Enabled = false;
            }
            int farmId = 0;
            if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null))
            {
                int.TryParse(Request.QueryString["farmId"], out farmId);
            }

            if (farmId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            FarmIdHiddenField.Value = farmId.ToString();

            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForFarm(farmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " ";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId);
                FarmNameLabel.Text    = farm.FarmName;
                MailingPlanLabel.Text = farm.MailingPlan.Title;
                CreateDateLabel.Text  = farm.CreateDate.ToShortDateString();
                if (farm.Firmup)
                {
                    FirmupStatusLabel.Text = "Firmed Up";
                }
                else
                {
                    FirmupStatusLabel.Text = "Not Firmed Up";
                }
                FarmContactCountLabel.Text = farm.ContactCount.ToString();
                PlotCountLabel.Text        = farm.PlotCount.ToString();

                FillPlotGrid(farm.Plots, 0);

                // ***************** Firm Up ***************** \\
                if (IsAgentRole)
                {
                    // Set the firm up button visible to agent.
                    FirmUpButtonPanel.Visible = true;

                    // Get the mailing plan of the farm.
                    int mailingPlanId = farm.MailingPlan.MailingPlanId;

                    // Get the design details of the agent.
                    DesignService.DesignService designService = serviceLoader.GetDesign();
                    DesignService.DesignInfo    design        = new DesignService.DesignInfo();
                    DesignService.DesignInfo    brochure      = new DesignService.DesignInfo();

                    RegistrationService.LoginInfo loginInfo =
                        (RegistrationService.LoginInfo)Session["loginInfo"];
                    IList <DesignService.DesignInfo> designs =
                        designService.GetList(loginInfo.UserId);

                    foreach (DesignService.DesignInfo designInfo in designs)
                    {
                        if (designInfo.Category.Name == "PowerKard")
                        {
                            design = designInfo;
                        }
                        else
                        {
                            brochure = designInfo;
                        }
                    }

                    // Get the credit card details of the logged in agent.
                    RegistrationService.RegistrationService registrationService =
                        serviceLoader.GetRegistration();
                    RegistrationService.CreditCardInfo creditCard =
                        registrationService.GetCreditCard(loginInfo.UserId);
                    bool isCreditCardValid = false;

                    if (creditCard != null)
                    {
                        DateTime expirationDate =
                            new DateTime(creditCard.ExpirationYear,
                                         creditCard.ExpirationMonth,
                                         1);

                        expirationDate = expirationDate.AddMonths(1);

                        if (expirationDate > DateTime.Today)
                        {
                            isCreditCardValid = true;
                        }
                    }

                    // Check whether the farm is ready for firm up.
                    if (mailingPlanId == 0)
                    {
                        FirmUpStatusHiddenField.Value = "MP_REQ";
                    }
                    else if (mailingPlanId == 100003)
                    {
                        // 8 x 8.
                        if (design.Status.Name != "Approved")
                        {
                            FirmUpStatusHiddenField.Value = "DESIGN_REQ";
                        }
                    }
                    else
                    {
                        if (design.Status.Name != "Approved" ||
                            brochure.Status.Name != "Approved")
                        {
                            FirmUpStatusHiddenField.Value = "DESIGN_REQ";
                        }
                    }

                    if (!isCreditCardValid)
                    {
                        FirmUpStatusHiddenField.Value = "CC_INVALID";
                    }

                    if (farm.Firmup)
                    {
                        FirmUpButton.Enabled = false;
                    }
                }
                // ******************************************* \\
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
                ErrorLiteral.Text = "Unknown Error Please contact Administrator:";
            }
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int farmId = 0;
            if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null))
            {
                int.TryParse(Request.QueryString["farmId"], out farmId);
            }

            if (farmId == 0)
            {
                Response.Redirect("~/Members/ArchivedFarmList.aspx");
            }

            FarmIdHiddenField.Value = farmId.ToString();

            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForFarm(farmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentPanel.Visible           = true;
                    ForAgentUserNameLabel.Text      = farmService.GetUserName(userId);
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentPanel.Visible = false;
                }

                FarmService.FarmInfo farm = farmService.GetArchivedFarmSummaryDetails(farmId);

                if (farm.FarmId == 0)
                {
                    Response.Redirect("~/Members/ArchivedFarmList.aspx", true);
                }
                else
                {
                    farm.UserId                = GetAgentId();
                    FarmNameLabel.Text         = farm.FarmName;
                    MailingPlanLabel.Text      = farm.MailingPlan.Title;
                    CreateDateLabel.Text       = farm.CreateDate.ToShortDateString();
                    FarmContactCountLabel.Text = farm.ContactCount.ToString();
                    PlotCountLabel.Text        = farm.PlotCount.ToString();
                    FarmService.PlotInfo[] Plots = farmService.GetArchivedPlotSummary(farmId);
                    PlotListGridView.DataSource = Plots;
                    PlotListGridView.DataBind();
                    for (int i = 0; i < PlotListGridView.Rows.Count; i++)
                    {
                        if (Plots[i].Deleted)
                        {
                            PlotListGridView.Rows[i].ForeColor = System.Drawing.Color.DarkKhaki;
                        }
                        else
                        {
                            PlotListGridView.Rows[i].ForeColor        = System.Drawing.Color.Green;
                            PlotListGridView.Rows[i].Cells[0].Enabled = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
                ErrorLiteral.Text = "Unknown Error Please contact Administrator:";
            }
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
            try
            {
                int farmId = 0;
                if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null))
                {
                    int.TryParse(Request.QueryString["farmId"], out farmId);
                }

                if (farmId == 0)
                {
                    Response.Redirect("~/Members/FarmManagement.aspx");
                }

                // Get the common web service instance.

                ServiceAccess                   serviceLoader   = ServiceAccess.GetInstance();
                FarmService.FarmService         farmService     = serviceLoader.GetFarm();
                ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule();

                IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList();
                MailingPlanDropDownList.DataSource     = mailingPlans;
                MailingPlanDropDownList.DataValueField = "MailingPlanId";
                MailingPlanDropDownList.DataTextField  = "Title";
                MailingPlanDropDownList.DataBind();

                FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId);
                farm.UserId             = farmService.GetUserIdForFarm(farmId);
                UserIdHiddenField.Value = farm.UserId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(farm.UserId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = farm.UserId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }


                FarmIdHiddenField.Value = farm.FarmId.ToString();
                PlotIdHiddenField.Value = farm.Plots[0].PlotId.ToString();
                FarmNameTextBox.Text    = farm.FarmName;
                MailingPlanDropDownList.SelectedValue = farm.MailingPlan.MailingPlanId.ToString();
                if (farm.Plots[0].ContactCount > 0)
                {
                    ContactListFileRequiredFieldValidator.Enabled = false;
                }
                if (farm.Firmup)
                {
                    MailingPlanDropDownList.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }