Example #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         TestContext db = new TestContext();
         if (this.textBox1.Text != null)
         {
             ORDERDETAIL c = db.ORDERDETAILS.First(i => i.ORDERID == Convert.ToInt16(this.textBox1.Text));
             db.ORDERDETAILS.DeleteObject(c);
         }
         if (this.textBox2.Text != null)
         {
             ORDERDETAIL c = db.ORDERDETAILS.First(i => i.PRODUS == this.textBox2.Text);
             db.ORDERDETAILS.DeleteObject(c);
         }
         if (this.textBox3.Text != null)
         {
             ORDERDETAIL c = db.ORDERDETAILS.First(i => i.VALOARE == Convert.ToDecimal(this.textBox3.Text));
             db.ORDERDETAILS.DeleteObject(c);
         }
         if (this.textBox4.Text != null)
         {
             ORDERDETAIL c = db.ORDERDETAILS.First(i => i.SERIAL == Convert.ToInt16(this.textBox4.Text));
             db.ORDERDETAILS.DeleteObject(c);
         }
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Obiectul nu a putut fi sters! " + ex.InnerException);
     }
     this.Close();
 }
        /// <summary>
        /// Create a new ORDERDETAIL object.
        /// </summary>
        /// <param name="oRDERID">Initial value of the ORDERID property.</param>
        /// <param name="pRODUS">Initial value of the PRODUS property.</param>
        /// <param name="vALOARE">Initial value of the VALOARE property.</param>
        /// <param name="sERIAL">Initial value of the SERIAL property.</param>
        public static ORDERDETAIL CreateORDERDETAIL(global::System.Int16 oRDERID, global::System.String pRODUS, global::System.Decimal vALOARE, global::System.Int16 sERIAL)
        {
            ORDERDETAIL oRDERDETAIL = new ORDERDETAIL();

            oRDERDETAIL.ORDERID = oRDERID;
            oRDERDETAIL.PRODUS  = pRODUS;
            oRDERDETAIL.VALOARE = vALOARE;
            oRDERDETAIL.SERIAL  = sERIAL;
            return(oRDERDETAIL);
        }
Example #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         using (var db = new TestContext())
         {
             ORDERDETAIL c = db.ORDERDETAILS.First(i => i.ORDERID == Convert.ToInt16(this.textBox2.Text));
             c.PRODUS  = this.textBox1.Text;
             c.VALOARE = Convert.ToDecimal(this.textBox3.Text);
             c.SERIAL  = Convert.ToInt16(this.textBox4.Text);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Obiectul nu a putut fi updatat! " + ex.InnerException);
     }
     this.Close();
 }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (TestContext db = new TestContext())
                {
                    ORDERDETAIL r = new ORDERDETAIL
                    {
                        ORDERID = Convert.ToInt16(this.textBox1.Text),
                        PRODUS  = this.textBox2.Text,
                        VALOARE = Convert.ToDecimal(this.textBox3.Text),
                        SERIAL  = Convert.ToInt16(this.textBox4.Text)
                    };

                    db.ORDERDETAILS.AddObject(r);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Obiectul nu a putut fi adaugat! " + ex.InnerException);
            }
            this.Close();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the ORDERDETAILS EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToORDERDETAILS(ORDERDETAIL oRDERDETAIL)
 {
     base.AddObject("ORDERDETAILS", oRDERDETAIL);
 }