예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int        rowId  = gridYeuCau.SelectedCells[0].RowIndex;
            int        id     = int.Parse(gridYeuCau.Rows[rowId].Cells[0].Value.ToString());
            YeuCau     yeuCau = db.YeuCau.SingleOrDefault(x => x.YeuCauID == id);
            FormChonCa chonCa = new FormChonCa(yeuCau);

            chonCa.Show();
        }
        private void BtnTaoCa_Click(object sender, EventArgs e)
        {
            YeuCau addYeuCau = new YeuCau();

            addYeuCau.SoLuongCa    = int.Parse(txtSoLuongCa.Text.ToString());
            addYeuCau.SoLuongNguoi = int.Parse(txtSoNguoiLam.Text.ToString());
            addYeuCau.NgayTruc     = DateTime.Parse(dtNgayNhap.Text.ToString());
            List <CaTruc> lstCaTruc = TaoCaTrucMacDinh();

            foreach (CaTruc caTruc in lstCaTruc)
            {
                addYeuCau.CaTruc.Add(caTruc);
            }
            yeuCauAPIS.PostYeuCau(addYeuCau);
            List <CaTruc> CaTruc = addYeuCau.CaTruc.ToList();
            FormChonCa    f      = new FormChonCa(addYeuCau);

            f.Show();
            gridYeuCau.DataSource = null;
            getDataGrid();
        }