コード例 #1
0
        public void FillFarmGrid()
        {
            DataTable dt = VSWebBL.DashboardBL.SharepointDetailsBL.Ins.GetFarmDetails();

            Session["SharePointFarmGrid"] = dt;

            FarmGridView.DataSource = dt;
            FarmGridView.DataBind();
        }
コード例 #2
0
    protected void RestoreFarmButton_Click(object sender, EventArgs e)
    {
        try
        {
            // Get the common web service instance.
            ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService farmService   = serviceLoader.GetFarm();

            for (int i = 0; i < FarmGridView.Rows.Count; i++)
            {
                GridViewRow row       = FarmGridView.Rows[i];
                bool        isChecked = ((CheckBox)row.FindControl("FarmIdCheckBox")).Checked;
                if (isChecked)
                {
                    int farmId = int.Parse(((CheckBox)row.FindControl("FarmIdCheckBox")).ToolTip);
                    farmService.RestoreFarmPlot(farmId, LoginUserId);
                }
            }

            FarmService.FarmInfo[] farmList;
            farmList = farmService.GetArchivedFarmSummary(GetAgentId());
            FarmGridView.DataSource = farmList;
            FarmGridView.DataBind();
            if (farmList.Length == 0)
            {
                NoFarmDataPanel.Visible = true;
            }
            else
            {
                NoFarmDataPanel.Visible = false;
                for (int i = 0; i < FarmGridView.Rows.Count; i++)
                {
                    if (farmList[i].Deleted == true)
                    {
                        FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Red;
                    }
                    else if (farmList[i].PlotCount == 0)
                    {
                        FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        FarmGridView.Rows[i].ForeColor = System.Drawing.Color.DarkKhaki;
                    }
                }
            }
        }
        catch (Exception exception)
        {
            log.Error("UNKNOWN ERROR WHILE RESTORE FARM:", exception);
            MessageLiteral.Text = "Error: Unable to Restore Farm";
        }
    }
コード例 #3
0
        public void FillFarmGridFromSession()
        {
            DataTable DataServers = new DataTable();

            try
            {
                if (Session["SharePointFarmGrid"] != null && Session["SharePointFarmGrid"] != "")
                {
                    DataServers = Session["SharePointFarmGrid"] as DataTable;
                }

                FarmGridView.DataSource = DataServers;
                FarmGridView.DataBind();
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
        }
コード例 #4
0
 protected void SelectedAgentButton_Click(object sender, EventArgs e)
 {
     try
     {
         // Get the common web service instance.
         ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
         FarmService.FarmService farmService   = serviceLoader.GetFarm();
         FarmService.FarmInfo[]  farmList;
         farmList = farmService.GetArchivedFarmSummary(GetAgentId());
         FarmGridView.DataSource = farmList;
         FarmGridView.DataBind();
         if (farmList.Length == 0)
         {
             NoFarmDataPanel.Visible = true;
         }
         else
         {
             NoFarmDataPanel.Visible = false;
             for (int i = 0; i < FarmGridView.Rows.Count; i++)
             {
                 if (farmList[i].Deleted == true)
                 {
                     FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Red;
                 }
                 else if (farmList[i].PlotCount == 0)
                 {
                     FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Green;
                 }
                 else
                 {
                     FarmGridView.Rows[i].ForeColor = System.Drawing.Color.DarkKhaki;
                 }
             }
         }
     }
     catch (Exception exception)
     {
         log.Error("UNKNOWN ERROR:", exception);
         ErrorLiteral.Text = "UNKNOWN ERROR. Contact Administrator";
     }
 }
コード例 #5
0
    private void FillFarmGrid(int pageNumber)
    {
        try
        {
            // Get the common web service instance.
            ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
            FarmService.FarmService farmService   = serviceLoader.GetFarm();

            FarmService.FarmInfo[] farms = farmService.GetFarmSummary(GetAgentId());
            FarmGridView.DataSource = farms;
            FarmGridView.PageIndex  = pageNumber;
            FarmGridView.DataBind();

            if (farms.Length == 0)
            {
                NoFarmDataPanel.Visible = true;
            }
            else
            {
                NoFarmDataPanel.Visible = false;

                if (IsPrinterRole)
                {
                    for (int i = 0; i < FarmGridView.Rows.Count; i++)
                    {
                        FarmGridView.Rows[i].Cells[0].FindControl("EditHyperLink").Visible = false;
                    }

                    ArchivedFarmHyperLink.Visible = false;
                }
            }
        }
        catch (Exception exception)
        {
            log.Error("UNKNOWN ERROR:", exception);
            ErrorLiteral.Text = "UNKNOWN ERROR. Contact Administrator";
        }
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IsArchived = true;
        if (!Page.IsPostBack)
        {
            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                if (IsAgentRole)
                {
                    AgentListPanel.Visible = false;
                    FarmService.FarmInfo[] farmList;
                    farmList = farmService.GetArchivedFarmSummary(GetAgentId());
                    FarmGridView.DataSource = farmList;
                    FarmGridView.DataBind();
                    if (farmList.Length == 0)
                    {
                        NoFarmDataPanel.Visible = true;
                    }
                    else
                    {
                        NoFarmDataPanel.Visible = false;
                        for (int i = 0; i < FarmGridView.Rows.Count; i++)
                        {
                            if (farmList[i].Deleted == true)
                            {
                                FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Red;
                            }
                            else if (farmList[i].PlotCount == 0)
                            {
                                FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Green;
                            }
                            else
                            {
                                FarmGridView.Rows[i].ForeColor = System.Drawing.Color.DarkKhaki;
                            }
                            if (farmList[i].Deleted == false)
                            {
                                FarmGridView.Rows[i].Cells[0].Enabled = false;
                            }
                        }
                    }
                }
                else
                {
                    AgentListPanel.Visible = true;
                    CommonService commonService = serviceLoader.GetCommon();
                    AgentListDropDownList.DataSource     = commonService.GetAgentsList();
                    AgentListDropDownList.DataValueField = "UserId";
                    AgentListDropDownList.DataTextField  = "UserName";
                    AgentListDropDownList.DataBind();
                    AgentListDropDownList.Items.Insert(0, "Select an Agent");
                }
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
                ErrorLiteral.Text = "UNKNOWN ERROR. Contact Administrator";
            }
        }
    }