コード例 #1
0
        /// <summary>
        /// Create a new ORDER object.
        /// </summary>
        /// <param name="oRDERID">Initial value of the ORDERID property.</param>
        /// <param name="dATA">Initial value of the DATA property.</param>
        /// <param name="cUSTOMERID">Initial value of the CUSTOMERID property.</param>
        public static ORDER CreateORDER(global::System.Int16 oRDERID, global::System.DateTime dATA, global::System.Int16 cUSTOMERID)
        {
            ORDER oRDER = new ORDER();

            oRDER.ORDERID    = oRDERID;
            oRDER.DATA       = dATA;
            oRDER.CUSTOMERID = cUSTOMERID;
            return(oRDER);
        }
コード例 #2
0
 private void button_update_Click(object sender, EventArgs e)
 {
     try
     {
         using (var db = new TestContext())
         {
             ORDER c = db.ORDERs.First(i => i.CUSTOMERID == Convert.ToInt16(this.textBox2.Text));
             c.DATA    = Convert.ToDateTime(this.textBox1.Text);
             c.VALOARE = Convert.ToDecimal(this.textBox3.Text);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Obiectul nu a putut fi updatat! " + ex.InnerException);
     }
     this.Close();
 }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (TestContext db = new TestContext())
                {
                    ORDER r = new ORDER
                    {
                        DATA       = Convert.ToDateTime(this.textBox1.Text),
                        CUSTOMERID = Convert.ToInt16(this.textBox2.Text),
                        VALOARE    = Convert.ToDecimal(this.textBox3.Text)
                    };

                    db.ORDERs.AddObject(r);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Obiectul nu a putut fi adaugat! " + ex.InnerException);
            }
            this.Close();
        }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ORDERs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToORDERs(ORDER oRDER)
 {
     base.AddObject("ORDERs", oRDER);
 }