protected void InsertItemButton_Click(object sender, EventArgs e) { if (clnGorevSuresiBaslangic.SelectedDate == null || clnGorevSuresiBitis.SelectedDate == null) { lblUyari.ForeColor = System.Drawing.Color.Red; lblUyari.Text = "Lütfen geçerli görev başlangıç ve bitiş tarihlerini belirleyiniz"; } else { if (Session["OturumIcinGorevID"] == null) { lblUyari.Text = "Öncelikle sol taraftaki ögeleri kullanarak görev kapsamına bir firma ekleyip bir GorevId almalısınız. GorevId bulunamadı!"; } else { using (sfKalDataEntities ent = new sfKalDataEntities()) { try { GorevPersonel oGorevPersonel = new GorevPersonel(); oGorevPersonel.GorevID = int.Parse(GorevID.Text.Trim()); oGorevPersonel.Personel = Personel.Text.Trim(); oGorevPersonel.GorevSuresi = clnGorevSuresiBaslangic.SelectedDate.Value; oGorevPersonel.GorevSuresiBitis = clnGorevSuresiBitis.SelectedDate.Value; oGorevPersonel.Unvan = Unvan.Text.Trim(); oGorevPersonel.Avans = decimal.Parse(Avans.Text.Trim()); oGorevPersonel.GorevKonusu = int.Parse(ddlGorevKonusu.SelectedValue); ent.AddToGorevPersonel(oGorevPersonel); ent.SaveChanges(); lblUyari.ForeColor = System.Drawing.Color.Green; lblUyari.Text = "Görev-Personel ekleme başarılı."; GorevPersonelGridiniBagla(int.Parse(GorevID.Text.Trim())); } catch (Exception exc) { lblUyari.ForeColor = System.Drawing.Color.Red; lblUyari.Text = "Görev-Personel ekleme başarısız.Hata:" + exc.Message; } } } } }