Пример #1
0
        public static bool UpdateRightUser(RightUser rightUser, out string msg)
        {
            var lstData = RightUserDal.QueryRightUserByUserId(rightUser.UserId);

            if (lstData != null)
            {
                foreach (var info in lstData)
                {
                    if (info.Sysid == rightUser.Sysid)
                    {
                        continue;
                    }

                    msg = "工号不能重复";
                    return(false);
                }
            }
            if (!RightUserDal.Update(rightUser))
            {
                msg = "更新用户信息保存失败";
                return(false);
            }
            msg = "操作成功";
            return(true);
        }
Пример #2
0
        public static bool Delete(RightUser rightUser)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

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

                    trans.Commit();
                }

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

            return(true);
        }
Пример #3
0
        public static bool Delete(RightUser rightUser)
        {
            using (var conn = new SqlConnection(Conn.getConn()))
            {
                if (conn.State != ConnectionState.Open)
                    conn.Open();

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

                    trans.Commit();
                }

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

            return true;
        }
Пример #4
0
        //新增数据
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <returns></returns>
        internal override bool Add()
        {
            EditEntity = null;
            pageViewMain.SelectedPage = pageEdit;
            UI.ClearUi(pageEdit);
            UI.ReadOnlyUi(pageEdit, false);

            return true;
        }
Пример #5
0
        public static bool Delete(RightUser rightUser, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
DELETE FROM T_RIGHT_USER
WHERE SYSID=@Sysid

";

            return(Dapper.Save(rightUser, sql, conn, trans));
        }
Пример #6
0
        public static bool Insert(RightUser rightUser, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            INSERT INTO T_RIGHT_USER(SYSID,USER_ID,USER_NAME,USER_PWD,DEPARTMENT,EMAIL,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS,RESV01,RESV02,RESV03,RESV04,RESV05,RESV06,RESV07,RESV08,RESV09,RESV10)
            VALUES(@Sysid,@UserId,@UserName,@UserPwd,@Department,@Email,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus,@Resv01,@Resv02,@Resv03,@Resv04,@Resv05,@Resv06,@Resv07,@Resv08,@Resv09,@Resv10)

            ";

            return Dapper.Save(rightUser, sql, conn, trans);
        }
Пример #7
0
        public static bool Insert(RightUser rightUser, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
INSERT INTO T_RIGHT_USER(SYSID,USER_ID,USER_NAME,USER_PWD,DEPARTMENT,EMAIL,CREATED_ON,CREATED_BY,MODIFIED_ON,MODIFIED_BY,RECORD_STATUS,RESV01,RESV02,RESV03,RESV04,RESV05,RESV06,RESV07,RESV08,RESV09,RESV10)
VALUES(@Sysid,@UserId,@UserName,@UserPwd,@Department,@Email,CONVERT(NVARCHAR(50),GETDATE(),121),@CreatedBy,CONVERT(NVARCHAR(50),GETDATE(),121),@ModifiedBy,@RecordStatus,@Resv01,@Resv02,@Resv03,@Resv04,@Resv05,@Resv06,@Resv07,@Resv08,@Resv09,@Resv10)

";

            return(Dapper.Save(rightUser, sql, conn, trans));
        }
Пример #8
0
        public static bool Delete(RightUser rightUser, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            DELETE FROM T_RIGHT_USER
            WHERE SYSID=@Sysid

            ";

            return Dapper.Save(rightUser, sql, conn, trans);
        }
Пример #9
0
        public static bool Update(RightUser rightUser, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
UPDATE T_RIGHT_USER
SET USER_ID=@UserId,USER_NAME=@UserName,USER_PWD=@UserPwd,DEPARTMENT=@Department,,EMAIL=@Email,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus,RESV01=@Resv01,RESV02=@Resv02,RESV03=@Resv03,RESV04=@Resv04,RESV05=@Resv05,RESV06=@Resv06,RESV07=@Resv07,RESV08=@Resv08,RESV09=@Resv09,RESV10=@Resv10
WHERE SYSID=@Sysid

";

            return(Dapper.Save(rightUser, sql, conn, trans));
        }
Пример #10
0
 public static bool InsertRightUser(RightUser rightUser, out string msg)
 {
     var lstData = RightUserDal.QueryRightUserByUserId(rightUser.UserId);
     if (lstData != null && lstData.Count > 0)
     {
         msg = "工号不能重复";
         return false;
     }
     if (!RightUserDal.Insert(rightUser))
     {
         msg = "增加用户信息保存失败";
         return false;
     }
     msg = "操作成功";
     return true;
 }
Пример #11
0
        public static bool InsertRightUser(RightUser rightUser, out string msg)
        {
            var lstData = RightUserDal.QueryRightUserByUserId(rightUser.UserId);

            if (lstData != null && lstData.Count > 0)
            {
                msg = "工号不能重复";
                return(false);
            }
            if (!RightUserDal.Insert(rightUser))
            {
                msg = "增加用户信息保存失败";
                return(false);
            }
            msg = "操作成功";
            return(true);
        }
Пример #12
0
 //删除数据
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <returns></returns>
 internal override bool Delete()
 {
     if (EditEntity == null)
     {
         UI.ShowWarn("请选择待删除数据");
         return false;
     }
     if (!UI.Confirm("确定要删除吗?"))
         return false;
     if (!RightUserBll.DeleteRightUser(EditEntity))
     {
         UI.ShowError("删除失败");
         return false;
     }
     EditEntity = null;
     UI.ClearUi(pageEdit);
     return true;
 }
Пример #13
0
        //设置选中的实体
        /// <summary>
        /// 设置选中的实体
        /// </summary>
        private void SetSelectedEntity()
        {
            if (grdQueryResult.SelectedRows == null ||
                grdQueryResult.SelectedRows.Count <= 0)
                return;

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

            InitEditForm();
        }
Пример #14
0
 public static bool DeleteRightUser(RightUser rightUser)
 {
     return(RightUserDal.Delete(rightUser));
 }
Пример #15
0
        public static bool UpdateRightUser(RightUser rightUser, out string msg)
        {
            var lstData = RightUserDal.QueryRightUserByUserId(rightUser.UserId);
            if (lstData != null)
            {
                foreach (var info in lstData)
                {
                    if (info.Sysid == rightUser.Sysid)
                        continue;

                    msg = "工号不能重复";
                    return false;
                }
            }
            if (!RightUserDal.Update(rightUser))
            {
                msg = "更新用户信息保存失败";
                return false;
            }
            msg = "操作成功";
            return true;
        }
Пример #16
0
        //用编辑框数据填充实体
        /// <summary>
        /// 用编辑框数据填充实体
        /// </summary>
        private void BuildEntity()
        {
            if (CurrentOperationStatus == OperationStatus.New)
            {
                EditEntity = new RightUser
                                {
                                    Sysid = Sysid.NewId(""),
                                    UserPwd = CryptoHelper.ToMd5("123456"),
                                    CreatedBy = GloableData.Instance.UserId
                                };
            }
            else if (CurrentOperationStatus == OperationStatus.Edit)
            {
                if (UI.GetValue(chkIsChangePassword) == "1")
                {
                    EditEntity.UserPwd = CryptoHelper.ToMd5("123456");
                }
            }

            EditEntity.ModifiedBy = GloableData.Instance.UserId;
            EditEntity.Department = UI.GetValue(ddlDepName);
            EditEntity.UserId = UI.GetUpperValue(txtUserId);
            EditEntity.UserName = UI.GetValue(txtUserName);
            EditEntity.Email = UI.GetValue(txtEmail);
            EditEntity.RecordStatus = UI.GetValue(chkIsEnable);
        }
Пример #17
0
        public static bool Update(RightUser rightUser, SqlConnection conn, SqlTransaction trans)
        {
            const string sql = @"
            UPDATE T_RIGHT_USER
            SET USER_ID=@UserId,USER_NAME=@UserName,USER_PWD=@UserPwd,DEPARTMENT=@Department,,EMAIL=@Email,CREATED_BY=@CreatedBy,MODIFIED_ON=CONVERT(NVARCHAR(50),GETDATE(),121),MODIFIED_BY=@ModifiedBy,RECORD_STATUS=@RecordStatus,RESV01=@Resv01,RESV02=@Resv02,RESV03=@Resv03,RESV04=@Resv04,RESV05=@Resv05,RESV06=@Resv06,RESV07=@Resv07,RESV08=@Resv08,RESV09=@Resv09,RESV10=@Resv10
            WHERE SYSID=@Sysid

            ";

            return Dapper.Save(rightUser, sql, conn, trans);
        }
Пример #18
0
 public static bool DeleteRightUser(RightUser rightUser)
 {
     return RightUserDal.Delete(rightUser);
 }