Пример #1
0
 /// <summary>
 /// 新增/删除/修改 sys_Roles
 /// </summary>
 /// <param name="fam">sys_RolesTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_RolesInsertUpdate(sys_RolesTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_RolesInsertUpdateDelete", 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("@RoleID", SqlDbType.Int).Value = fam.RoleID;  //角色ID自动ID
         cmd.Parameters.Add("@R_UserID", SqlDbType.Int).Value = fam.R_UserID;  //角角所属用户ID
         cmd.Parameters.Add("@R_RoleName", SqlDbType.NVarChar).Value = fam.R_RoleName;  //角色名称
         cmd.Parameters.Add("@R_Description", SqlDbType.NVarChar).Value = fam.R_Description;  //角色介绍
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
Пример #2
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;
        }
Пример #3
0
 /// <summary>
 /// 新增/删除/修改 sys_Roles
 /// </summary>
 /// <param name="fam">sys_RolesTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_RolesInsertUpdate(sys_RolesTable fam);
Пример #4
0
        /// <summary>
        /// 将记录集转为sys_RolesTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_RolesTable</returns>
        protected object Populatesys_Roles(IDataReader dr)
        {
            sys_RolesTable nc = new sys_RolesTable();

            if (!Convert.IsDBNull(dr["RoleID"])) nc.RoleID = Convert.ToInt32(dr["RoleID"]); // 角色ID自动ID
            if (!Convert.IsDBNull(dr["R_UserID"])) nc.R_UserID = Convert.ToInt32(dr["R_UserID"]); // 角角所属用户ID
            if (!Convert.IsDBNull(dr["R_RoleName"])) nc.R_RoleName = Convert.ToString(dr["R_RoleName"]).Trim(); // 角色名称
            if (!Convert.IsDBNull(dr["R_Description"])) nc.R_Description = Convert.ToString(dr["R_Description"]).Trim(); // 角色介绍
            return nc;
        }
Пример #5
0
 /// <summary>
 /// 根据ID返回 sys_RolesTable实体类 单笔资料
 /// </summary>
 /// <param name="RoleID">角色ID自动ID</param>
 /// <returns>返回sys_RolesTable实体类 RoleID为0则无记录</returns>
 public static sys_RolesTable sys_RolesDisp(int RoleID)
 {
     sys_RolesTable fam = new sys_RolesTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = " Where sys_Roles.RoleID = " + RoleID;
     int RecordCount = 0;
     ArrayList lst = sys_RolesList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_RolesTable)lst[0];
     }
     return fam;
 }
Пример #6
0
 /// <summary>
 /// 新增/删除/修改 sys_Roles
 /// </summary>
 /// <param name="fam">sys_RolesTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_RolesInsertUpdate(sys_RolesTable fam)
 {
     return DataProvider.Instance().sys_RolesInsertUpdate(fam);
 }