예제 #1
0
파일: PrivilegeDac.cs 프로젝트: ue96/ue96
        public int Insert(PrivilegeInfo oParam)
        {
            string sql = @"INSERT INTO Sys_Privilege
                            (
                            SysNo, PrivilegeID, PrivilegeName, Status
                            )
                            VALUES (
                            @SysNo, @PrivilegeID, @PrivilegeName, @Status
                            )";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
            SqlParameter paramPrivilegeID = new SqlParameter("@PrivilegeID", SqlDbType.NVarChar,20);
            SqlParameter paramPrivilegeName = new SqlParameter("@PrivilegeName", SqlDbType.NVarChar,50);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int,4);

            if ( oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if ( oParam.PrivilegeID != AppConst.StringNull)
                paramPrivilegeID.Value = oParam.PrivilegeID;
            else
                paramPrivilegeID.Value = System.DBNull.Value;
            if ( oParam.PrivilegeName != AppConst.StringNull)
                paramPrivilegeName.Value = oParam.PrivilegeName;
            else
                paramPrivilegeName.Value = System.DBNull.Value;
            if ( oParam.Status != AppConst.IntNull)
                paramStatus.Value = oParam.Status;
            else
                paramStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramPrivilegeID);
            cmd.Parameters.Add(paramPrivilegeName);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
예제 #2
0
        public int CompareTo(object obj)
        {
            PrivilegeInfo o = obj as PrivilegeInfo;

            return(String.Compare(this.PrivilegeID, o.PrivilegeID));
        }
예제 #3
0
파일: SysManager.cs 프로젝트: ue96/ue96
        public void ImportPrivilege()
        {
            if ( !AppConfig.IsImportable)
                throw new BizException("Is Importable is false");

            string sql = " select top 1 * from Sys_Privilege ";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if ( Util.HasMoreRow(ds) )
                throw new BizException("the table Sys_Privilege is not empty");

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                SortedList sl = AppEnum.GetPrivilege();
                foreach(int privilegeSysNo in sl.Keys)
                {
                    PrivilegeInfo item = new PrivilegeInfo();
                    item.SysNo = privilegeSysNo;
                    item.PrivilegeID = privilegeSysNo.ToString();
                    item.PrivilegeName = AppEnum.GetPrivilege(privilegeSysNo);
                    item.Status = (int)AppEnum.BiStatus.Valid;
                    new PrivilegeDac().Insert(item);
                }

                scope.Complete();
            }
        }
예제 #4
0
파일: SysManager.cs 프로젝트: ue96/ue96
 public Hashtable GetUserHt(Hashtable paramHash)
 {
     DataSet ds = GetUserDs(paramHash);
     if (!Util.HasMoreRow(ds))
         return null;
     Hashtable ht = new Hashtable(20);
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         PrivilegeInfo item = new PrivilegeInfo();
         map(item, dr);
         ht.Add(item, null);
     }
     return ht;
 }
예제 #5
0
파일: SysManager.cs 프로젝트: ue96/ue96
 public Hashtable GetPrivilegeHtByUser(int paramUserSysNo)
 {
     string sql = @"select distinct c.* from
                     sys_user as a, sys_role as b, sys_privilege as c,
                     sys_user_role as ab, sys_role_privilege as bc
                     where
                     a.sysno = ab.usersysno and b.sysno = ab.rolesysno and
                     b.sysno = bc.rolesysno and c.sysno = bc.privilegesysno ";
     sql = sql + " and a.sysno=" + paramUserSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if ( !Util.HasMoreRow(ds))
         return null;
     Hashtable ht = new Hashtable(10);
     foreach(DataRow dr in ds.Tables[0].Rows)
     {
         PrivilegeInfo item = new PrivilegeInfo();
         map(item, dr);
         ht.Add(item.SysNo, item);
     }
     return ht;
 }
예제 #6
0
파일: SysManager.cs 프로젝트: ue96/ue96
 /// <summary>
 /// ��ȡָ��������ӵ�е�Ȩ��
 /// </summary>
 /// <param name="paramHash"></param>
 /// <returns></returns>
 public Hashtable GetPrivilegeHtbyDept(int paramSysNo)
 {
     DataSet ds = GetPrivilegeDsbyDept(paramSysNo);
     if (!Util.HasMoreRow(ds))
         return null;
     Hashtable ht = new Hashtable(20);
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         PrivilegeInfo item = new PrivilegeInfo();
         map(item, dr);
         ht.Add(item, null);
     }
     return ht;
 }
예제 #7
0
파일: SysManager.cs 프로젝트: ue96/ue96
 /// <summary>
 /// Map PrivilegeInfo
 /// </summary>
 /// <param name="oParam"></param>
 /// <param name="tempdr"></param>
 private void map(PrivilegeInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.PrivilegeID = Util.TrimNull(tempdr["PrivilegeID"]);
     oParam.PrivilegeName = Util.TrimNull(tempdr["PrivilegeName"]);
     oParam.Status = Util.TrimIntNull(tempdr["Status"]);
 }