Esempio n. 1
0
 protected void FarmDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (FarmDropDownList.SelectedValue.ToString().Equals("0"))
     {
         PlotDropDownList.Items.Clear();
         PlotDropDownList.Items.Add(new ListItem("All Plots", "0"));
     }
     else
     {
         try
         {
             int farmId = 0;
             farmId = int.Parse(FarmDropDownList.SelectedValue.ToString());
             // Get the common web service instance.
             ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
             FarmService.FarmService farmService   = serviceLoader.GetFarm();
             PlotDropDownList.DataSource     = farmService.GetPlotListForFarm(farmId);
             PlotDropDownList.DataValueField = "PlotId";
             PlotDropDownList.DataTextField  = "PlotName";
             PlotDropDownList.DataBind();
             PlotDropDownList.Items.Insert(0, new ListItem("All Plots", "0"));
         }
         catch (Exception exception)
         {
             log.Error("UNKNOWN ERROR IN SEARCH FARM FARM SELECTION CHANGED:", exception);
             ErrorLiteral.Text = "UNKNOWN ERROR: Please Contact Administrator";
         }
     }
 }
    protected void Farm_Changed(object sender, EventArgs e)
    {
        // Populate plots into dropdown list.
        try
        {
            int farmId = Convert.ToInt32(FarmDropDownList.SelectedValue);

            FarmService.FarmService farmService = serviceLoader.GetFarm();

            PlotDropDownList.DataSource     = farmService.GetFarmDetail(farmId).Plots;
            PlotDropDownList.DataValueField = "PlotId";
            PlotDropDownList.DataTextField  = "PlotName";
            PlotDropDownList.DataBind();

            PlotDropDownList.Items.Insert(0, new ListItem("<All Plots>", "0"));
        }
        catch (Exception ex)
        {
            ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
            ErrorMessageLabel.Visible = true;

            log.Error("Unknown Error", ex);
        }
    }