Ejemplo n.º 1
0
        private static List <Stables> EntityList(string q)
        {
            List <Stables> list = new List <Stables>();

            using (IDataReader redr = new SQLITE_DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Stables obj = new Stables()
                    {
                        Stables_id    = redr[STABLES.STABLES_ID].ToString(),
                        Stables_name  = redr[STABLES.STABLES_NAME].ToString(),
                        Alias         = redr[STABLES.ALIAS].ToString(),
                        Namespaces_id = redr[NAMESPACES.NAMESPACES_NAME].ToString(),
                        Databases_id  = redr[DATABASES.DATABASES_NAME].ToString(),
                        Active_id     = redr[STABLES.ACTIVE_ID].ToString(),
                    };

                    list.Add(obj);
                }

                redr.Close();
            }
            return(list);
        }
Ejemplo n.º 2
0
        private static Stables GetSTables(int stable_id)
        {
            string q = "SELECT " + STABLES.STABLES_TBL + ".* \r\n";

            q += ", " + NAMESPACES.NAMESPACES_TBL + "." + NAMESPACES.NAMESPACES_NAME + " \r\n";
            q += ", " + DATABASES.DATABASES_TBL + "." + DATABASES.DATABASES_NAME + " \r\n";
            q += " FROM " + STABLES.STABLES_TBL + " \r\n";

            q += " INNER JOIN  " + NAMESPACES.NAMESPACES_TBL + "\r\n";
            q += " ON(" + NAMESPACES.NAMESPACES_TBL + "." + NAMESPACES.NAMESPACES_ID + " = " + STABLES.STABLES_TBL + "." + STABLES.NAMESPACES_ID + " )\r\n";

            q += " INNER JOIN  " + DATABASES.DATABASES_TBL + "\r\n";
            q += " ON(" + DATABASES.DATABASES_TBL + "." + DATABASES.DATABASES_ID + " = " + STABLES.STABLES_TBL + "." + STABLES.DATABASES_ID + " )\r\n";

            q += " WHERE  " + STABLES.STABLES_ID + " =" + stable_id;

            using (IDataReader redr = new SQLITE_DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    Stables obj = new Stables()
                    {
                        Stables_id    = redr[STABLES.STABLES_ID].ToString(),
                        Stables_name  = redr[STABLES.STABLES_NAME].ToString(),
                        Alias         = redr[STABLES.ALIAS].ToString(),
                        Namespaces_id = redr[NAMESPACES.NAMESPACES_NAME].ToString(),
                        Databases_id  = redr[DATABASES.DATABASES_NAME].ToString()
                    };
                    return(obj);
                }
                return(new Stables());
            }
        }
Ejemplo n.º 3
0
        public static string GetId_Name(string _pName)
        {
            Stables obj = SearchName(_pName, new SQLITE_DAL());

            if (obj != null)
            {
                return(obj.Stables_id);
            }
            return("");
        }
Ejemplo n.º 4
0
        public static string GetName_Id(string _pId)
        {
            Stables obj = PKId(_pId, new SQLITE_DAL());

            if (obj != null)
            {
                return(obj.Stables_name);
            }
            return("");
        }
Ejemplo n.º 5
0
 private void LoadData(Stables obj)
 {
     vId = obj.Stables_id;
     txt_databases_id.Text  = obj.Databases_id;
     txt_tables_name.Text   = obj.Stables_name;
     txt_tables_alias.Text  = obj.Alias;
     txt_namespaces_id.Text = obj.Namespaces_id;
     Core.Stative           = obj.Active_id;
     Setactives();
 }
Ejemplo n.º 6
0
 private static string AttachParams(string q, Stables v)
 {
     q = q.Replace("@" + STABLES.STABLES_ID + "@", "" + ConvertTO.SqlString(v.Stables_id) + "");
     q = q.Replace("@" + STABLES.STABLES_NAME + "@", "" + ConvertTO.SqlString(v.Stables_name) + "");
     q = q.Replace("@" + STABLES.ALIAS + "@", "" + ConvertTO.SqlString(v.Alias) + "");
     q = q.Replace("@" + STABLES.NAMESPACES_ID + "@", "" + ConvertTO.SqlString(v.Namespaces_id) + "");
     q = q.Replace("@" + STABLES.DATABASES_ID + "@", "" + ConvertTO.SqlString(v.Databases_id) + "");
     q = q.Replace("@" + STABLES.ACTIVE_ID + "@", "" + ConvertTO.SqlString(v.Active_id) + "");
     return(q);
 }
Ejemplo n.º 7
0
        public void SetAction(BtnEvent pAction, string pPkValue)
        {
            fAction = pAction;

            switch (fAction)
            {
            case BtnEvent.Open:
                btn_save.Text = "CLOSE";
                obj           = CStables_exten.PKId(pPkValue, new SQLITE_DAL());
                itemstbl      = CSFields_exten.FKId(pPkValue, new SQLITE_DAL());
                itemssub      = CSFieldsitems_exten.FKId(pPkValue, new SQLITE_DAL());
                this.EnableControls(false);
                break;

            case BtnEvent.New:
                btn_save.Text       = "SAVE";
                obj                 = CStables.GetNew;
                itemstbl            = CSFields.GetNew;
                itemssub            = CSFieldsitem.GetNew;
                editgrid.RowCount   = 0;
                editgrid_2.RowCount = 0;
                this.EnableControls(true);
                break;

            case BtnEvent.Edit:
                btn_save.Text = "UPDATE";
                obj           = CStables_exten.PKId(pPkValue, new SQLITE_DAL());
                itemstbl      = CSFields_exten.FKId(pPkValue, new SQLITE_DAL());
                itemssub      = CSFieldsitems_exten.FKId(pPkValue, new SQLITE_DAL());
                this.EnableControls(true);
                break;

            case BtnEvent.Delete:
                btn_save.Text = "CONFIRM\r\nDELETE";
                obj           = CStables_exten.PKId(pPkValue, new SQLITE_DAL());
                itemstbl      = CSFields_exten.FKId(pPkValue, new SQLITE_DAL());
                itemssub      = CSFieldsitems_exten.FKId(pPkValue, new SQLITE_DAL());
                this.EnableControls(false);
                break;

            case BtnEvent.Print:
                btn_save.Text = "PRINT";
                obj           = CStables_exten.PKId(pPkValue, new SQLITE_DAL());
                itemstbl      = CSFields_exten.FKId(pPkValue, new SQLITE_DAL());
                itemssub      = CSFieldsitems_exten.FKId(pPkValue, new SQLITE_DAL());
                this.EnableControls(false);
                break;
            }

            this.LoadData(obj);
            this.Loaditems(itemstbl);
            this.Loaditems_2(itemssub);
        }
Ejemplo n.º 8
0
        public static void Update(Stables v, SQLITE_DAL dalsession)
        {
            string q = "UPDATE " + STABLES.STABLES_TBL + " SET";

            q += " " + STABLES.STABLES_NAME + " = @" + STABLES.STABLES_NAME + "@ \r\n ";
            q += "," + STABLES.ALIAS + " = @" + STABLES.ALIAS + "@ \r\n ";
            q += "," + STABLES.NAMESPACES_ID + " = @" + STABLES.NAMESPACES_ID + "@ \r\n ";
            q += "," + STABLES.DATABASES_ID + " = @" + STABLES.DATABASES_ID + "@ \r\n ";
            q += "," + STABLES.ACTIVE_ID + " = @" + STABLES.ACTIVE_ID + "@ \r\n ";
            q += "  WHERE " + STABLES.STABLES_ID + " = @" + STABLES.STABLES_ID + "@ ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }
Ejemplo n.º 9
0
        private Stables CollectData()
        {
            Stables fobj = new Stables()
            {
                Stables_id    = vId,
                Databases_id  = CDatabases_exten.GetId_Name(txt_databases_id.Text.Trim()),
                Stables_name  = txt_tables_name.Text.ToUpper().Trim(),
                Alias         = txt_tables_alias.Text.ToUpper().Trim(),
                Namespaces_id = CNamespaces_exten.GetId_Name(txt_namespaces_id.Text.Trim()),
                Active_id     = Core.Stative,
            };

            return(fobj);
        }
Ejemplo n.º 10
0
        public static void Insert(Stables v, SQLITE_DAL dalsession)
        {
            string q = " INSERT INTO " + STABLES.STABLES_TBL + " ( ";

            q += " " + STABLES.STABLES_NAME + " \r\n ";
            q += "," + STABLES.ALIAS + " \r\n ";
            q += "," + STABLES.NAMESPACES_ID + " \r\n ";
            q += "," + STABLES.DATABASES_ID + " \r\n ";
            q += "," + STABLES.ACTIVE_ID + " \r\n ";
            q += " ) VALUES ( ";
            q += "  @" + STABLES.STABLES_NAME + "@ \r\n ";
            q += ", @" + STABLES.ALIAS + "@ \r\n ";
            q += ", @" + STABLES.NAMESPACES_ID + "@ \r\n ";
            q += ", @" + STABLES.DATABASES_ID + "@ \r\n ";
            q += ", @" + STABLES.ACTIVE_ID + "@ \r\n ";
            q += " ) \r\n ";
            q  = AttachParams(q, v);
            dalsession.Execute(q);
        }