public ResponseInfo UpdateTrangThaiTaiKhoan(TrangThaiTaiKhoan TrangThai)
        {
            ResponseInfo response = new ResponseInfo();

            try
            {
                var kt = Convert.ToInt64(new GetPermission().GetQuyen("ACCOUNT_UPD")) & Convert.ToInt64(Common.Common.GetTongQuyen());
                if (kt != 0)
                {
                    response = new QuanLyTaiKhoanModel().UpadateTrangThaiTaiKhoan(TrangThai);
                }
                else
                {
                    var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.BanKhongDuQuyen);
                    response.TypeMsgError = errorMsg.Type;
                    response.MsgError     = errorMsg.Msg;
                }
            }
            catch (Exception e)
            {
                response.Code = (int)ConstantsEnum.CodeResponse.ServerError;
                var errorMsg = new GetErrorMsg().GetMsg((int)MessageEnum.MsgNO.ServerError);
                response.TypeMsgError    = errorMsg.Type;
                response.MsgError        = errorMsg.Msg;
                response.ThongTinBoSung1 = e.Message;
            }
            return(response);
        }
Beispiel #2
0
 public TaiKhoan(int matk, 
                 string mail, 
                 string matkhau, 
                 LoaiTaiKhoan loai,
                 int maLoaiTaiKhoan,
                 string Ten, 
                 DateTime ngaysinh, 
                 string diachi, 
                 string dienthoai, 
                 DateTime ngaydk, 
                 TrangThaiTaiKhoan trangthai,
                 int maTrangThai)
 {
     this.maTaiKhoan = matk;
     this.email = mail;
     this.matKhau = matkhau;
     this.loaiTaiKhoan = loai;
     this.maLoaiTaiKhoan = maLoaiTaiKhoan;
     this.ten = Ten;
     this.ngaySinh = ngaysinh;
     this.diaChi = diachi;
     this.dienThoai = dienthoai;
     this.ngayDangKy = ngaydk;
     this.trangThai = trangthai;
     this.maTrangThai = maTrangThai;
 }
        /// <summary>
        /// Cập nhật trạng thái tài khoản
        /// Author       :   HoangNM - 19/03/2019 - create
        /// </summary>
        /// <param name="TrangThaiTaiKhoan">thông tin về tài khoản muốn thay đổi</param>
        /// <returns>Trả về các thông tin khi cập nhật tài khoản, Excetion nếu có lỗi</returns>
        public ResponseInfo UpadateTrangThaiTaiKhoan(TrangThaiTaiKhoan TrangThaiTaiKhoan)
        {
            DbContextTransaction transaction = context.Database.BeginTransaction();
            ResponseInfo         response    = new ResponseInfo();

            try
            {
                context.TaiKhoans.Where(x => x.Id == TrangThaiTaiKhoan.Id && !x.DelFlag)
                .Update(x => new TblTaiKhoan
                {
                    Id_TrangThai = TrangThaiTaiKhoan.IdTrangThai
                });
                context.SaveChanges();
                response.IsSuccess = true;
                transaction.Commit();

                return(response);
            }
            catch (Exception e)
            {
                response.IsSuccess = false;
                transaction.Rollback();
                throw e;
            }
        }
Beispiel #4
0
 public TaiKhoan()
 {
     this.maTaiKhoan = 0;
     this.email = "";
     this.matKhau = "";
     this.loaiTaiKhoan = 0;
     this.ten = "";
     this.ngaySinh = DateTime.Now;
     this.diaChi = "";
     this.dienThoai = "";
     this.ngayDangKy = DateTime.Now;
     this.trangThai = 0;
     this.maLoaiTaiKhoan = 0;
 }
Beispiel #5
0
        public List <TrangThaiTaiKhoan> GetAllAccountStatus()
        {
            TrangThaiTaiKhoan status1 = new TrangThaiTaiKhoan();
            TrangThaiTaiKhoan status2 = new TrangThaiTaiKhoan();

            status1.TrangThai    = 1;
            status1.TenTrangThai = "Enable";
            status2.TrangThai    = 0;
            status2.TenTrangThai = "Disable";
            List <TrangThaiTaiKhoan> list = new List <TrangThaiTaiKhoan>();

            list.Add(status1);
            list.Add(status2);
            return(list);
        }