예제 #1
0
        private void btnDongY_Click_1(object sender, EventArgs e)
        {
            if (dipGiaNhap.Text == "")
            {
                MessageBox.Show("Nhập giá cho nguyên liệu", " Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dipGiaNhap.Focus();
                return;
            }
            if (dipSoLuong.Text == "0")
            {
                MessageBox.Show("Nhập lại số lượng", " Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (_soluong < (int)dipSoLuong.Value)
            {
                MessageBox.Show("Nhập lại số lượng. Số lượng còn trong kho không đủ để xuất", " Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
           
            Kho kho = new Kho();
            kho.maNguyenLieu = txtMaNguyenLieu.Text.ToString();
            kho.tenNguyenLieu = txtTenNguyenLieu.Text.ToString();
            kho.maDonVi = txtDonViTinh.Text.ToString();
            kho.giaNhap = (decimal)dipGiaNhap.Value;
            kho.soLuongTon = _soluong - (int)dipSoLuong.Value ;

            if (khoBUS.updateNguyenLieu(kho) != 0)
            {

                MessageBox.Show("Xuất kho thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Global.kho.parseDataNguyenLieu(Global.getListNguyenLieu());
                this.Close();

            }
        }
예제 #2
0
 public void showData(Kho kho)
 {
     txtMaNguyenLieu.Text = kho.maNguyenLieu;
     txtTenNguyenLieu.Text = kho.tenNguyenLieu;
     cbxDonViTinh.DataSource = donvitinhBUS.getDonViTinhList();
     cbxDonViTinh.ValueMember = "MaDonVi";
     cbxDonViTinh.DisplayMember = "TenDonVi";
 }
예제 #3
0
 public void showData(Kho kho)
 {
     txtMaNguyenLieu.Text = kho.maNguyenLieu;
     txtTenNguyenLieu.Text = kho.tenNguyenLieu;
     txtDonViTinh.Text = kho.maDonVi;
     dipGiaNhap.Value = (double)kho.giaNhap;
     _soluong = kho.soLuongTon;
 }
예제 #4
0
        public List<Kho> getNguyenLieuList()
        {
            List<Kho> list = new List<Kho>();
            KhoDAO _khoDao = new KhoDAO();
            DataTable tb = _khoDao.getAllNguyenLieu();

            foreach (DataRow row in tb.Rows)
            {
                Kho kho = new Kho(row["MaNguyenLieu"].ToString(),row["TenNguyenLieu"].ToString(),row["MaDonVi"].ToString(),decimal.Parse(row["GiaNhap"].ToString()),int.Parse(row["SoLuongTon"].ToString()));
                list.Add(kho);
            }

            return list;
        }
예제 #5
0
        public int insertNguyenLieu(Kho kho)
        {
            int param = 5;

            string[] name = new string[param];
            object[] value = new object[param];

            name[0] = "@MaNguyenLieu"; value[0] = kho.maNguyenLieu;
            name[1] = "@TenNguyenLieu"; value[1] = kho.tenNguyenLieu;
            name[2] = "@MaDonVi"; value[2] = kho.maDonVi;
            name[3] = "@GiaNhap"; value[3] = kho.giaNhap;
            name[4] = "@SoLuongTon"; value[4] = kho.soLuongTon;


            return db.Update("NGUYENLIEU_proc_insert", name, value, param);
        }
예제 #6
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            Kho kho = new Kho();
            kho.maNguyenLieu = txtMaNguyenLieu.Text.ToString();
            kho.tenNguyenLieu = txtTenNguyenLieu.Text.ToString();
            kho.maDonVi = cbxDonViTinh.SelectedValue.ToString();
            kho.giaNhap = 0;
            kho.soLuongTon = 0;

            if (khoBUS.updateNguyenLieu(kho) != 0)
            {
                
                MessageBox.Show("Cập nhật nguyên liệu thành công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Global.kho.parseDataNguyenLieu(Global.getListNguyenLieu());
                this.Close();

            }
        }
예제 #7
0
        public int updateNguyenLieu(Kho kho)
        {
            int param = 5;
            string[] names = new string[param];
            Object[] values = new Object[param];

            names[0] = "@MaNguyenLieu"; 
            names[1] = "@TenNguyenLieu"; 
            names[2] = "@MaDonVi"; 
            names[3] = "@GiaNhap"; 
            names[4] = "@SoLuongTon"; 

            values[0] = kho.maNguyenLieu;
            values[1] = kho.tenNguyenLieu; 
            values[2] = kho.maDonVi; 
            values[3] = kho.giaNhap; 
            values[4] = kho.soLuongTon;
            return db.Update("NGUYENLIEU_proc_update", names, values, param);
        }
예제 #8
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (TxtTenNguyenLieu.Text == "")
            {
                MessageBox.Show("Nhập tên nguyên liệu", " Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtTenNguyenLieu.Focus();
                return;
            }
            
            Kho nguyenLieu = new Kho(txtMaNguyenLieu.Text.ToString(),TxtTenNguyenLieu.Text.ToString(),cbxDonViTinh.SelectedValue.ToString(),0,0);

            if (khoBUS.insertNguyenLieu(nguyenLieu) != 0)
            {
                
                MessageBox.Show("Đã thêm nguyên liệu mới", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Global.kho.parseDataNguyenLieu(Global.getListNguyenLieu());
                this.Close();
            }
        }
예제 #9
0
 public int updateNguyenLieu(Kho kho)
 {
     return khoDAO.updateNguyenLieu(kho);
 }
예제 #10
0
 public int insertNguyenLieu(Kho kho)
 {
     return khoDAO.insertNguyenLieu(kho);
 }