Example #1
0
        private void FillExchangeServerGridfromSession()
        {
            try
            {
                DataTable ExchangeSettingsDataTable = new DataTable();
                if (Session["ExchangeServer"] != null && Session["ExchangeServer"] != "")
                {
                    ExchangeSettingsDataTable = (DataTable)Session["ExchangeServer"];                    //VSWebBL.ConfiguratorBL.ExchangePropertiesBL.Ins.GetAllData();
                }
                if (ExchangeSettingsDataTable.Rows.Count > 0)
                {
                    GridViewDataColumn column3 = MessageLatencyTestgrd.Columns["LatencyYellowThreshold"] as GridViewDataColumn;
                    GridViewDataColumn column4 = MessageLatencyTestgrd.Columns["LatencyRedThreshold"] as GridViewDataColumn;
                    int startIndex             = MessageLatencyTestgrd.PageIndex * MessageLatencyTestgrd.SettingsPager.PageSize;
                    int endIndex = Math.Min(MessageLatencyTestgrd.VisibleRowCount, startIndex + MessageLatencyTestgrd.SettingsPager.PageSize);
                    for (int i = startIndex; i < endIndex; i++)
                    {
                        ASPxTextBox txtValue  = (ASPxTextBox)MessageLatencyTestgrd.FindRowCellTemplateControl(i, column3, "txtyellowthreshValue");
                        ASPxTextBox txtValue2 = (ASPxTextBox)MessageLatencyTestgrd.FindRowCellTemplateControl(i, column4, "txtredthreshValue");

                        ExchangeSettingsDataTable.Rows[i]["LatencyYellowThreshold"] = (string.IsNullOrEmpty(txtValue.Text.Trim())? "0" :txtValue.Text.Trim());

                        ExchangeSettingsDataTable.Rows[i]["LatencyRedThreshold"] = (string.IsNullOrEmpty(txtValue2.Text.Trim())? "0" :txtValue2.Text.Trim());


                        if (MessageLatencyTestgrd.Selection.IsRowSelected(i))
                        {
                            checkedvalue = Convert.ToBoolean(ExchangeSettingsDataTable.Rows[i]["EnableLatencyTest"] = "true");
                        }
                        else
                        {
                            ExchangeSettingsDataTable.Rows[i]["EnableLatencyTest"] = "false";
                            checkedvalue = Convert.ToBoolean(ExchangeSettingsDataTable.Rows[i]["EnableLatencyTest"] = "false");
                        }
                        id = Convert.ToInt32(MessageLatencyTestgrd.GetRowValues(i, "ServerId"));

                        yellowthershold = Convert.ToInt32(string.IsNullOrEmpty(txtValue.Text.Trim()) ? "0" : txtValue.Text.Trim());
                        latency         = Convert.ToInt32(string.IsNullOrEmpty(txtValue2.Text.Trim())? "0" : txtValue2.Text.Trim());
                        object dt = VSWebBL.ExchangeBAL.Ins.updateEnableLatencyTest(id, yellowthershold, latency, checkedvalue);
                    }
                }
                MessageLatencyTestgrd.DataSource = ExchangeSettingsDataTable;
                MessageLatencyTestgrd.DataBind();
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }