public void edit(USER_PERMISSION_LIST obj)
 {
     DAL.edit(obj.PermissionID, obj.Category, obj.Permission, obj.Container, obj.Object, obj.ObjectType, obj.Action, obj.Active, obj.SortOrder);
 }
 public void delete(USER_PERMISSION_LIST obj)
 {
     DAL.delete(obj.PermissionID);
 }
Beispiel #3
0
        // dung file get data
        // dung file get list( data source)
        public List <USER_PERMISSION_LIST> getDataSource()
        {
            List <USER_PERMISSION_LIST> list = new List <USER_PERMISSION_LIST>();
            USER_PERMISSION_LIST        obj  = null;
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            String sql = "USE [rbi]" +
                         "SELECT [PermissionID]" +
                         ",[Category]" +
                         ",[Permission]" +
                         ",[Container]" +
                         ",[Object]" +
                         ",[ObjectType]" +
                         ",[Action]" +
                         ",[Active]" +
                         ",[SortOrder]" +
                         "  FROM [rbi].[dbo].[USER_PERMISSION_LIST]";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj = new USER_PERMISSION_LIST();
                            obj.PermissionID = reader.GetInt32(0);
                            obj.Category     = reader.GetString(1);
                            obj.Permission   = reader.GetString(2);
                            if (!reader.IsDBNull(3))
                            {
                                obj.Container = reader.GetString(3);
                            }
                            if (!reader.IsDBNull(4))
                            {
                                obj.Object = reader.GetString(4);
                            }
                            if (!reader.IsDBNull(5))
                            {
                                obj.ObjectType = reader.GetString(5);
                            }
                            if (!reader.IsDBNull(6))
                            {
                                obj.Action = reader.GetString(6);
                            }
                            obj.Active    = reader.GetInt32(7);
                            obj.SortOrder = reader.GetInt32(8);
                            list.Add(obj);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("GET DATA SOURCE FAIL!");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(list);
        }