Beispiel #1
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     FrameWorkPermission.CheckPermissionVoid(PopedomType.New);
     sys_RoleApplicationTable rt = new sys_RoleApplicationTable();
     rt.DB_Option_Action_ = "Insert";
     rt.A_ApplicationID = (int)Common.sink(NewAppID.UniqueID, MethodType.Post, 255, 1, DataType.Int);
     rt.A_RoleID = RoleID;
     BusinessFacade.sys_RoleApplicationInsertUpdate(rt);
     EventMessage.MessageBox(1, "操作成功", string.Format("增加角色应用ID({0})成功!", rt.A_ApplicationID), Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("RoleManager.aspx?RoleID={0}&CMD=Look",RoleID)));
 }
Beispiel #2
0
 /// <summary>
 /// 新增/删除/修改 sys_RoleApplication
 /// </summary>
 /// <param name="fam">sys_RoleApplicationTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_RoleApplicationInsertUpdate(sys_RoleApplicationTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_RoleApplicationInsertUpdateDelete", 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("@A_RoleID", SqlDbType.Int).Value = fam.A_RoleID;  //角色ID与sys_Roles中RoleID相关
         cmd.Parameters.Add("@A_ApplicationID", SqlDbType.Int).Value = fam.A_ApplicationID;  //应用ID与sys_Applications中Appl
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
Beispiel #3
0
        /// <summary>
        /// 绑定按钮
        /// </summary>
        private void BindButton()
        {
            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    HiddenDisp();
                    TopTr.Visible = false;
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    HiddenDisp();
                    HeadMenuButtonItem Bm0 = new HeadMenuButtonItem();
                    Bm0.ButtonPopedom = PopedomType.List;
                    Bm0.ButtonUrl = string.Format("?CMD=Look&RoleID={0}", RoleID);
                    Bm0.ButtonIcon = "back.gif";
                    Bm0.ButtonName = "返回";
                    HeadMenuWebControls1.ButtonList.Add(Bm0);
                    HeadMenuButtonItem Bm1 = new HeadMenuButtonItem();
                    Bm1.ButtonPopedom = PopedomType.Delete;
                    Bm1.ButtonUrlType = UrlType.JavaScript;
                    Bm1.ButtonUrl = string.Format("DelData('?CMD=Delete&RoleID={0}')", RoleID);
                    HeadMenuWebControls1.ButtonList.Add(Bm1);
                    break;
                case "Look":
                    HiddenInput();
                    HeadMenuButtonItem Bm2 = new HeadMenuButtonItem();
                    Bm2.ButtonPopedom = PopedomType.Edit;
                    Bm2.ButtonUrl = string.Format("?CMD=Edit&RoleID={0}", RoleID);
                    HeadMenuWebControls1.ButtonList.Add(Bm2);
                    break;
                case "Delete":
                    CMD_Txt = "删除";
                    sys_RolesTable sat = new sys_RolesTable();
                    sat.RoleID = RoleID;
                    sat.DB_Option_Action_ = CMD;
                    BusinessFacade.sys_RolesInsertUpdate(sat);
                    BusinessFacade.sys_RoleApplication_Move(RoleID);
                    BusinessFacade.sys_RolePermission_Move(RoleID);
                    UserData.Move_RoleUserPermissionCache(RoleID);                  

                    EventMessage.MessageBox(1, "操作成功", "删除记录ID:(" + RoleID + ")成功!", Icon_Type.OK, Common.GetHomeBaseUrl("RoleList.aspx"));
                    break;
                case "Move":
                    sys_RoleApplicationTable rt = new sys_RoleApplicationTable();
                    rt.A_ApplicationID = (int)Common.sink("ApplicationID", MethodType.Get, 255, 1, DataType.Int);
                    rt.A_RoleID = RoleID;
                    rt.DB_Option_Action_ = "Delete";
                    BusinessFacade.sys_RoleApplicationInsertUpdate(rt);

                    BusinessFacade.sys_RolePermission_Move(rt.A_RoleID, rt.A_ApplicationID);
                    UserData.Move_RoleUserPermissionCache(RoleID);
                    EventMessage.MessageBox(1, "操作成功", "移除应用ID:(" + rt.A_ApplicationID + ")成功!", Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("RoleManager.aspx?RoleID={0}&CMD=Look", RoleID)));
                    break;
                case "MoveUser":
                    //检测删除权限
                    FrameWorkPermission.CheckPermissionVoid(PopedomType.Delete);
                    int UserID = (int)Common.sink("UserID", MethodType.Get, 255, 1, DataType.Int);
                    UserData.Move_UserPermissionCache(UserID);
                    sys_UserRolesTable su = new sys_UserRolesTable();
                    su.DB_Option_Action_ = "Delete";
                    su.R_RoleID = RoleID;
                    su.R_UserID = UserID;
                    BusinessFacade.sys_UserRolesInsertUpdate(su);
                    EventMessage.MessageBox(1, "操作成功", string.Format("从角色ID:{0}中移除用户ID:{1}成功!",RoleID,UserID), Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("RoleManager.aspx?RoleID={0}&CMD=Look", RoleID)));
                    break;
                    
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            HeadMenuWebControls1.HeadOPTxt = TabOptionItem1.Tab_Name = All_Title_Txt;
        }
Beispiel #4
0
        /// <summary>
        /// 将记录集转为sys_RoleApplicationTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_RoleApplicationTable</returns>
        protected object Populatesys_RoleApplication(IDataReader dr)
        {
            sys_RoleApplicationTable nc = new sys_RoleApplicationTable();

            if (!Convert.IsDBNull(dr["A_RoleID"])) nc.A_RoleID = Convert.ToInt32(dr["A_RoleID"]); // 角色ID与sys_Roles中RoleID相关
            if (!Convert.IsDBNull(dr["A_ApplicationID"])) nc.A_ApplicationID = Convert.ToInt32(dr["A_ApplicationID"]); // 应用ID与sys_Applications中Appl
            return nc;
        }
Beispiel #5
0
 /// <summary>
 /// 新增/删除/修改 sys_RoleApplication
 /// </summary>
 /// <param name="fam">sys_RoleApplicationTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_RoleApplicationInsertUpdate(sys_RoleApplicationTable fam);
Beispiel #6
0
        /// <summary>
        /// 根据ID返回 sys_RoleApplicationTable实体类 单笔资料
        /// </summary>
        /// <param name="A_RoleID"></param>
        /// <param name="A_ApplicationID"></param>
        /// <returns>返回sys_RoleApplicationTable实体类 为0则无记录</returns>

        public static sys_RoleApplicationTable sys_RoleApplicationDisp(int A_RoleID, int A_ApplicationID)
        {
            sys_RoleApplicationTable fam = new sys_RoleApplicationTable();
            QueryParam qp = new QueryParam();
            qp.PageIndex = 1;
            qp.PageSize = 1;
            qp.Where = " Where sys_RoleApplication.A_RoleID = " + A_RoleID.ToString() + " sys_RoleApplication.A_ApplicationID=" + A_ApplicationID.ToString();
            int RecordCount = 0;
            ArrayList lst = sys_RoleApplicationList(qp, out RecordCount);
            if (RecordCount > 0)
            {
                fam = (sys_RoleApplicationTable)lst[0];
            }
            return fam;
        }
Beispiel #7
0
 /// <summary>
 /// 新增/删除/修改 sys_RoleApplication
 /// </summary>
 /// <param name="fam">sys_RoleApplicationTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_RoleApplicationInsertUpdate(sys_RoleApplicationTable fam)
 {
     return DataProvider.Instance().sys_RoleApplicationInsertUpdate(fam);
 }