示例#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/ArchivedPlotList.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)
                {
                    ForAgentPanel.Visible           = true;
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                    ForAgentUserNameLabel.Text      = farmService.GetUserName(userId);
                }
                else
                {
                    ForAgentPanel.Visible = false;
                }

                //Getting Archived Plot Header Details
                FarmService.PlotInfo plot = farmService.GetArchivedPlotSummaryDetails(plotId);

                //Getting Parent Farm Details
                FarmService.FarmInfo farm = farmService.GetArchivedFarmSummaryDetails(plot.FarmId);

                PlotNameLabel.Text      = farm.FarmName + " / " + plot.PlotName;
                ContactCountLabel.Text  = plot.ContactCount.ToString();
                CreateDateLabel.Text    = plot.CreateDate.ToShortDateString();
                FarmIdHiddenField.Value = plot.FarmId.ToString();

                FarmService.ContactInfo[] contacts = farmService.GetArchivedContactListForPlot(plotId);
                ContactListGridView.DataSource = contacts;
                ContactListGridView.DataBind();
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR LOADING ARCHIVE CONTACT LIST:", exception);
                MessageLiteral.Text = "UNKNOWN ERROR: Please Contact Administrator";
            }
        }
    }
示例#2
0
    protected void PlotListGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        FarmService.FarmService farmService = serviceLoader.GetFarm();

        int farmId = Convert.ToInt32(FarmIdHiddenField.Value);

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

        FillPlotGrid(farm.Plots, e.NewPageIndex);
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        // Get the query string values.
        NameValueCollection coll = Request.QueryString;

        int      farmId    = Convert.ToInt32(coll.Get("farmId"));
        DateTime startDate = Convert.ToDateTime(coll.Get("start_date"));

        if (!IsPostBack)
        {
            // Get the logged in account information.
            RegistrationService.LoginInfo loginInfo =
                (RegistrationService.LoginInfo)Session["loginInfo"];

            // Set the required query string varables into hidden fields.
            FarmIdHiddenField.Value    = farmId.ToString();
            StartDateHiddenField.Value = startDate.ToString("MM/dd/yyyy");

            try
            {
                // Get the farm details and display.
                FarmService.FarmService farmService = serviceLoader.GetFarm();
                FarmService.FarmInfo    farm        = farmService.GetFarmDetail(farmId);

                FarmNameLabel.Text     = farm.FarmName;
                PlotCountLabel.Text    = farm.PlotCount.ToString();
                ContactCountLabel.Text = farm.ContactCount.ToString();
                int planId = farm.MailingPlan.MailingPlanId;
                PlanIdHiddenField.Value = planId.ToString();
                MailingPlanLabel.Text   = farm.MailingPlan.Title;
                CreatedOnLabel.Text     = farm.CreateDate.ToString("MM/dd/yyyy");

                // Get the scheduled events and display.
                ScheduleService.ScheduleService scheduleService =
                    serviceLoader.GetSchedule();
                IList <ScheduleService.ScheduleEventInfo> events =
                    scheduleService.GetPlanEvents(planId, startDate);

                EventsDataGrid.DataSource = events;
                EventsDataGrid.DataBind();
            }
            catch (Exception ex)
            {
                ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                ErrorMessageLabel.Visible = true;

                log.Error("Unknown Error", ex);
            }
        }
    }
示例#4
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 + "&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();
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }
示例#5
0
    protected void ApproveButton_Click(object sender, EventArgs e)
    {
        bool isError = false;

        try
        {
            ServiceAccess                   serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService         farmService   = serviceLoader.GetFarm();
            IList <FarmService.ContactInfo> contacts      = (IList <FarmService.ContactInfo>)Session["Contacts"];
            Session.Remove("Contacts");
            FarmService.FarmInfo farm = new FarmService.FarmInfo();
            farm.FarmName    = FarmNameTextBox.Text;
            farm.MailingPlan = new FarmService.MailingPlanInfo();
            farm.MailingPlan.MailingPlanId = int.Parse(MailingPlanDropDownList.SelectedValue);
            farm.LastModifyBy          = LoginUserId;
            farm.Plots                 = new FarmService.PlotInfo[1];
            farm.Plots[0]              = new FarmService.PlotInfo();
            farm.Plots[0].PlotId       = 0;
            farm.Plots[0].PlotName     = FarmNameTextBox.Text;
            farm.Plots[0].Contacts     = (FarmService.ContactInfo[])contacts;
            farm.Plots[0].LastModifyBy = LoginUserId;
            farm.UserId                = GetAgentId();
            farmService.CreateFarmPlot(farm);
        }
        catch (Exception exception)
        {
            if (exception.Message.Contains("No Contacts processed. Farm cannot be Empty."))
            {
                ErrorLiteral.Text = "No Contacts processed. Farm cannot be Empty.";
            }
            else
            {
                log.Error("UNKNOWN ERROR WHILE CREATING Farm:", exception);
                ErrorLiteral.Text = "UNKNOWN ERROR WHILE CREATING Farm. Please Contact Administrator";
            }
            isError = true;
        }
        if (!isError)
        {
            Response.Redirect("~/Members/FarmManagement.aspx");
        }
    }
示例#6
0
    protected void ApproveButton_Click(object sender, EventArgs e)
    {
        try
        {
            ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService farmService   = serviceLoader.GetFarm();

            IList <FarmService.ContactInfo> contacts = (IList <FarmService.ContactInfo>)Session["Contacts"];
            Session.Remove("Contacts");
            FarmService.FarmInfo farm = new FarmService.FarmInfo();
            farm.FarmId      = Convert.ToInt32(FarmIdHiddenField.Value);
            farm.FarmName    = FarmNameTextBox.Text;
            farm.MailingPlan = new FarmService.MailingPlanInfo();
            farm.MailingPlan.MailingPlanId = int.Parse(MailingPlanDropDownList.SelectedValue);
            farm.LastModifyBy          = LoginUserId;
            farm.Plots                 = new FarmService.PlotInfo[1];
            farm.Plots[0]              = new FarmService.PlotInfo();
            farm.Plots[0].PlotId       = Convert.ToInt32(PlotIdHiddenField.Value);
            farm.Plots[0].PlotName     = FarmNameTextBox.Text;
            farm.Plots[0].LastModifyBy = LoginUserId;
            farm.Plots[0].Contacts     = (FarmService.ContactInfo[])contacts;
            farm.UserId                = GetAgentId();
            farmService.UpdateFarmPlot(farm);
            Response.Redirect(GetRedirectURL());
        }
        catch (Exception exception)
        {
            if (exception.Message.Contains("You are changing Farm Name and this will change the name of Primary Plot.This name already existing in its Plot lists. Please Provide a different Farm name."))
            {
                ErrorLiteral1.Text = "You are changing Farm Name and this will change the name of Primary Plot.This name already existing in its Plot lists. Please Provide a different Farm name.";
            }
            else
            {
                ErrorLiteral1.Text = "UNKNOWN ERROR! PLEASE CONTACT ADMINISTRATOR";
                log.Error("UNKNOWN ERROR WHILE APPROVING THE CONTACT LISTS IN MODIFY FARM:", exception);
            }
        }
    }
示例#7
0
    protected void RestoreContactButton_Click(object sender, EventArgs e)
    {
        bool jumpError = false;

        try
        {
            ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService farmService   = serviceLoader.GetFarm();
            int plotId = int.Parse(PlotIdHiddenField.Value.ToString());

            for (int i = 0; i < ContactListGridView.Rows.Count; i++)
            {
                GridViewRow row       = ContactListGridView.Rows[i];
                bool        isChecked = ((CheckBox)row.FindControl("ContactIdCheckBox")).Checked;
                if (isChecked)
                {
                    Int64 contactId = Int64.Parse(((CheckBox)row.FindControl("ContactIdCheckBox")).ToolTip);
                    farmService.RestoreContact(contactId, LoginUserId);
                }
            }

            FarmService.ContactInfo[] contacts = farmService.GetArchivedContactListForPlot(plotId);

            if (contacts.Length == 0)
            {
                Response.Redirect("~/Members/ArchivedPlotList.aspx");
            }
            else
            {
                //Getting Archived Plot Header Details
                FarmService.PlotInfo plot = farmService.GetArchivedPlotSummaryDetails(plotId);

                //Getting Parent Farm Details
                FarmService.FarmInfo farm = farmService.GetArchivedFarmSummaryDetails(plot.FarmId);

                PlotNameLabel.Text     = farm.FarmName + " / " + plot.PlotName;
                ContactCountLabel.Text = plot.ContactCount.ToString();
                CreateDateLabel.Text   = plot.CreateDate.ToShortDateString();

                ContactListGridView.DataSource = contacts;
                ContactListGridView.DataBind();
            }
        }
        catch (Exception exception)
        {
            log.Error("UNKNOWN ERROR WHILE RESTORING CONTACT:", exception);
            if (exception.Message.Contains("Parent Plot / Farm is not active. Contact cannot be restored."))
            {
                MessageLiteral.Text = "Parent Plot / Farm is not active. Contact cannot be restored.";
            }
            else
            {
                MessageLiteral.Text = "UNKNOWN ERROR: Please Contact Administrator";
                jumpError           = true;
            }
        }
        if (jumpError)
        {
            Response.Redirect("~/Members/ArchivedPlotList.aspx?farmId=" + FarmIdHiddenField.Value.ToString());
        }
    }
示例#8
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 + "&nbsp;";
                    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";
            }
        }
    }
示例#9
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 + "&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();
                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:";
            }
        }
    }
示例#10
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:";
            }
        }
    }
示例#11
0
    protected void RestorePlotButton_Click(object sender, EventArgs e)
    {
        bool jumpError = false;

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

            for (int i = 0; i < PlotListGridView.Rows.Count; i++)
            {
                GridViewRow row       = PlotListGridView.Rows[i];
                bool        isChecked = ((CheckBox)row.FindControl("PlotIdCheckBox")).Checked;
                if (isChecked)
                {
                    int plotId = int.Parse(((CheckBox)row.FindControl("PlotIdCheckBox")).ToolTip);
                    farmService.RestorePlotContact(plotId, LoginUserId);
                }
            }

            int farmId = int.Parse(FarmIdHiddenField.Value.ToString());
            FarmService.FarmInfo farm = farmService.GetArchivedFarmSummaryDetails(farmId);
            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 exception)
        {
            if (exception.Message.Contains("Parent Farm is in Deleted State. Plot Cannot be restored"))
            {
                ErrorLiteral.Text = "Parent Farm is in Deleted State. Plot Cannot be restored";
            }
            else
            {
                log.Error("UNKNOWN ERROR WHILE RESTORING CONTACT:", exception);
                ErrorLiteral.Text = "Unknown Error Please contact Administrator:";
                jumpError         = true;
            }
            if (jumpError)
            {
                Response.Redirect("~/Members/ArchivedFarmList.aspx");
            }
        }
    }
示例#12
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 = "";
            }
        }
    }
示例#13
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);
            }
        }
    }
示例#14
0
    protected void ModifyFarmButton_Click(object sender, EventArgs e)
    {
        //Store Farm Details and Farm Contact details into the Session
        try
        {
            ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService farmService   = serviceLoader.GetFarm();

            //Checking For Duplicate Farm Name
            if (farmService.IsFarmNameDuplicateWhileEditingFarm(
                    GetAgentId(),
                    Convert.ToInt32(FarmIdHiddenField.Value),
                    FarmNameTextBox.Text))
            {
                ErrorLiteral.Text = "Farm name already exists, Please enter a different farm name";
                return;
            }

            IList <FarmService.ContactInfo> contacts = null;
            //Checking File Type
            if (ContactListFileUpload.HasFile)
            {
                if (ContactListFileUpload.FileName.EndsWith(".csv"))
                {
                    contacts = farmService.GetFarmListFromFile(ContactListFileUpload.FileName, Irmac.MailingCycle.BLLServiceLoader.Farm.ContactFileType.Csv, ContactListFileUpload.FileBytes, LoginUserId);
                }
                else
                {
                    if (ContactListFileUpload.FileName.EndsWith(".xls"))
                    {
                        contacts = farmService.GetFarmListFromFile(ContactListFileUpload.FileName, Irmac.MailingCycle.BLLServiceLoader.Farm.ContactFileType.Excel, ContactListFileUpload.FileBytes, LoginUserId);
                    }
                    else
                    {
                        ErrorLiteral.Text = "Invalid File Uploaded. Please Check your file Extention (Must be either .csv or .xls)";
                        return;
                    }
                }
            }

            if (contacts != null)
            {
                ContactListGridView.DataSource = contacts;
                ContactListGridView.DataBind();
                Panel1.Visible      = false;
                Panel2.Visible      = true;
                Session["Contacts"] = contacts;
                if (!IsAgentRole)
                {
                    ForAgentLiteral1.Visible = true;
                    ForAgentLiteral1.Text    = ForAgentLiteral.Text;
                }
                else
                {
                    ForAgentLiteral1.Visible = false;
                }

                ErrorLiteral.Text = "";
            }
            else
            {
                FarmService.FarmInfo farm = new FarmService.FarmInfo();
                farm.FarmId      = Convert.ToInt32(FarmIdHiddenField.Value);
                farm.FarmName    = FarmNameTextBox.Text;
                farm.MailingPlan = new FarmService.MailingPlanInfo();
                farm.MailingPlan.MailingPlanId = int.Parse(MailingPlanDropDownList.SelectedValue);
                farm.LastModifyBy          = LoginUserId;
                farm.Plots                 = new FarmService.PlotInfo[1];
                farm.Plots[0]              = new FarmService.PlotInfo();
                farm.Plots[0].PlotId       = Convert.ToInt32(PlotIdHiddenField.Value);
                farm.Plots[0].PlotName     = FarmNameTextBox.Text;
                farm.Plots[0].LastModifyBy = LoginUserId;
                farm.Plots[0].Contacts     = null;
                farm.UserId                = GetAgentId();
                farmService.UpdateFarmPlot(farm);
                Response.Redirect(GetRedirectURL());
            }
        }
        catch (Exception ex)
        {
            log.Error("UNKNOWN ERROR:", ex);
            if (ex.Message.Contains("Irmac.MailingCycle.BLL.NoDataException"))
            {
                ErrorLiteral.Text = "The file does not have any data.";
            }
            else if (ex.Message.Contains("Irmac.MailingCycle.BLL.InvalidFormatException"))
            {
                ErrorLiteral.Text = "The file is in invalid format.";
            }
            else if (ex.Message.Contains("Irmac.MailingCycle.BLL.InvalidDataException"))
            {
                ErrorLiteral.Text = "Incomplete data in the uploaded file.";
            }
            else if (ex.Message.Contains("Irmac.MailingCycle.BLL.InvalidFieldDataException"))
            {
                ErrorLiteral.Text = "Incomplete data in the uploaded file.";
            }
            else if (ex.Message.Contains("Farm Name already Exist"))
            {
                ErrorLiteral.Text = "Farm Name already exists";
            }
            else if (ex.Message.Contains("You are changing Farm Name and this will change the name of Primary Plot.This name already existing in its Plot lists. Please Provide a different Farm name."))
            {
                ErrorLiteral.Text = "You are changing Farm Name and this will change the name of Primary Plot.This name already existing in its Plot lists. Please Provide a different Farm name.";
            }
            else if (ex.Message.Contains("No valid Contact records in the uploaded File."))
            {
                ErrorLiteral.Text = "No valid Contact records in the uploaded File.";
            }
            else
            {
                ErrorLiteral.Text = "Unknown Error. Please Contact Administrator.";
            }
        }
    }