예제 #1
0
        private void Save()
        {
            string kq = "";
            tienthanhtoanphieunhapBL      ctr = new tienthanhtoanphieunhapBL();
            List <tienthanhtoanphieunhap> lst = new List <tienthanhtoanphieunhap>();

            lst = GetListTienThanhToan();
            for (int i = 0; i < lst.Count; i++)
            {
                tienthanhtoanphieunhap temp = new tienthanhtoanphieunhap();
                temp = ctr.GetByID(lst[i].id);
                if (temp == null)
                {
                    try
                    {
                        kq = ctr.Insert(lst[i]);
                    }
                    catch { break; }
                    _ctrlog.Append(Data.use, "Thêm mới tiền thanh toán ngày: " + lst[i].ngaytt.ToString("dd/MM/yyyy HH:mm:ss")
                                   + " số tiền: " + lst[i].tientt.ToString("N0", CultureInfo.InvariantCulture)
                                   + " cho phiếu nhập hàng của nhà cung cấp: " + lbTenKH.Text
                                   + " xuất ngày: " + lbNgayXuat.Text);
                }
                else
                {
                    try
                    {
                        kq = ctr.Update(lst[i]);
                    }
                    catch { break; }
                    _ctrlog.Append(Data.use, "Cập nhật tiền thanh toán ngày: " + lst[i].ngaytt.ToString("dd/MM/yyyy HH:mm:ss")
                                   + " từ số tiền: " + temp.tientt.ToString("N0", CultureInfo.InvariantCulture)
                                   + " thành số tiền: " + lst[i].tientt.ToString("N0", CultureInfo.InvariantCulture)
                                   + " cho phiếu nhập hàng của nhà cung cấp: " + lbTenKH.Text
                                   + " xuất ngày: " + lbNgayXuat.Text);
                }
            }
            if (kq.Trim().Equals("") == true)
            {
                MessageBox.Show("Cập nhật tiền thanh toán cho phiếu nhập hàng thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                HienThiDS();
            }
        }
예제 #2
0
        private void Del()
        {
            tienthanhtoanphieunhapBL ctr = new tienthanhtoanphieunhapBL();

            if (c1FlexGrid1.Rows.Count - 1 > 0)
            {
                string sid = c1FlexGrid1[c1FlexGrid1.RowSel, "id"].ToString().Trim();
                if (sid.Trim().Equals("") == false)
                {
                    if (c1FlexGrid1.Rows[c1FlexGrid1.RowSel].AllowEditing == false)
                    {
                        MessageBox.Show("Bạn không thể xóa bản ghi này.\nĐể xóa được bạn vui lòng xóa phiếu nhập hàng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    tienthanhtoanphieunhap temp = new tienthanhtoanphieunhap();
                    temp = ctr.GetByID(sid);
                    string kq = "";
                    kq = ctr.Delete(sid);
                    if (kq.Trim().Equals("") == true)
                    {
                        try
                        {
                            _ctrlog.Append(Data.use, "Xóa tiền thanh toán ngày: " + temp.ngaytt.ToString("dd/MM/yyyy HH:mm:ss")
                                           + " số tiền: " + temp.tientt.ToString("N0", CultureInfo.InvariantCulture)
                                           + " cho phiếu nhập hàng của nhà cung cấp: " + lbTenKH.Text
                                           + " xuất ngày: " + lbNgayXuat.Text);
                        }
                        catch { }
                        MessageBox.Show("Xóa tiền thanh toán của phiếu nhập thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        HienThiDS();
                    }
                }
                else
                {
                    c1FlexGrid1.Rows.Remove(c1FlexGrid1.RowSel);
                }
            }
        }