示例#1
0
        private static UsersInRoles GetItemFromReader(IDataReader dataReader)
        {
            UsersInRoles objItem = new UsersInRoles();

            objItem.CompanyID = SqlHelper.GetInt(dataReader, "CompanyID");

            objItem.Username = SqlHelper.GetString(dataReader, "Username");

            objItem.Rolename = SqlHelper.GetString(dataReader, "Rolename");

            objItem.ApplicationName = SqlHelper.GetString(dataReader, "ApplicationName");

            objItem.CreatedUser = SqlHelper.GetString(dataReader, "CreatedUser");

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.UpdateUser = SqlHelper.GetString(dataReader, "UpdateUser");

            objItem.UpdateDate = SqlHelper.GetDateTime(dataReader, "UpdateDate");

            objItem.Descr      = SqlHelper.GetString(dataReader, "Descr");
            objItem.IsSelected = SqlHelper.GetBoolean(dataReader, "IsSelected");

            return(objItem);
        }
示例#2
0
        public static UsersInRoles UpdateItem(UsersInRoles model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "UsersInRoles_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(result, model.CompanyID));
        }
示例#3
0
        public static UsersInRoles AddItem(UsersInRoles model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "UsersInRoles_Add", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(model);
        }
示例#4
0
 private static SqlParameter[] CreateSqlParameter(UsersInRoles model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@CompanyID", model.CompanyID),
         new SqlParameter("@Username", model.Username),
         new SqlParameter("@Rolename", model.Rolename),
         new SqlParameter("@ApplicationName", model.ApplicationName),
         new SqlParameter("@CreatedUser", model.CreatedUser),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@UpdateUser", model.UpdateUser),
         new SqlParameter("@UpdateDate", model.UpdateDate),
     });
 }
示例#5
0
        public static UsersInRolesCollection Search(SearchFilter SearchKey)
        {
            UsersInRolesCollection collection = new UsersInRolesCollection();

            using (var reader = SqlHelper.ExecuteReader("UsersInRoles_Search", SearchFilterManager.SqlSearchParam(SearchKey)))
            {
                while (reader.Read())
                {
                    UsersInRoles obj = new UsersInRoles();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
示例#6
0
        public static UsersInRoles GetItemByID(String Username, int CompanyID)
        {
            UsersInRoles item      = new UsersInRoles();
            var          sqlParams = new SqlParameter[2];

            sqlParams[0] = new SqlParameter("@Username", Username);
            sqlParams[1] = new SqlParameter("@Username", CompanyID);
            using (var reader = SqlHelper.ExecuteReader("UsersInRoles_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
示例#7
0
        public static UsersInRolesCollection GetAllItem(int CompanyID)
        {
            UsersInRolesCollection collection = new UsersInRolesCollection();
            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("UsersInRoles_GetAll", sqlParams))
            {
                while (reader.Read())
                {
                    UsersInRoles obj = new UsersInRoles();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }