コード例 #1
0
        private NXNguyenLieu getXuatNL()
        {
            NXNguyenLieu nl = new NXNguyenLieu();

            nl.MaPhieuXuat = int.Parse(txtMaPX.Text);
            return(nl);
        }
コード例 #2
0
 private void btnNhapChiTiet_Click(object sender, EventArgs e)
 {
     if (cbHinhThuc.Text == "Nhập Nguyên Liệu")
     {
         NXNguyenLieu nx = getData();
         if (nlBO.NhapNL(nx))
         {
             frmCTNhapNL FromCTNhap;
             FromCTNhap = new frmCTNhapNL(txtMaPhieuNhap.Text);
             FromCTNhap.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Lỗi xảy ra!");
         }
     }
     else
     if (cbHinhThuc.Text == "Xuất Nguyên Liệu")
     {
         NXNguyenLieu nx = getData();
         if (nlBO.XuatNL(nx))
         {
             frmCTXuatNL FromCTXuat;
             FromCTXuat = new frmCTXuatNL(txtMaPhieuXuat.Text);
             FromCTXuat.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Lỗi xảy ra!");
         }
     }
 }
コード例 #3
0
ファイル: frmCTNhapNL.cs プロジェクト: haison123/WCF
        private NXNguyenLieu getNhapNL()
        {
            NXNguyenLieu nl = new NXNguyenLieu();

            nl.MaPhieuNhap = int.Parse(txtMaPN.Text);
            //nl.NgayNhap = DateTime.Today();
            //nl.TongTien = 0;
            return(nl);
        }
コード例 #4
0
        private NXNguyenLieu getDataPX()
        {
            NXNguyenLieu nxnl = new NXNguyenLieu();

            nxnl.MaPhieuXuat = int.Parse(txtMaPhieuXuat.Text);
            nxnl.NgayXuat    = Convert.ToDateTime(dtNgayXuat.Value.ToShortDateString());
            nxnl.MaNV        = cbbnv.SelectedValue.ToString();
            return(nxnl);
        }
コード例 #5
0
        private NXNguyenLieu getDataPN()
        {
            NXNguyenLieu nxnl = new NXNguyenLieu();

            nxnl.MaPhieuNhap = int.Parse(txtMaPhieuNhap.Text);
            nxnl.NgayNhap    = Convert.ToDateTime(dtNgayNhap.Value.ToShortDateString());
            nxnl.TongTien    = 0;
            nxnl.MaNV        = cbbnv.SelectedValue.ToString();
            return(nxnl);
        }
コード例 #6
0
        private void btnHuy_Click(object sender, EventArgs e)
        {
            int          maPX = int.Parse(txtMaPX.Text);
            NXNguyenLieu nl   = getXuatNL();

            if (ctxBO.kiemTraXuatNL(maPX) == false)
            {
                nxBO.XoaXuatNL(nl);
            }
            this.Close();
            frmNhapXuatNguyenLieu FromNhapXuatNL;

            FromNhapXuatNL = new frmNhapXuatNguyenLieu();
            FromNhapXuatNL.Show();
        }
コード例 #7
0
        private NXNguyenLieu getData()
        {
            int          i = 0, j = 0;
            NXNguyenLieu nxnl = new NXNguyenLieu();

            //nxnl.MaPhieuNhap = int.Parse(txtMaPhieuNhap.Text);
            //nxnl.MaPhieuXuat = int.Parse(txtMaPhieuXuat.Text);
            Int32.TryParse(txtMaPhieuNhap.Text, out i);
            Int32.TryParse(txtMaPhieuXuat.Text, out j);
            nxnl.MaPhieuNhap = i;
            nxnl.MaPhieuXuat = j;
            nxnl.NgayNhap    = Convert.ToDateTime(dtNgayNhap.Value.ToShortDateString());
            nxnl.NgayXuat    = Convert.ToDateTime(dtNgayXuat.Value.ToShortDateString());
            nxnl.TongTien    = 0;
            return(nxnl);
        }
コード例 #8
0
ファイル: frmCTNhapNL.cs プロジェクト: haison123/CNLTTH
        private void btnLuu_Click(object sender, EventArgs e)
        {
            CTNhapNL     nhap = getCTNhap();
            NXNguyenLieu nxnl = new NXNguyenLieu();
            int          maPN = int.Parse(txtMaPN.Text);
            string       maNL = cbMaNL.Text;

            if (ctsr.kiemTraTonTai(maPN, maNL))
            {
                if (ctsr.SuaCTNhap(nhap))
                {
                    MessageBox.Show("Sửa thành công");
                    nxsr.update_tongtien(maPN);
                }

                else
                {
                    MessageBox.Show("Không thể sửa");
                }
            }
            else
            if (txtDonGia.Text == "" || txtDonViTinh.Text == "" || txtSoLuong.Text == "")
            {
                MessageBox.Show("Bạn cần nhập đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            if (cts.ThemCTNhap(nhap))
            {
                MessageBox.Show("Thêm thành công");
                nxsr.update_tongtien(maPN);
            }

            else
            {
                MessageBox.Show("Không thể thêm dữ liệu");
            }
            binData();
        }