Пример #1
0
    protected void Ekle()
    {
        EFDal ed = new EFDal();
        DataSet ds = new DataSet();
        using (sfKalDataEntities ent = new sfKalDataEntities())
        {
            try
            {

                GorevFirma oGorevFirma = new GorevFirma();
                oGorevFirma.GorevID = int.Parse(txtGorevID.Text.Trim());
                oGorevFirma.FirmaID =int.Parse(txtFirmaID.Text.Trim());
                oGorevFirma.Tarih = clnGorevTarihi.SelectedDate.Value;
                oGorevFirma.GoreveGidilenAracinPlakasi = ddlAracPlakasi.SelectedItem.Text;
                ent.AddToGorevFirma(oGorevFirma);
                ent.SaveChanges();
                Session["RaporIcinAracPlakasi"] = ddlAracPlakasi.SelectedItem.Text;
                lblUyari.ForeColor = System.Drawing.Color.Green;
                lblUyari.Text = "Görev-Firma başarılı olarak eklendi..";
                if (Session["OturumIcinGorevID"]==null)
                Session["OturumIcinGorevID"] = int.Parse(txtGorevID.Text.Trim());
                GorevIDdenGrdiBagla(int.Parse(txtGorevID.Text.Trim()));
            }
            catch (Exception exc)
            {
                lblUyari.ForeColor = System.Drawing.Color.Red;
                lblUyari.Text = "Görev-Firma ekleme başarısız.Hata:" + exc.Message;
            }
        }
    }
 /// <summary>
 /// Deprecated Method for adding a new object to the GorevFirma EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToGorevFirma(GorevFirma gorevFirma)
 {
     base.AddObject("GorevFirma", gorevFirma);
 }
 /// <summary>
 /// Create a new GorevFirma object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="gorevID">Initial value of the GorevID property.</param>
 /// <param name="firmaID">Initial value of the FirmaID property.</param>
 /// <param name="tarih">Initial value of the Tarih property.</param>
 public static GorevFirma CreateGorevFirma(global::System.Int32 id, global::System.Int32 gorevID, global::System.Int32 firmaID, global::System.DateTime tarih)
 {
     GorevFirma gorevFirma = new GorevFirma();
     gorevFirma.ID = id;
     gorevFirma.GorevID = gorevID;
     gorevFirma.FirmaID = firmaID;
     gorevFirma.Tarih = tarih;
     return gorevFirma;
 }