예제 #1
0
        private void btnRut_Click(object sender, EventArgs e)
        {
            lblError.ForeColor = Color.Red;
            QLLuukiBUS qLLuukiBUS = new QLLuukiBUS();

            switch (qLLuukiBUS.KtraRutLuuKi(txtsoLuongRut.Text, txtsoLuongToiDa.Text))
            {
            case 1:
            {
                lblError.Text = "Bạn chưa nhập số lưu kí cần rút";
                break;
            }

            case 2:
            {
                lblError.Text = "Số lưu kí phải là số";
                break;
            }

            case 3:
            {
                lblError.Text = "Số lưu kí rút lớn hơn số lượng tối đa có thể rút";
                break;
            }

            case 0:
            {
                lblError.Text = "";

                if (qLLuukiBUS.rutLuuKi(txtsoTKLK.Text, txtmaCK.Text, qLLuuKi.SoLuong, long.Parse(txtsoLuongRut.Text)))
                {
                    long luuKi = qLLuuKi.SoLuong - long.Parse(txtsoLuongRut.Text);

                    dataGridView.SelectedRows[0].Cells[2].Value = luuKi.ToString();

                    MessageBox.Show("Rút lưu kí thành công");
                    Close();
                }

                break;
            }
            }
        }
예제 #2
0
        private void btnNop_Click(object sender, EventArgs e)
        {
            lblError.ForeColor = Color.Red;
            QLLuukiBUS qLLuukiBUS = new QLLuukiBUS();

            switch (qLLuukiBUS.KtraNopLuuKi(textsoLuongNop.Text))
            {
            case 1:
            {
                lblError.Text = "Bạn chưa nhập số lưu kí cần nộp";
                break;
            }

            case 2:
            {
                lblError.Text = "Số lưu kí phải là số";
                break;
            }

            case 0:
            {
                lblError.Text = "";

                if (qLLuukiBUS.nopLuuKi(txtsoTKLK.Text, txtMaCK.Text, qLLuuKi.SoLuong, long.Parse(textsoLuongNop.Text)))
                {
                    long luuKi = qLLuuKi.SoLuong + long.Parse(textsoLuongNop.Text);

                    dataGridView.SelectedRows[0].Cells[2].Value = luuKi.ToString();

                    MessageBox.Show("Nộp lưu kí thành công");
                    Close();
                }

                break;
            }
            }
        }
예제 #3
0
        private void txtSoTKLK_Leave(object sender, EventArgs e)
        {
            try
            {
                QLLuukiBUS qLTienMatBUS = new QLLuukiBUS();
                //lấy thông tin từ số TKLK
                string            jsonData = qLTienMatBUS.timKiem(txtSoTKLK.Text);
                List <QLLuuKiDTO> list     = JsonConvert.DeserializeObject <List <QLLuuKiDTO> >(jsonData);

                lblError.ForeColor = Color.Red;
                if (txtSoTKLK.Text == "")
                {
                    lblError.Text = "Dòng màu đỏ là thông tin bắt buộc nhập";
                }
                else
                if (list == null)
                {
                }
                else
                {
                    QLyKHBUS qLyKHBUS = new QLyKHBUS();
                    QLyKHDTO qLyKHDTO = JsonConvert.DeserializeObject <QLyKHDTO>(qLyKHBUS.layMotKhachHang(txtSoTKLK.Text));
                    if (qLyKHDTO != null)
                    {
                        txthoTen.Text  = qLyKHDTO.hoTenKH;
                        txtsoCMND.Text = qLyKHDTO.soCMNNKH;
                        txtSDT.Text    = qLyKHDTO.SDTKH;
                    }
                    else
                    {
                        lblError.Text  = "Số TKLK không có trong hệ thống";
                        txthoTen.Text  = "";
                        txtsoCMND.Text = "";
                        txtSDT.Text    = "";
                    }

                    gridView.Rows.Clear();
                    foreach (QLLuuKiDTO temp in list)
                    {
                        txthoTen.Text  = temp.HoTen;
                        txtSDT.Text    = temp.SoDT;
                        txtsoCMND.Text = temp.SoCMND;

                        lblError.Text = "";

                        long tsdb = temp.SoLuong * temp.GiaVay * temp.TiLeVay / 100;
                        gridView.Rows.Add(temp.MaCK, temp.TenCK, temp.SoLuong, temp.GiaVay, temp.TiLeVay, tsdb);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //try
            //{
            //    QLLuukiBUS qLLuuki = new QLLuukiBUS();
            //    string jsonData = qLLuuki.timKiem(txtSoTKLK.Text);
            //    List<QLLuuKiDTO> list = JsonConvert.DeserializeObject<List<QLLuuKiDTO>>(jsonData);
            //    switch (qLLuuki.KtraNhapSoTKLK(txtSoTKLK.Text))
            //    {
            //        case 1:
            //            {
            //                lblError.Text = "Bạn chưa nhập số TKLK";
            //                break;
            //            }
            //        case 2:
            //            {
            //                lblError.Text = "Số tài khoản lưu kí không tồn tại trong hệ thống";
            //                break;
            //            }
            //        case 0:
            //            {
            //                gridView.Rows.Clear();
            //                foreach (QLLuuKiDTO temp in list)
            //                {
            //                    txthoTen.Text = temp.HoTen;
            //                    txtSDT.Text = temp.SoDT;
            //                    txtsoCMND.Text = temp.SoCMND;

            //                    lblError.Text = "";

            //                    long tsdb = temp.SoLuong * temp.GiaVay * temp.TiLeVay;
            //                    gridView.Rows.Add(temp.MaCK, temp.TenCK, temp.SoLuong, temp.GiaVay, temp.TiLeVay, tsdb);
            //                }
            //                break;
            //            }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("Lỗi: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
        }