示例#1
0
    protected void btnEkle_Click(object sender, EventArgs e)
    {
        EFDal ed = new EFDal();
        int BolgeKodu = ed.kal_BolgeKoduDon(Context.User.Identity.Name);
        int SiradakiFirmaId = ed.FirmaIdMaxDon() + 1;
        sfKalDataEntities KalData=new sfKalDataEntities();
        firma oFirma = new firma();
        oFirma.MUSTNO = int.Parse(txtMustNo.Text.Trim());
        oFirma.FIRMAADI = txtFirmaAdi.Text.Trim();
        oFirma.ADRESI = txtAdres1.Text.Trim();
        oFirma.ADRESII = txtAdres2.Text.Trim();
        oFirma.IL_ILCE = txtIlce.Text.Trim();
        oFirma.TELEFON = txtTelefon.Text.Trim();
        oFirma.FAX = txtFax.Text.Trim();
        oFirma.ILGILI = txtIlgili.Text.Trim();
        oFirma.EMAIL = txtEmail.Text.Trim();
        oFirma.NOTLAR = txtNotlar.Text.Trim();
        oFirma.FATADRES = txtFatAdresi.Text.Trim();
        oFirma.VERGIDAIRESI = txtVergiDairesi.Text.Trim();
        oFirma.VERGINO = txtVergiNo.Text.Trim();
        oFirma.BOLGEKODU = (short)BolgeKodu;
        oFirma.KAMUFIRMASI = chkKamufirması.Checked;
        oFirma.TSEBELGELI = chkTseBelgeli.Checked;
        KalData.AddTofirma(oFirma);

        firmaChild ofirmaChild = new firmaChild();
        ofirmaChild.AnneFirmaFirmaId = int.Parse(Session["ChildFirmaIcingidecekFirmaId"].ToString());
        ofirmaChild.ChildFirmaId = SiradakiFirmaId;
        KalData.AddTofirmaChild(ofirmaChild);
        KalData.SaveChanges();
    }
 /// <summary>
 /// Deprecated Method for adding a new object to the firmaChild EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTofirmaChild(firmaChild firmaChild)
 {
     base.AddObject("firmaChild", firmaChild);
 }
 /// <summary>
 /// Create a new firmaChild object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="anneFirmaFirmaId">Initial value of the AnneFirmaFirmaId property.</param>
 /// <param name="childFirmaId">Initial value of the ChildFirmaId property.</param>
 public static firmaChild CreatefirmaChild(global::System.Int32 id, global::System.Int32 anneFirmaFirmaId, global::System.Int32 childFirmaId)
 {
     firmaChild firmaChild = new firmaChild();
     firmaChild.Id = id;
     firmaChild.AnneFirmaFirmaId = anneFirmaFirmaId;
     firmaChild.ChildFirmaId = childFirmaId;
     return firmaChild;
 }