Beispiel #1
0
        public SuaCongTrinh(CongTrinhForm form, string kId, string cId)
            : this()
        {
            parentForm = form;
            KhId       = kId;

            var db = new CkpEntities();

            CtyTBox.Text = (from k in db.KhachHang where k.Id == kId select k.TenCongTy).First();
            var ct = (from c in db.CongTrinh where c.Id == cId select c).First();
            var nv = (from n in db.NhanVien where n.TrangThai == 1 select n);

            foreach (var n in nv)
            {
                NptCb.Items.Add(n.Id + ". " + n.HoTen + " - " + n.ChucVu);
            }

            CtrIdTBox.Text      = ct.Id;
            CtrIdTBox.ReadOnly  = true;
            CtrNameTBox.Text    = ct.TenCongTrinh;
            CtrDcTBox.Text      = ct.DiaChi == null ? "" : ct.DiaChi;
            SoHdTBox.Text       = ct.SoHopDong == null ? "" : ct.SoHopDong;
            NptCb.SelectedIndex = ct.NguoiPhuTrachId == null ? -1 : NptCb.FindStringExact(ct.NhanVien.Id + ". " + ct.NhanVien.HoTen + " - " + ct.NhanVien.ChucVu);
            NgayKyTBox.Text     = ct.NgayKyHD == null ? "" : ct.NgayKyHD.Value.ToString("ddMMyyyy");
            NgayThTBox.Text     = ct.NgayThucHien == null ? "" : ct.NgayThucHien.Value.ToString("ddMMyyyy");
        }
Beispiel #2
0
 private void CongTrinhBtn_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms.OfType <CongTrinhForm>().Count() == 1)
     {
         Application.OpenForms.OfType <CongTrinhForm>().First().Focus();
     }
     else
     {
         var form = new CongTrinhForm();
         form.Show();
     }
 }
Beispiel #3
0
        public ThemCongTrinh(CongTrinhForm form, string kId)
            : this()
        {
            parentForm = form;
            KhId       = kId;

            var db = new CkpEntities();

            CtyTBox.Text = (from k in db.KhachHang where k.Id == kId select k.TenCongTy).First();
            var nv = (from n in db.NhanVien where n.TrangThai == 1 select n);

            foreach (var n in nv)
            {
                NptCb.Items.Add(n.Id + ". " + n.HoTen + " - " + n.ChucVu);
            }
        }