/// <summary>
        /// 将记录集转为sys_ModuleExtPermissionTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_ModuleExtPermissionTable</returns>
        protected object Populatesys_ModuleExtPermission(IDataReader dr)
        {
            sys_ModuleExtPermissionTable nc = new sys_ModuleExtPermissionTable();

            if (!Convert.IsDBNull(dr["ExtPermissionID"])) nc.ExtPermissionID = Convert.ToInt32(dr["ExtPermissionID"]); // 扩展权限ID
            if (!Convert.IsDBNull(dr["ModuleID"])) nc.ModuleID = Convert.ToInt32(dr["ModuleID"]); // 模块ID
            if (!Convert.IsDBNull(dr["PermissionName"])) nc.PermissionName = Convert.ToString(dr["PermissionName"]).Trim(); // 权限名称
            if (!Convert.IsDBNull(dr["PermissionValue"])) nc.PermissionValue = Convert.ToInt32(dr["PermissionValue"]); // 权限值
            return nc;
        }
Exemple #2
0
        /// <summary>
        /// ����/ɾ��/�޸� sys_ModuleExtPermission
        /// </summary>
        /// <param name="fam">sys_ModuleExtPermissionTableʵ����</param>
        /// <returns>����0������</returns>
        public override int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam)
        {
            int rInt = 0;

            using (OracleConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_ModuleExtPermission(ExtPermissionID,ModuleID,PermissionName,PermissionValue)VALUES(SEQ_sys_ModuleExtPermission_ID.NEXTVAL,:ModuleID,:PermissionName,:PermissionValue)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("ModuleID", OracleType.Int32).Value = fam.ModuleID; //ģ��ID
                    cmd.Parameters.Add("PermissionName", OracleType.NVarChar).Value = fam.PermissionName + ""; //Ȩ������
                    cmd.Parameters.Add("PermissionValue", OracleType.Int32).Value = fam.PermissionValue; //Ȩ��ֵ
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_ModuleExtPermission SET	ModuleID = :ModuleID,PermissionName = :PermissionName,PermissionValue = :PermissionValue WHERE (ExtPermissionID = :ExtPermissionID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("ModuleID", OracleType.Int32).Value = fam.ModuleID; //ģ��ID
                    cmd.Parameters.Add("PermissionName", OracleType.NVarChar).Value = fam.PermissionName + ""; //Ȩ������
                    cmd.Parameters.Add("PermissionValue", OracleType.Int32).Value = fam.PermissionValue; //Ȩ��ֵ
                    cmd.Parameters.Add("ExtPermissionID", OracleType.Int32).Value = fam.ExtPermissionID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_ModuleExtPermission  WHERE (ExtPermissionID = :ExtPermissionID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("ExtPermissionID", OracleType.Int32).Value = fam.ExtPermissionID;
                }
                else
                    throw new ApplicationException("�޷�ʶ��IJ�������!");
                Conn.Open();
                OracleTransaction Tran = Conn.BeginTransaction();
                cmd.Transaction = Tran;
                try
                {
                    rInt = cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    if (fam.DB_Option_Action_ == "Insert")
                    {
                        cmd.CommandText = "select SEQ_sys_ModuleExtPermission_ID.CURRVAL from  dual";
                        rInt = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                    Tran.Commit();
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    throw new ApplicationException(ex.ToString());
                }
                finally
                {
                    Tran.Dispose();
                    cmd.Dispose();
                    Conn.Dispose();
                    Conn.Close();
                }
            }
            return rInt;
        }
 /// <summary>
 /// 新增/删除/修改 sys_ModuleExtPermission
 /// </summary>
 /// <param name="fam">sys_ModuleExtPermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam);
 protected void DeleteExtPermissionID(int extPermissionID)
 {
     if (!FrameWorkMenuTree.CheckModuleLastLevel(ModuleID))
         return;
     sys_ModuleExtPermissionTable se = new sys_ModuleExtPermissionTable();
     se.DB_Option_Action_ = "Delete";
     se.ExtPermissionID = extPermissionID;
     BusinessFacade.sys_ModuleExtPermissionInsertUpdate(se);
     sys_ModuleExtPermission_Cache.ReLoadCache();
     EventMessage.MessageBox(1, "操作成功", "删除扩展权限成功!", Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("ModuleManager.aspx?cmd=ExtPermission&S_ID={0}&ModuleID={1}", S_ID, ModuleID)));
 }
        /// <summary>
        /// 新增/删除/修改 sys_ModuleExtPermission
        /// </summary>
        /// <param name="fam">sys_ModuleExtPermissionTable实体类</param>
        /// <returns>返回0操正常</returns>
        public override int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam)
        {
            int rInt = 0;

            using (OleDbConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_ModuleExtPermission(ModuleID,PermissionName,PermissionValue)VALUES(@ModuleID,@PermissionName,@PermissionValue)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@ModuleID", OleDbType.Integer).Value = fam.ModuleID; //模块ID
                    cmd.Parameters.Add("@PermissionName", OleDbType.VarWChar).Value = fam.PermissionName + ""; //权限名称	
                    cmd.Parameters.Add("@PermissionValue", OleDbType.Integer).Value = fam.PermissionValue; //权限值
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_ModuleExtPermission SET	ModuleID = @ModuleID,PermissionName = @PermissionName,PermissionValue = @PermissionValue WHERE (ExtPermissionID = @ExtPermissionID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@ModuleID", OleDbType.Integer).Value = fam.ModuleID; //模块ID
                    cmd.Parameters.Add("@PermissionName", OleDbType.VarWChar).Value = fam.PermissionName + ""; //权限名称	
                    cmd.Parameters.Add("@PermissionValue", OleDbType.Integer).Value = fam.PermissionValue; //权限值
                    cmd.Parameters.Add("@ExtPermissionID", OleDbType.Integer).Value = fam.ExtPermissionID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_ModuleExtPermission  WHERE (ExtPermissionID = @ExtPermissionID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("@ExtPermissionID", OleDbType.Integer).Value = fam.ExtPermissionID;
                }
                else
                    throw new ApplicationException("无法识别的操作命令!");
                Conn.Open();
                rInt = cmd.ExecuteNonQuery();
                if (fam.DB_Option_Action_ == "Insert")
                {
                    cmd.CommandText = "SELECT @@identity";
                    rInt = Convert.ToInt32(cmd.ExecuteScalar());
                }
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return rInt;
        }
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (!FrameWorkMenuTree.CheckModuleLastLevel(ModuleID))
                return;
            string PermissionName_Value = (string)Common.sink(PermissionName.UniqueID, MethodType.Post, 100, 1, DataType.Str);
            sys_ModuleExtPermissionTable st = new sys_ModuleExtPermissionTable();
            st.DB_Option_Action_ = "Insert";
            st.ModuleID = ModuleID;
            st.PermissionName = PermissionName_Value;
            st.PermissionValue = BusinessFacade.sys_ModuleExtPermissionGetLastPermissionValue(ModuleID);
            if (st.PermissionValue == 0)
                EventMessage.MessageBox(1, "操作失败", string.Format("增加自定义权限失败,权限值已经达到最大值,无法再增加!"), Icon_Type.Alert, Common.GetHomeBaseUrl(string.Format("ModuleManager.aspx?cmd=ExtPermission&S_ID={0}&ModuleID={1}", S_ID, ModuleID)));
            int returnint = BusinessFacade.sys_ModuleExtPermissionInsertUpdate(st);

            if (returnint < 0)
            {
                EventMessage.MessageBox(1, "操作失败", string.Format("增加自定义权限失败!"), Icon_Type.Error, Common.GetHomeBaseUrl(string.Format("ModuleManager.aspx?cmd=ExtPermission&S_ID={0}&ModuleID={1}", S_ID, ModuleID)));
            }
            sys_ModuleExtPermission_Cache.ReLoadCache();
            TabOptionWebControls1.SelectIndex = 3;
            BindPermissionList();
        }
Exemple #7
0
 /// <summary>
 /// 新增/删除/修改 sys_ModuleExtPermission
 /// </summary>
 /// <param name="fam">sys_ModuleExtPermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam)
 {
     return DataProvider.Instance().sys_ModuleExtPermissionInsertUpdate(fam);
 }
Exemple #8
0
 /// <summary>
 /// 根据ID返回 sys_ModuleExtPermissionTable实体类 单笔资料
 /// </summary>
 /// <param name="ExtPermissionID">扩展权限ID</param>
 /// <returns>返回sys_ModuleExtPermissionTable实体类 ExtPermissionID为0则无记录</returns>
 public static sys_ModuleExtPermissionTable sys_ModuleExtPermissionDisp(int ExtPermissionID)
 {
     sys_ModuleExtPermissionTable fam = new sys_ModuleExtPermissionTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = " Where sys_ModuleExtPermission.ExtPermissionID = " + ExtPermissionID;
     int RecordCount = 0;
     ArrayList lst = sys_ModuleExtPermissionList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_ModuleExtPermissionTable)lst[0];
     }
     return fam;
 }
 /// <summary>
 /// 新增/删除/修改 sys_ModuleExtPermission
 /// </summary>
 /// <param name="fam">sys_ModuleExtPermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_ModuleExtPermissionInsertUpdate(sys_ModuleExtPermissionTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_ModuleExtPermissionInsertUpdateDelete", Conn);
         cmd.CommandType = CommandType.StoredProcedure;
         //设置参数
         cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录
         cmd.Parameters.Add("@ExtPermissionID", SqlDbType.Int).Value = fam.ExtPermissionID;  //扩展权限ID
         cmd.Parameters.Add("@ModuleID", SqlDbType.Int).Value = fam.ModuleID;  //模块ID
         cmd.Parameters.Add("@PermissionName", SqlDbType.NVarChar).Value = fam.PermissionName;  //权限名称
         cmd.Parameters.Add("@PermissionValue", SqlDbType.Int).Value = fam.PermissionValue;  //权限值
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
 /// <summary>
 /// 设置扩展模块缓存
 /// </summary>
 /// <param name="sm"></param>
 static void set_ModuleExtCache(sys_ModuleExtPermissionTable sm)
 {
     sys_ModuleExtCache.Add(sm.ExtPermissionID, sm);
     if (sys_ModuleExtListCache.ContainsKey(sm.ModuleID))
     {
         sys_ModuleExtListCache[sm.ModuleID].Add(sm);
     }
     else
     {
         List<sys_ModuleExtPermissionTable> lst = new List<sys_ModuleExtPermissionTable>();
         lst.Add(sm);
         sys_ModuleExtListCache.Add(sm.ModuleID, lst);
     }
 }