Пример #1
0
        private void btnDeleteWH_Click(object sender, EventArgs e)
        {
            FWareHouse fWareHouse = new FWareHouse();
            var        ID         = Convert.ToInt32(dgrvWH.CurrentRow.Cells["ID"].Value.ToString());

            fWareHouse.Delete(ID);
            BindingWarehouse();
        }
Пример #2
0
        private void btnAddWH_Click(object sender, EventArgs e)
        {
            WareHouse entity = new WareHouse();

            entity.ID         = Convert.ToInt32(txtIDWH.Text.ToString());
            entity.Location   = txtLocationWH.Text;
            entity.Quantity   = Convert.ToInt32(txtQuantityWH.Text.ToString());
            entity.Capacity   = Convert.ToInt32(txtCapacityWH.Text.ToString());
            entity.Warehouse1 = txtWH.Text;
            FWareHouse fWareHouse = new FWareHouse();

            fWareHouse.Insert(entity);

            BindingWarehouse();
        }
Пример #3
0
        private void btnEditWH_Click(object sender, EventArgs e)
        {
            WareHouse entity = new WareHouse();

            entity.ID         = Convert.ToInt32(txtIDWH.Text.ToString());
            entity.Location   = txtLocationWH.Text;
            entity.Quantity   = Convert.ToInt32(txtQuantityWH.Text.ToString());
            entity.Capacity   = Convert.ToInt32(txtCapacityWH.Text.ToString());
            entity.Warehouse1 = txtWH.Text;
            FWareHouse fWareHouse = new FWareHouse();

            fWareHouse.Update(entity);
            dgrvWH.Refresh();
            dgrvWH.DataSource = null;
            txtIDWH.Enabled   = false;
            List <WareHouse> list = (from wh in db.WareHouses select wh).ToList();

            dgrvWH.AutoGenerateColumns = false;

            dgrvWH.ColumnCount                 = 5;
            dgrvWH.Columns[0].Name             = "ID";
            dgrvWH.Columns[0].HeaderText       = "ID";
            dgrvWH.Columns[0].DataPropertyName = "ID";

            dgrvWH.Columns[1].Name             = "Warehouse";
            dgrvWH.Columns[1].HeaderText       = "Tên kho";
            dgrvWH.Columns[1].DataPropertyName = "Warehouse";


            dgrvWH.Columns[2].Name             = "Location";
            dgrvWH.Columns[2].HeaderText       = "Ð?a ch?";
            dgrvWH.Columns[2].DataPropertyName = "Location";

            dgrvWH.Columns[3].Name             = "Quantity";
            dgrvWH.Columns[3].HeaderText       = "Ðã ch?a";
            dgrvWH.Columns[3].DataPropertyName = "Quantity";

            dgrvWH.Columns[4].Name             = "Capacity";
            dgrvWH.Columns[4].HeaderText       = "S?c ch?a";
            dgrvWH.Columns[4].DataPropertyName = "Capacity";
            dgrvWH.DataSource = list;

            txtIDWH.Text       = dgrvWH.CurrentRow.Cells["ID"].Value.ToString();
            txtLocationWH.Text = dgrvWH.CurrentRow.Cells["Location"].Value.ToString();
            txtWH.Text         = dgrvWH.CurrentRow.Cells["Warehouse"].Value.ToString();
            txtCapacityWH.Text = dgrvWH.CurrentRow.Cells["Capacity"].Value.ToString();
            txtQuantityWH.Text = dgrvWH.CurrentRow.Cells["Quantity"].Value.ToString();
        }