Пример #1
0
 public List<usergroup> usergroupGetAll()
 {
     List<usergroup> lstusergroup = new List<usergroup>();
     try
     {
         DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "usergroupGetAll").Tables[0];
         if (dt.Rows.Count > 0)
         {
             int colUserGroupId =  dt.Columns["UserGroupId"].Ordinal;
             int colUserGroupDescription =  dt.Columns["UserGroupDescription"].Ordinal;
             for (int i = 0; dt.Rows.Count > i; i++)
             {
                 usergroup NewEnt = new usergroup();
                 NewEnt.UserGroupId = Int32.Parse(dt.Rows[i].ItemArray[colUserGroupId].ToString());
                 NewEnt.UserGroupDescription = dt.Rows[i].ItemArray[colUserGroupDescription].ToString();
                 lstusergroup.Add(NewEnt);
             }
         }
         return lstusergroup;
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public int usergroupAdd( usergroup usergroup)
 {
     try
     {
         return (int)SqlHelper.ExecuteScalar(SqlImplHelper.getConnectionString(), "usergroupAdd",
                                                                                 usergroup.UserGroupDescription);
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public usergroup usergroupGetById(int UserGroupId)
        {
            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlImplHelper.getConnectionString(), "usergroupGetById",
                                                                                                    UserGroupId).Tables[0];
                usergroup NewEnt = new usergroup();

                if(dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    NewEnt.UserGroupId = Int32.Parse(dr["UserGroupId"].ToString());
                    NewEnt.UserGroupDescription = dr["UserGroupDescription"].ToString();
                }
                return NewEnt;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
 public bool usergroupUpdate( usergroup usergroup)
 {
     try
     {
         int update = SqlHelper.ExecuteNonQuery(SqlImplHelper.getConnectionString(), "usergroupUpdate",
                                                                                     usergroup.UserGroupId,
                                                                                     usergroup.UserGroupDescription);
         if (update > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch(Exception ex)
     {
         throw ex;
     }
 }
Пример #5
0
        protected void getUsersData()
        {
            DataTable dttUsers = new DataTable();
            dttUsers.Columns.Add(new DataColumn("userId", System.Type.GetType("System.Int32")));
            dttUsers.Columns.Add(new DataColumn("userName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userLastName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userFirstName", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userGroupId", System.Type.GetType("System.Int32")));
            dttUsers.Columns.Add(new DataColumn("userGroupDescription", System.Type.GetType("System.String")));
            dttUsers.Columns.Add(new DataColumn("userActive", System.Type.GetType("System.Boolean")));

            List<users> lstUsers = new List<users>();
            usersBus oUsers = new usersBus();

            usergroup auxGroup = new usergroup();
            usergroupBus oGroup = new usergroupBus();

            lstUsers = oUsers.usersGetAll();

            if (lstUsers.Count > 0)
            {
                foreach (users row in lstUsers)
                {
                    auxGroup = oGroup.usergroupGetById(row.UserGroupId);

                    dttUsers.Rows.Add(row.UserId,
                                      row.UserName,
                                      row.UserLastName,
                                      row.UserFirstName,
                                      row.UserGroupId,
                                      auxGroup.UserGroupDescription,
                                      row.UserActive);
                }

                gvUsers.DataSource = dttUsers;
                gvUsers.DataBind();
            }
        }
Пример #6
0
 public bool usergroupUpdate(usergroup usergroup)
 {
     usergroupImpl ousergroupImpl = new usergroupImpl();
     return ousergroupImpl.usergroupUpdate( usergroup);
 }
Пример #7
0
 public int usergroupAdd(usergroup usergroup)
 {
     usergroupImpl ousergroupImpl = new usergroupImpl();
     return ousergroupImpl.usergroupAdd( usergroup);
 }