예제 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TankFixOperations EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTankFixOperations(TankFixOperation tankFixOperation)
 {
     base.AddObject("TankFixOperations", tankFixOperation);
 }
예제 #2
0
파일: TabkFix.cs 프로젝트: ranyaof/ongaz
        private void btnOpenTank_Click(object sender, EventArgs e)
        {
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                TankFixOperation newtankfixoperationrecord = new TankFixOperation();

                newtankfixoperationrecord.tankID = tanktofix.Id;
                 db.TankFixOperations.Where(x=>x.tankID == tanktofix.Id ).ToList().ForEach(db.TankFixOperations.DeleteObject);
                 db.SaveChanges();
                List<TankFixOperation> _opList = new List<TankFixOperation>();
                foreach (ListViewItem item in Listview1.mobjListView.Items)
                    {
                        TankFixOperation row = new TankFixOperation();
                        row.tankID = tanktofix.Id;
                    //ITERATE THROUGHT listview and save values to database tankFixoperation
                        if (!string.IsNullOrEmpty(item.SubItems[1].ToString()))
                        {
                            row.amount = Convert.ToInt32(item.SubItems[1].ToString());
                        }
                        if (!string.IsNullOrEmpty(item.SubItems[0].ToString()))
                        {
                            row.title = item.SubItems[0].ToString();
                        }
                        if (!string.IsNullOrEmpty(item.SubItems[2].ToString()))
                        {
                            row.date = Convert.ToDateTime(item.SubItems[2].ToString());
                        }
                        else
                        {
                            row.date = null;
                        }
                        if (!string.IsNullOrEmpty(item.SubItems[3].ToString()))
                        {
                            row.note = item.SubItems[3].ToString();
                        }

                        _opList.Add(row);
                        db.AddToTankFixOperations(row);
                  //      MessageBox.Show("Title" + item.SubItems[0].ToString());

                    }
                // הסתיים שיפוץ אזי יופיע במלאי
                tanktofix.TankSystemStatus = "3";

                db.Tank_Stocks.Attach(tanktofix);
                db.ObjectStateManager.ChangeObjectState(tanktofix, EntityState.Modified);
                 // db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == textBox1.Text)
                //Tank_Stocks newrecord = new Tank_Stocks();
                //newrecord.TankNumber = txtorderingName.Text;
                //newrecord.type = comboBox1.SelectedIndex.ToString();
                //newrecord.Datetime = dateTimePicker1.Value;
            //this is a status of fixing progress

               // newrecord.TankSystemStatus = "3";

                if (db.SaveChanges() > 0)
                {
                    MessageBox.Show("פעולת ההוספה הצליחה");
                 //   btnOpenTank.Enabled = false;

                }
                else
                {

                }
            }
        }
예제 #3
0
 /// <summary>
 /// Create a new TankFixOperation object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static TankFixOperation CreateTankFixOperation(global::System.Int32 id)
 {
     TankFixOperation tankFixOperation = new TankFixOperation();
     tankFixOperation.id = id;
     return tankFixOperation;
 }