Ejemplo n.º 1
0
        public List <PhieuRut> LoadPhieuRutByTime(string start, string end)
        {
            List <PhieuRut> list  = new List <PhieuRut>();
            string          query = "SET DATEFORMAT DMY SELECT [MAPHIEU],[NGAYRUT],[TIENLAI],[TONGTIEN],[MAGDV_LPR] FROM [QL_TAIKHOAN].[dbo].[PHIEURUT] WHERE [NGAYRUT]>='" + start + "' AND [NGAYRUT]<='" + end + "'";
            DataTable       data  = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                PhieuRut phieu = new PhieuRut(item);
                list.Add(phieu);
            }
            return(list);
        }
Ejemplo n.º 2
0
        public List <PhieuRut> LoadAllPhieuRut()
        {
            List <PhieuRut> list  = new List <PhieuRut>();
            string          query = "SELECT [MAPHIEU],[NGAYRUT],[TIENLAI],[TONGTIEN],[MAGDV_LPR] FROM [QL_TAIKHOAN].[dbo].[PHIEURUT]  ORDER BY [NGAYRUT] DESC";
            DataTable       data  = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                PhieuRut phieu = new PhieuRut(item);
                list.Add(phieu);
            }
            return(list);
        }
Ejemplo n.º 3
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         PhieuRut pg = new PhieuRut(txtMaPhieuRut.Text, txtMaSTK.Text, txtMaKH.Text, dateTimePicker1.Text, txtSoTienRut.Text);
         useRut.XoaPhieuRut(pg);
         init();
         gridPhieuRut.DataSource = useRut.loadPhieuRut();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         //throw;
     }
 }
Ejemplo n.º 4
0
        //xoa rut
        public void XoaPhieuRut(PhieuRut pr)
        {
            string sql = "delete from PhieuRutTien where MaPhieuRut = N'" + pr.MaPhieuRut + "'";

            try
            {
                cnn = new SqlConnection(str);
                cnn.Open();
                SqlCommand cmd = new SqlCommand(sql, cnn);
                cmd.ExecuteNonQuery();
                cmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                // throw;
            }
        }
Ejemplo n.º 5
0
        //thêm rut
        //thêm
        public void ThemPhieuRut(PhieuRut pr)
        {
            string sql = "insert into PhieuRutTien values (N'" + pr.MaPhieuRut + "', N'" + pr.MaSTK + "', N'" +
                         pr.MaKH + "', '" + pr.ThoiGianRut.ToString("yyyy-MM-dd HH:mm:ss") + "', N'" + pr.SoTienRut + "') ";

            try
            {
                cnn = new SqlConnection(str);
                cnn.Open();
                SqlCommand cmd = new SqlCommand(sql, cnn);
                cmd.ExecuteNonQuery();
                cmd.Dispose();
                cnn.Close();
                cnn.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                // throw;
            }
        }
Ejemplo n.º 6
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            try
            {
                //bắt đk
                if (useRut.MaSTKLaNULL(txtMaSTK.Text))
                {
                    MessageBox.Show("Mã Sổ tiết kiệm không được trống!", "Cảnh báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (useRut.MaKHLaNULL(txtMaKH.Text))
                {
                    MessageBox.Show("Mã khách hàng không được trống!", "Cảnh báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else if (useRut.SoTienRutLaNULL(txtSoTienRut.Text))
                {
                    MessageBox.Show("số tiền gửi không được trống!", "Cảnh báo!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    try
                    {
                        PhieuRut pr = new PhieuRut(txtMaPhieuRut.Text, txtMaSTK.Text, txtMaKH.Text, dateTimePicker1.Text, txtSoTienRut.Text);
                        useRut.ThemPhieuRut(pr);
                        init();
                        gridPhieuRut.DataSource = useRut.loadPhieuRut();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        //throw;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //throw;
            }
        }