示例#1
0
        public static bool Delete(RightUserGroup rightUserGroup)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                    conn.Open();

                using (var trans = conn.BeginTransaction())
                {
                    //1、删除用户组
                    var result = Delete(rightUserGroup, conn, trans);
                    if (!result)
                    {
                        trans.Rollback();
                        return false;
                    }
                    //2、删除当前组对应的用户分组信息
                    RightLkUserGroupDal.DeleteByGroupSysid(new RightLkUserGroup { GroupSysid = rightUserGroup.Sysid }, conn, trans);

                    //3、删除当前组对应的权限分配信息
                    RightDal.DeleteByUserGroupSysid(new Right { UserGroupSysid = rightUserGroup.Sysid }, conn, trans);

                    trans.Commit();
                }

                if (conn.State != ConnectionState.Closed)
                    conn.Close();
            }

            return true;
        }
示例#2
0
        //新增数据
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <returns></returns>
        internal override bool Add()
        {
            EditEntity = null;
            pageViewMain.SelectedPage = pageEditData;
            UI.ClearUi(pageEditData);
            UI.ReadOnlyUi(pageEditData, false);

            return true;
        }
示例#3
0
        public static bool Delete(RightUserGroup rightUserGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
DELETE FROM T_RIGHT_USER_GROUP
WHERE SYSID=@Sysid

";

            return(Dapper.Save(rightUserGroup, sql, conn, trans));
        }
示例#4
0
 public static bool InsertRightUserGroup(RightUserGroup rightUserGroup, out string msg)
 {
     if (!RightUserGroupDal.Insert(rightUserGroup))
     {
         msg = "新增失败";
         return false;
     }
     msg = "新增成功";
     return true;
 }
示例#5
0
        public static bool Insert(RightUserGroup rightUserGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
INSERT INTO T_RIGHT_USER_GROUP(SYSID,GROUP_NAME,WORKSHOP,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS)
VALUES(@Sysid,@GroupName,@Workshop,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus)

";

            return(Dapper.Save(rightUserGroup, sql, conn, trans));
        }
示例#6
0
 public static bool UpdateRightUserGroup(RightUserGroup rightUserGroup, out string msg)
 {
     if (!RightUserGroupDal.Update(rightUserGroup))
     {
         msg = "修改失败";
         return false;
     }
     msg = "修改成功";
     return true;
 }
示例#7
0
        public static bool Insert(RightUserGroup rightUserGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            INSERT INTO T_RIGHT_USER_GROUP(SYSID,GROUP_NAME,WORKSHOP,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS)
            VALUES(@Sysid,@GroupName,@Workshop,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus)

            ";

            return Dapper.Save(rightUserGroup, sql, conn, trans);
        }
示例#8
0
        public static bool Delete(RightUserGroup rightUserGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            DELETE FROM T_RIGHT_USER_GROUP
            WHERE SYSID=@Sysid

            ";

            return Dapper.Save(rightUserGroup, sql, conn, trans);
        }
示例#9
0
 public static bool UpdateRightUserGroup(RightUserGroup rightUserGroup, out string msg)
 {
     if (!RightUserGroupDal.Update(rightUserGroup))
     {
         msg = "修改失败";
         return(false);
     }
     msg = "修改成功";
     return(true);
 }
示例#10
0
 public static bool InsertRightUserGroup(RightUserGroup rightUserGroup, out string msg)
 {
     if (!RightUserGroupDal.Insert(rightUserGroup))
     {
         msg = "新增失败";
         return(false);
     }
     msg = "新增成功";
     return(true);
 }
示例#11
0
        public static bool Update(RightUserGroup rightUserGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
UPDATE T_RIGHT_USER_GROUP
SET GROUP_NAME=@GroupName,WORKSHOP=@Workshop,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus
WHERE SYSID=@Sysid

";

            return(Dapper.Save(rightUserGroup, sql, conn, trans));
        }
示例#12
0
        public static bool Delete(RightUserGroup rightUserGroup)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                using (var trans = conn.BeginTransaction())
                {
                    //1、删除用户组
                    var result = Delete(rightUserGroup, conn, trans);
                    if (!result)
                    {
                        trans.Rollback();
                        return(false);
                    }
                    //2、删除当前组对应的用户分组信息
                    RightLkUserGroupDal.DeleteByGroupSysid(new RightLkUserGroup {
                        GroupSysid = rightUserGroup.Sysid
                    }, conn, trans);

                    //3、删除当前组对应的权限分配信息
                    RightDal.DeleteByUserGroupSysid(new Right {
                        UserGroupSysid = rightUserGroup.Sysid
                    }, conn, trans);

                    trans.Commit();
                }

                if (conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                }
            }

            return(true);
        }
示例#13
0
 //删除数据
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <returns></returns>
 internal override bool Delete()
 {
     if (EditEntity == null)
     {
         UI.ShowWarn("请选择待删除数据");
         return false;
     }
     if (!UI.Confirm("确定要删除吗?"))
         return false;
     if (!RightUserGroupBll.DeleteRightUserGroup(EditEntity))
     {
         UI.ShowError("删除失败");
         return false;
     }
     EditEntity = null;
     UI.ClearUi(pageEditData);
     return true;
 }
示例#14
0
 public static bool DeleteRightUserGroup(RightUserGroup rightUserGroup)
 {
     return RightUserGroupDal.Delete(rightUserGroup);
 }
示例#15
0
        //用编辑框数据填充实体
        /// <summary>
        /// 用编辑框数据填充实体
        /// </summary>
        private void BuildEntity()
        {
            if (CurrentOperationStatus == OperationStatus.New)
            {
                EditEntity = new RightUserGroup
                                 {
                                     Sysid = Sysid.NewId(""),
                                     CreatedBy = GloableData.Instance.UserId
                                 };
            }
            EditEntity.ModifiedBy = GloableData.Instance.UserId;

            EditEntity.RecordStatus = UI.GetValue(chkRecordStatus);
            EditEntity.GroupName = UI.GetValue(txtGroupName);
        }
示例#16
0
        public static bool Update(RightUserGroup rightUserGroup, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            UPDATE T_RIGHT_USER_GROUP
            SET GROUP_NAME=@GroupName,WORKSHOP=@Workshop,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus
            WHERE SYSID=@Sysid

            ";

            return Dapper.Save(rightUserGroup, sql, conn, trans);
        }
示例#17
0
 public static bool DeleteRightUserGroup(RightUserGroup rightUserGroup)
 {
     return(RightUserGroupDal.Delete(rightUserGroup));
 }
示例#18
0
        //设置选中的实体
        /// <summary>
        /// 设置选中的实体
        /// </summary>
        private void SetSelectedEntity()
        {
            if (grdQueryResult.SelectedRows == null ||
                grdQueryResult.SelectedRows.Count <= 0)
                return;

            EditEntity = grdQueryResult.SelectedRows[0].DataBoundItem as RightUserGroup;

            InitEditForm();
        }