Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int plotId = 0;

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

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

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

                int userId = farmService.GetUserIdForPlot(plotId);
                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.PlotInfo plot = farmService.GetPlotDetail(plotId);
                PlotNameLabel.Text     = plot.PlotName;
                ContactCountLabel.Text = plot.ContactCount.ToString();
                CreateDateLabel.Text   = plot.CreateDate.ToShortDateString();

                PlotIdHiddenField.Value = plotId.ToString();
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
            }
        }
    }
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)
            {
                MoveToButton.Enabled        = false;
                DeleteContactButton.Enabled = false;
                DeletePlotButton.Enabled    = false;
                AddContactButton.Enabled    = false;
                EditPlotButton.Enabled      = false;
            }
            int plotId = 0;

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

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

            ExportToExcelButton.CausesValidation = false;
            ExportToExcelButton.OnClientClick    = "javascript: window.open('./ExcelOrCsvFileDownload.aspx?plotId=" + plotId.ToString() + "');";
            PlotIdHiddenField.Value = plotId.ToString();

            try
            {
                // Get the common web service instance.
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForPlot(plotId);
                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.PlotInfo plot = farmService.GetPlotDetail(plotId);
                PlotNameLabel.Text             = plot.PlotName;
                ContactCountLabel.Text         = plot.ContactCount.ToString();
                CreateDateLabel.Text           = plot.CreateDate.ToShortDateString();
                FarmIdHiddenField.Value        = plot.FarmId.ToString();
                ContactListGridView.DataSource = plot.Contacts;
                ContactListGridView.DataBind();

                //Default Plot flag for validation in Javascript
                if (farmService.IsDefaultPlot(plotId))
                {
                    DefaultPlotFlagHiddenField.Value = "true";
                }
                else
                {
                    DefaultPlotFlagHiddenField.Value = "false";
                }

                //Validation related Data stored in Hidden Field
                if (farmService.IsDefaultPlot(plot.PlotId))
                {
                    DefaultContactHiddenField.Value = "true";
                    MoveToButton.Enabled            = true;

                    //Move to for single contact in a default plot disabled

                    /*if (plot.Contacts.Length < 2)
                     *  MoveToButton.Enabled = false;
                     * else
                     *  MoveToButton.Enabled = true;*/
                }
                else
                {
                    DefaultContactHiddenField.Value = "false";
                    MoveToButton.Enabled            = true;
                }

                ContactCountHiddenField.Value = plot.Contacts.Length.ToString();

                //For Single Contact in Default Plot
                if (IsPrinterRole)
                {
                    for (int i = 0; i < plot.Contacts.Length; i++)
                    {
                        ContactListGridView.Rows[i].Cells[0].FindControl("EditContactHyperLink").Visible = false;
                        ContactListGridView.Rows[i].Cells[0].FindControl("ContactIdCheckBox").Visible    = false;
                    }
                }
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
            }
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;

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

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

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

            if (plotId == 0)
            {
                Response.Redirect("~/Members/viewFarm.aspx?farmId=" + farmId);
            }

            FarmIdHiddenField.Value = farmId.ToString();
            PlotIdHiddenField.Value = plotId.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 + "&nbsp;";
                    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();

                FarmIdHiddenField.Value = farmId.ToString();
                PlotIdHiddenField.Value = plotId.ToString();

                FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId);
                PlotNameTextBox.Text = plot.PlotName;

                if (plot.ContactCount > 0)
                {
                    ContactListFileRequiredFieldValidator.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int plotId = 100107;

            //if ((Request.QueryString["plotId"] != "") && (Request.QueryString["plotId"] != null))
            //    int.TryParse(Request.QueryString["plotId"], out plotId);

            //if (plotId == 0)
            //    Response.Redirect("~/Members/FarmManagement.aspx");

            PlotIdHiddenField.Value = plotId.ToString();

            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForPlot(plotId);
                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 + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }
                FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId);
                FarmIdHiddenField.Value        = plot.FarmId.ToString();
                ContactListGridView.DataSource = plot.Contacts;
                ContactListGridView.DataBind();

                //Block Edit Course for the Printer

                /*
                 * if (IsPrinterRole)
                 * {
                 *  ContactListGridView.Columns.RemoveAt(0);
                 *  ContactListGridView.Columns.RemoveAt(1);
                 *
                 *  for (int i = 0; i < plot.Contacts.Length; i++)
                 *  {
                 *      ContactListGridView.Rows[i].Cells[0].FindControl("EditContactHyperLink").Visible = false;
                 *      ContactListGridView.Rows[i].Cells[0].FindControl("ContactIdCheckBox").Visible = false;
                 *  }
                 * }
                 */
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
            }
        }
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            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();

                FarmService.ContactInfo contact = farmService.GetContactDetails(contactId);

                int userId = farmService.GetUserIdForPlot(contact.PlotId);
                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 + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }
                ContactIdLabel.Text          = contact.ContactId.ToString();
                ScheduleNumberTextBox.Text   = contact.ScheduleNumber.ToString();
                OwnerFullNameTextBox.Text    = contact.OwnerFullName;
                LotTextBox.Text              = contact.Lot.ToString();
                BlockTextBox.Text            = contact.Block;
                SubDivisionTextBox.Text      = contact.Subdivision;
                FilingTextBox.Text           = contact.Filing;
                SiteAddressTextBox.Text      = contact.SiteAddress;
                BedroomsTextBox.Text         = contact.Bedrooms.ToString();
                FullBathTextBox.Text         = contact.FullBath.ToString();
                ThreeQuarterBathTextBox.Text = contact.ThreeQuarterBath.ToString();
                HalfBathTextBox.Text         = contact.HalfBath.ToString();
                AcresTextBox.Text            = contact.Acres.ToString();
                ActMktCombTextBox.Text       = contact.ActMktComb;
                OwnerFirstNameTextBox.Text   = contact.OwnerFirstName;
                OwnerLastNameTextBox.Text    = contact.OwnerLastName;
                OwnerAddress1TextBox.Text    = contact.OwnerAddress1;
                OwnerAddress2TextBox.Text    = contact.OwnerAddress2;
                OwnerCityTextBox.Text        = contact.OwnerCity;
                OwnerStateTextBox.Text       = contact.OwnerState;
                OwnerZipTextBox.Text         = contact.OwnerZip;
                OwnerCountryTextBox.Text     = contact.OwnerCountry;
                SaleDateTextBox.Text         = contact.SaleDate.ToShortDateString();
                TransAmountTextBox.Text      = contact.TransAmount.ToString();
                PlotIdHiddenField.Value      = contact.PlotId.ToString();

                FarmService.PlotInfo plot = farmService.GetPlotDetail(Convert.ToInt32(PlotIdHiddenField.Value));
                PlotNameLabel.Text     = plot.PlotName;
                ContactCountLabel.Text = plot.ContactCount.ToString();
                CreateDateLabel.Text   = plot.CreateDate.ToShortDateString();
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
            }
        }
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int    farmId            = 0;
            int    plotId            = 0;
            string contactIdsFromGET = "";

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

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

            contactIdsFromGET = Request.QueryString["contactIds"];

            FarmIdHiddenField.Value     = farmId.ToString();
            PlotIdHiddenField.Value     = plotId.ToString();
            ContactIdsHiddenField.Value = contactIdsFromGET;

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

                //Getting Farm Name
                FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId);
                FarmNameLabel.Text = farm.FarmName;

                //Getting From Plot Name
                FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId);
                PlotNameLabel.Text = plot.PlotName;

                //Get Plot List for the Farm
                IList <FarmService.PlotInfo> plots = farmService.GetPlotListSummaryForFarm(farmId);
                PlotListDropDownList.DataSource     = plots;
                PlotListDropDownList.DataValueField = "PlotId";
                PlotListDropDownList.DataTextField  = "PlotName";
                PlotListDropDownList.DataBind();
                PlotListDropDownList.Items.Insert(0, new ListItem("<Select a Plot>", "-1"));
                PlotListDropDownList.Items.Remove(PlotListDropDownList.Items.FindByValue(plotId.ToString()));
                PlotListDropDownList.Items.Add(new ListItem("New Plot ...", "-2"));
                PlotListDropDownList.Attributes.Add("onChange", "javascript: newPlot(this);");
                NewPlotHiddenField.Value = "";
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR WHILE LOADING MOVECONTACT:", exception);
                ErrorLiteral.Text  = "Unable to Load the Farm";
                SaveButton.Visible = false;
            }
        }
        else
        {
            if ((NewPlotHiddenField.Value.ToString() != "") && (PlotListDropDownList.SelectedValue.ToString() == "-2"))
            {
                PlotListDropDownList.Items.FindByValue("-2").Text = NewPlotHiddenField.Value.ToString();
            }
            else
            {
                PlotListDropDownList.Items.FindByValue("-2").Text = "New Plot ...";
                NewPlotHiddenField.Value = "";
            }
        }
    }