public List<databasestype> databasestypeGetAll()
 {
     List<databasestype> lstdatabasestype = new List<databasestype>();
     try
     {
         DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "databasestypeGetAll").Tables[0];
         if (dt.Rows.Count > 0)
         {
             int colDatabaseTypeId =  dt.Columns["DatabaseTypeId"].Ordinal;
             int colDatabaseName =  dt.Columns["DatabaseName"].Ordinal;
             for (int i = 0; dt.Rows.Count > i; i++)
             {
                 databasestype NewEnt = new databasestype();
                 NewEnt.DatabaseTypeId = Int32.Parse(dt.Rows[i].ItemArray[colDatabaseTypeId].ToString());
                 NewEnt.DatabaseName = dt.Rows[i].ItemArray[colDatabaseName].ToString();
                 lstdatabasestype.Add(NewEnt);
             }
         }
         return lstdatabasestype;
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
 public int databasestypeAdd(databasestype databasestype)
 {
     try
     {
         return (int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "databasestypeAdd",
                                                                                   databasestype.DatabaseName);
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
        public databasestype databasestypeGetById(int DatabaseTypeId)
        {
            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "databasestypeGetById",
                                                                                               DatabaseTypeId).Tables[0];
                databasestype NewEnt = new databasestype();

                if(dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    NewEnt.DatabaseTypeId = Int32.Parse(dr["DatabaseTypeId"].ToString());
                    NewEnt.DatabaseName = dr["DatabaseName"].ToString();
                }
                return NewEnt;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
 public bool databasestypeUpdate(databasestype databasestype)
 {
     databasestypeImpl odatabasestypeImpl = new databasestypeImpl();
     return odatabasestypeImpl.databasestypeUpdate( databasestype);
 }
 public int databasestypeAdd(databasestype databasestype)
 {
     databasestypeImpl odatabasestypeImpl = new databasestypeImpl();
     return odatabasestypeImpl.databasestypeAdd( databasestype);
 }
Esempio n. 6
0
        protected void getIDPSData()
        {
            DataTable dttIDPS = new DataTable();
            dttIDPS.Columns.Add(new DataColumn("idsId"           , System.Type.GetType("System.Int32")));
            dttIDPS.Columns.Add(new DataColumn("idsName"         , System.Type.GetType("System.String")));
            dttIDPS.Columns.Add(new DataColumn("idsversion"      , System.Type.GetType("System.String")));
            dttIDPS.Columns.Add(new DataColumn("idsTypeId"       , System.Type.GetType("System.Int32")));
            dttIDPS.Columns.Add(new DataColumn("idsTypeDesc"     , System.Type.GetType("System.String")));
            dttIDPS.Columns.Add(new DataColumn("databaseTypeId"  , System.Type.GetType("System.Int32")));
            dttIDPS.Columns.Add(new DataColumn("databaseTypeDesc", System.Type.GetType("System.String")));
            dttIDPS.Columns.Add(new DataColumn("idsIP"           , System.Type.GetType("System.String")));
            dttIDPS.Columns.Add(new DataColumn("active"          , System.Type.GetType("System.Boolean")));

            List<ids> lstIDPS = new List<ids>();
            idsBus oIDPS = new idsBus();

            idstype auxIDPSType = new idstype();
            idstypeBus oIDPSType = new idstypeBus();

            databasestype auxDatabaseType = new databasestype();
            databasestypeBus oDatabaseType = new databasestypeBus();

            lstIDPS = oIDPS.idsGetAll();

            if (lstIDPS.Count > 0)
            {
                foreach (ids row in lstIDPS)
                {
                    auxIDPSType = oIDPSType.idstypeGetById(row.IdsTypeId);
                    auxDatabaseType = oDatabaseType.databasestypeGetById(row.DatabaseTypeId);

                    dttIDPS.Rows.Add( row.IdsId,
                                      row.idsName,
                                      row.IdsVersion,
                                      row.IdsTypeId,
                                      auxIDPSType.IdsTypeName,
                                      row.DatabaseTypeId,
                                      auxDatabaseType.DatabaseName,
                                      row.IdsIP,
                                      row.Active);
                }

                gvIDPS.DataSource = dttIDPS;
                gvIDPS.DataBind();
            }
        }
 public bool databasestypeUpdate(databasestype databasestype)
 {
     try
     {
         int update = SqlHelper.ExecuteNonQuery(SqlImplHelper.getConnectionString(), "databasestypeUpdate",
                                                                                     databasestype.DatabaseTypeId,
                                                                                     databasestype.DatabaseName);
         if (update > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }