Beispiel #1
0
    public override void SetDatasource()
    {
        var resultado = ClsPanelDeControl.ExecuteGenericquery(Datasource);

        Datareader = resultado.ObjetoTransaccion as IDataReader;
        if (Datareader != null)
        {
            while (Datareader.Read())
            {
                if (!String.IsNullOrEmpty(Datareader["value"].ToString()))
                {
                    Value = Datareader["value"].ToString();
                }
            }
            var gc = Control as GaugeControl;
            if (gc != null)
            {
                var foo = gc.Gauges[0] as DevExpress.XtraGauges.Win.Gauges.Digital.DigitalGauge;
                if (foo != null)
                {
                    foo.Text       = Value;
                    foo.DigitCount = foo.Text.Length;
                }
            }
        }
    }
Beispiel #2
0
    public override void SetDatasource()
    {
        var cantidad = 0;
        var color    = String.Empty;

        _labelNumero.Text = 24.ToString();

        var resultado = ClsPanelDeControl.ExecuteGenericquery(Datasource);

        Datareader = resultado.ObjetoTransaccion as IDataReader;
        if (Datareader != null)
        {
            while (Datareader.Read())
            {
                if (!String.IsNullOrEmpty(Datareader["cantidad"].ToString()))
                {
                    cantidad = Convert.ToInt16(Datareader["cantidad"].ToString());
                }
                color = Datareader["color"].ToString();
            }
            var gc = Control as GaugeControl;
            if (gc != null)
            {
                var foo = gc.Gauges[0] as StateIndicatorGauge;
                if (foo != null)
                {
                    foo.BeginUpdate();
                    switch (color.Trim().ToUpper())
                    {
                    case "RED":
                        foo.Indicators[0].StateIndex = 1;
                        break;

                    case "ORANGE":
                        foo.Indicators[0].StateIndex = 2;
                        break;

                    case "GREEN":
                        foo.Indicators[0].StateIndex = 3;
                        break;

                    default:
                        foo.Indicators[0].StateIndex = 0;
                        break;
                    }
                    _labelNumero.Text = String.Format("<b>{0}</b>", cantidad);
                    foo.EndUpdate();
                }
            }
        }
    }
Beispiel #3
0
        /// <summary>
        /// Returns list of all tables in a databases
        /// marks them as cdc enabled or not.
        /// </summary>
        /// <returns></returns>
        public List <Tables> fn_GetTables(List <string> Dblist)
        {
            List <Tables> _listtables = new List <Tables>();
            SqlConnection _Sqlcon     = new SqlConnection();
            SqlDataReader Datareader;

            _Sqlcon = fn_ConnecttoSQL();
            try
            {
                if (_Sqlcon.State.ToString() == "Closed")
                {
                    _Sqlcon.Open();
                }

                foreach (string db in Dblist)
                {
                    _Sqlcon.ChangeDatabase(db);
                    string Qrygettables = "Select '" + db + "',[schemaname]=ss.name,st.name,is_tracked_by_cdc from sys.Tables st  " +
                                          "join sys.schemas ss on st.schema_id=ss.schema_id order by name";
                    SqlCommand SQLGetDatabases = new SqlCommand(Qrygettables, _Sqlcon);

                    Datareader = SQLGetDatabases.ExecuteReader();
                    while (Datareader.Read())
                    {
                        Tables _tb = new Tables();
                        _tb.Databasename      = Datareader[0].ToString();
                        _tb.schema            = Datareader[1].ToString();
                        _tb.name              = Datareader[2].ToString();
                        _tb.is_tracked_by_cdc = Datareader[3].ToString();
                        _listtables.Add(_tb);
                    }
                    Datareader.Close();
                }

                return(_listtables);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                _Sqlcon.Close();
            }
        }
Beispiel #4
0
        public List <string> fn_CaptureInstance(List <CDC> cdclist)
        {
            List <string> lst     = new List <string>();
            SqlConnection _Sqlcon = new SqlConnection();
            SqlDataReader Datareader;

            _Sqlcon = fn_ConnecttoSQL();
            try
            {
                if (_Sqlcon.State.ToString() == "Closed")
                {
                    _Sqlcon.Open();
                }

                foreach (CDC cdcobj in cdclist)
                {
                    _Sqlcon.ChangeDatabase(cdcobj.Databasename);
                    string     Qry    = "Select capture_instance from cdc.change_tables where source_object_id=object_id('" + cdcobj.source_schema + "." + cdcobj.source_name + "')";
                    SqlCommand sqlcmd = new SqlCommand(Qry, _Sqlcon);
                    Datareader = sqlcmd.ExecuteReader();
                    while (Datareader.Read())
                    {
                        lst.Add(Datareader[0].ToString());
                    }

                    lst.Add(cdcobj.source_schema + "_" + cdcobj.source_name);
                    lst.Add(cdcobj.Databasename);
                }

                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                _Sqlcon.Close();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Connects to sql server
        /// returns true when successfull
        /// </summary>
        /// <returns></returns>

        public List <SQLCDCApp> fn_GetDatabases()
        {
            List <SQLCDCApp> _listdatabases = new List <SQLCDCApp>();
            SqlConnection    _Sqlcon        = new SqlConnection();

            _Sqlcon = fn_ConnecttoSQL();


            try
            {
                if (_Sqlcon.State.ToString() == "Closed")
                {
                    _Sqlcon.Open();
                }

                SqlCommand    SQLGetDatabases = new SqlCommand("Select name,is_cdc_enabled from sys.databases where database_id>4 and state_desc='Online' order by is_cdc_enabled desc ", _Sqlcon);
                SqlDataReader Datareader;
                Datareader = SQLGetDatabases.ExecuteReader();
                while (Datareader.Read())
                {
                    SQLCDCApp obj = new SQLCDCApp();
                    obj.DatabaseName   = Datareader[0].ToString();
                    obj.is_cdc_enabled = Datareader[1].ToString();
                    //obj.state = Datareader[2].ToString();
                    _listdatabases.Add(obj);
                }

                return(_listdatabases);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally{
                _Sqlcon.Close();
            }
        }
Beispiel #6
0
    public override void SetDatasource()
    {
        var resultado = ClsPanelDeControl.ExecuteGenericquery(Datasource);

        Datareader = resultado.ObjetoTransaccion as IDataReader;
        if (Datareader != null)
        {
            while (Datareader.Read())
            {
                if (!String.IsNullOrEmpty(Datareader["min"].ToString()))
                {
                    min = Convert.ToSingle(Datareader["min"]);
                }

                if (!String.IsNullOrEmpty(Datareader["max"].ToString()))
                {
                    max = Convert.ToSingle(Datareader["max"]);
                }

                if (!String.IsNullOrEmpty(Datareader["value"].ToString()))
                {
                    value = Convert.ToSingle(Datareader["value"]);
                }

                if (!String.IsNullOrEmpty(Datareader["overmax"].ToString()))
                {
                    overmax = Convert.ToSingle(Datareader["overmax"]);
                }
            }

            var gc = Control as GaugeControl;
            if (gc != null)
            {
                var foo = gc.Gauges[0] as DevExpress.XtraGauges.Win.Gauges.Linear.LinearGauge;
                if (foo != null)
                {
                    var scale = foo.Scales[0];
                    scale.MinValue = min;
                    scale.MaxValue = max + overmax;
                    scale.Value    = value;
                    var color = Color.Black;
                    if (value >= max)
                    {
                        color = Color.Red;
                    }
                    if (value < max)
                    {
                        color = Color.Orange;
                    }
                    if (value < max / 2)
                    {
                        color = Color.Green;
                    }

                    foo.Levels[0].ShapeType = LevelShapeSetType.Style11;

                    StyleShader shader = new StyleShader();
                    shader.StyleColor1   = color;
                    shader.StyleColor2   = Color.Transparent;
                    foo.Levels[0].Shader = shader;
                }
            }
        }
    }