Ejemplo n.º 1
0
        // end 0712455
        //0712467
        public static int DongTaiKhoan(TaiKhoanDTO tkDto, string recentUser)
        {
            SqlConnection cnn = KetNoiCSDL.TaoKetNoi();
            SqlCommand cmd = new SqlCommand("sp_DongTK", cnn);

            cmd.CommandType = CommandType.StoredProcedure ;

            cmd.Parameters.Add("@MaTK", SqlDbType.Char);
            cmd.Parameters.Add("@MaNVGD", SqlDbType.Char);
            cmd.Parameters.Add("@ChiNhanhGD", SqlDbType.Int);

            cmd.Parameters["@MaTK"].Value = tkDto.MaTK;
            cmd.Parameters["@MaNVGD"].Value = recentUser;
            cmd.Parameters["@ChiNhanhGD"].Value = NhanVienDAO.LayChiNhanhGD(recentUser);

            cnn.Open();
            int rs = 0;
            try
            {
                rs = cmd.ExecuteNonQuery();
                cnn.Close();
                return rs;
            }
            catch (Exception ex)
            {
                if (cnn.State == ConnectionState.Open)
                    cnn.Close();
                throw ex;
            }
        }
Ejemplo n.º 2
0
 public bool UpdateTaiKhoan(TaiKhoanDTO dtoTaiKhoan)
 {
     string strQuery = "Update TAIKHOAN Set ";
     strQuery += "SOTAIKHOAN = N'" + dtoTaiKhoan.SoTaiKhoan + "',";
     strQuery += "NGANHANG = N'" + dtoTaiKhoan.NganHang + "',";
     strQuery += "LUONGTIEN = " + dtoTaiKhoan.LuongTien + ",";
     strQuery += "LOAITIEN = N'" + dtoTaiKhoan.LoaiTien + "' ";
     strQuery += "Where MATAIKHOAN = N'" + dtoTaiKhoan.MaTaiKhoan + "'";
     return dp.ExecuteNonQuery(strQuery);
 }
Ejemplo n.º 3
0
 public bool InsertTaiKhoan(TaiKhoanDTO dtoTaiKhoan)
 {
     string strQuery = "Insert Into TAIKHOAN Values(";
     strQuery += "N'" + dtoTaiKhoan.MaTaiKhoan + "',";
     strQuery += "N'" + dtoTaiKhoan.SoTaiKhoan + "',";
     strQuery += "N'" + dtoTaiKhoan.NganHang + "',";
     strQuery += dtoTaiKhoan.LuongTien + ",";
     strQuery += "N'" + dtoTaiKhoan.LoaiTien + "'";
     return dp.ExecuteNonQuery(strQuery);
 }
Ejemplo n.º 4
0
 public TaiKhoanDTO(TaiKhoanDTO taiKhoanDTO)
 {
     this.TenTaiKhoan = taiKhoanDTO.TenTaiKhoan;
     this.MatKhau     = taiKhoanDTO.MatKhau;
     this.HoTen       = taiKhoanDTO.HoTen;
     this.Email       = taiKhoanDTO.Email;
     this.SDT         = taiKhoanDTO.SDT;
     this.DiaChi      = taiKhoanDTO.DiaChi;
     this.AnhDaiDien  = taiKhoanDTO.AnhDaiDien;
     this.LaAdmin     = taiKhoanDTO.LaAdmin;
     this.TrangThai   = taiKhoanDTO.TrangThai;
 }
Ejemplo n.º 5
0
 public string UpdateTaiKhoan(TaiKhoanDTO dtoTaiKhoan)
 {
     string strError = "";
     if (dtoTaiKhoan.SoTaiKhoan.Trim().Equals("") == true)
     {
         strError += " Số tài khoản không được rỗng.";
     }
     if (dtoTaiKhoan.NganHang.Trim().Equals("") == true)
     {
         strError += " Tên ngân hàng không được rỗng.";
     }
     if (strError == "")
     {
         bool boolResult = dalTaiKhoan.UpdateTaiKhoan(dtoTaiKhoan);
         return "ok";
     }
     else
     {
         return strError;
     }
 }
Ejemplo n.º 6
0
        //0712455
        private void bt_CT_Tim_Click(object sender, EventArgs e)
        {
            dtgv_CT_DanhSach.Enabled = true;
            string kt = kiemTraHopLeCTien();
            if (kt != "")
            {
                MessageBox.Show(kt);
                return;
            }

            try
            {
                List<TaiKhoanDTO> lstTaiKhoan = new List<TaiKhoanDTO>();
                if (tb_CT_MaTK.TextLength != 0)
                {
                    TaiKhoanDTO taiKhoanDto = new TaiKhoanDTO();
                    taiKhoanDto = TaiKhoanBUS.TimTaiKhoan(tb_CT_MaTK.Text.Trim());
                    lstTaiKhoan.Add(taiKhoanDto);
                }
                else
                {
                    KhachHangDTO khDto = new KhachHangDTO();
                    if (tb_CT_HoTen.TextLength != 0)
                    {
                        khDto.HoTen = tb_CT_HoTen.Text.Trim();
                    }
                    if (tb_CT_CMND.TextLength != 0)
                    {
                        khDto.CMND = tb_CT_CMND.Text.Trim();
                    }
                    List<KhachHangDTO> lstKH = KhachHangBUS.TimKhachHang(khDto);
                    lstTaiKhoan = TaiKhoanBUS.TimDSTaiKhoan(lstKH);
                }

                dtgv_CT_DanhSach.DataSource = lstTaiKhoan;

                dtgv_CT_DanhSach.Columns["MaTK"].Visible = true;
                dtgv_CT_DanhSach.Columns["MaLoaiTK"].Visible = false;
                dtgv_CT_DanhSach.Columns["MaKH"].Visible = false;
                dtgv_CT_DanhSach.Columns["NgayBatDau"].Visible = true;
                dtgv_CT_DanhSach.Columns["NgayKetThuc"].Visible = true;
                dtgv_CT_DanhSach.Columns["SoDuCo"].Visible = false;
                dtgv_CT_DanhSach.Columns["SoDuNo"].Visible = false;
                dtgv_CT_DanhSach.Columns["SoDu"].Visible = true;
                dtgv_CT_DanhSach.Columns["TinhTrang"].Visible = true;
                dtgv_CT_DanhSach.Columns["LoaiTienTe"].Visible = true;
                dtgv_CT_DanhSach.Columns["MaChiNhanh"].Visible = false;
                dtgv_CT_DanhSach.AutoResizeColumns();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public frmManager(DTO.TaiKhoanDTO taiKhoan)
 {
     InitializeComponent();
     this.TaiKhoanLogin = taiKhoan;
     LoadManager();
 }
Ejemplo n.º 8
0
        //tim TK dua tren khDto
        // 0712455
        public static List<TaiKhoanDTO> TimDSTaiKhoan(List<KhachHangDTO> lstKH)
        {
            SqlConnection cnn = KetNoiCSDL.TaoKetNoi();
            List<TaiKhoanDTO> lsttaiKhoanDto = new List<TaiKhoanDTO>(); ;

            for (int i = 0; i < lstKH.Count; i++)
            {
                string query = String.Format("select * from Tai_Khoan where MaKH = '{0}' and (TinhTrang = N'Mở' or (TinhTrang = N'Phong Tỏa' and dbo.TinhSoTienCoHieuLuc(MaTK) > 0))", lstKH[i].MaKH);
                SqlCommand cmd = new SqlCommand(query, cnn);

                cnn.Open();
                try
                {
                    SqlDataReader dr = cmd.ExecuteReader();

                    while (dr.Read())
                    {
                        TaiKhoanDTO taiKhoanDto = new TaiKhoanDTO();

                        taiKhoanDto.MaTK = dr["MaTK"].ToString();
                        taiKhoanDto.MaLoaiTK = (int)dr["MaLoaiTK"];
                        taiKhoanDto.MaKH = (int)dr["MaKH"];
                        taiKhoanDto.NgayBatDau = (DateTime)dr["NgayBatDau"];
                        taiKhoanDto.NgayKetThuc = (DateTime)dr["NgayKetThuc"];
                        taiKhoanDto.SoDuCo = Convert.ToDouble(dr["SoDuCo"].ToString());
                        taiKhoanDto.SoDuNo = Convert.ToDouble(dr["SoDuNo"].ToString());
                        taiKhoanDto.SoDu = Convert.ToDouble(dr["SoDu"].ToString());
                        taiKhoanDto.TinhTrang = dr["TinhTrang"].ToString();
                        taiKhoanDto.MaChiNhanh = (int)dr["MaChiNhanh"];
                        taiKhoanDto.LoaiTienTe = (int)dr["LoaiTienTe"];

                        lsttaiKhoanDto.Add(taiKhoanDto);
                    }
                    cnn.Close();
                }
                catch (Exception ex)
                {
                    if (cnn.State == ConnectionState.Open)
                        cnn.Close();
                    throw ex;
                }
              }
              return lsttaiKhoanDto;
        }
Ejemplo n.º 9
0
        //Tim tk dua tren tkDto
        public static TaiKhoanDTO TimTaiKhoan(string maTK)
        {
            SqlConnection cnn = KetNoiCSDL.TaoKetNoi();
            string query = String.Format("select * from Tai_Khoan where MaTK = '{0}' and (TinhTrang = N'Mở' or (TinhTrang = N'Phong Tỏa' and dbo.TinhSoTienCoHieuLuc({0}) > 0))", maTK);
            SqlCommand cmd = new SqlCommand(query, cnn);

            cnn.Open();

            try
            {
                SqlDataReader dr = cmd.ExecuteReader();
                TaiKhoanDTO taiKhoanDto = new TaiKhoanDTO();
                if (dr.Read())
                {
                    taiKhoanDto.MaTK = dr["MaTK"].ToString();
                    taiKhoanDto.MaLoaiTK = (int)dr["MaLoaiTK"];
                    taiKhoanDto.MaKH = (int)dr["MaKH"];
                    taiKhoanDto.NgayBatDau = (DateTime)dr["NgayBatDau"];
                    taiKhoanDto.NgayKetThuc = (DateTime)dr["NgayKetThuc"];
                    taiKhoanDto.SoDuCo = (double.Parse(dr["SoDuCo"].ToString()));
                    taiKhoanDto.SoDuNo = (double.Parse(dr["SoDuNo"].ToString()));
                    taiKhoanDto.SoDu = (double.Parse(dr["SoDu"].ToString()));
                    taiKhoanDto.TinhTrang = dr["TinhTrang"].ToString();
                    taiKhoanDto.MaChiNhanh = (int)dr["MaChiNhanh"];
                    taiKhoanDto.LoaiTienTe = (int)dr["LoaiTienTe"];
                }
                cnn.Close();
                return taiKhoanDto;
            }
            catch (Exception ex)
            {
                if (cnn.State == ConnectionState.Open)
                    cnn.Close();
                throw ex;
            }
        }
Ejemplo n.º 10
0
 public static int PhongToaTaiKhoan(TaiKhoanDTO tkDto, PhongToaTKDTO ptDto, string recentUser)
 {
     return TaiKhoanDAO.PhongToaTaiKhoan(tkDto, ptDto, recentUser);
 }
Ejemplo n.º 11
0
 public static int DongTaiKhoan(TaiKhoanDTO tkDto, string recentUser)
 {
     return TaiKhoanDAO.DongTaiKhoan(tkDto,recentUser);
 }