Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadConditionData();
            try
            {
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();

                AgentListPanel.Visible = true;
                CommonService commonService = serviceLoader.GetCommon();
                AgentListDropDownList.DataSource     = commonService.GetAgentsList();
                AgentListDropDownList.DataValueField = "UserId";
                AgentListDropDownList.DataTextField  = "UserName";
                AgentListDropDownList.DataBind();
                AgentListDropDownList.Items.Insert(0, "All Agents");

                IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList();
                MailingPlanDropDownList.DataSource     = mailingPlans;
                MailingPlanDropDownList.DataValueField = "MailingPlanId";
                MailingPlanDropDownList.DataTextField  = "Title";
                MailingPlanDropDownList.DataBind();
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR WHILE LOADIN FARM DATA REPORT CRITERIA:", exception);
            }
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
            try
            {
                // Get the common web service instance.
                int userId = 0;

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

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

                UserIdHiddenField.Value = userId.ToString();
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();

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

                IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList();
                MailingPlanDropDownList.DataSource     = mailingPlans;
                MailingPlanDropDownList.DataValueField = "MailingPlanId";
                MailingPlanDropDownList.DataTextField  = "Title";
                MailingPlanDropDownList.DataBind();
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }
Esempio n. 3
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);
            }
        }
    }