public void SetValue( CheckPoints aChekPoint)
 {
     this.ID = aChekPoint.ID;
     this.From = aChekPoint.From;
     this.To = aChekPoint.To;
     this.Type = aChekPoint.Type;
     this.Status = aChekPoint.Status;
     this.AddTime = aChekPoint.AddTime;
     this.Disable = aChekPoint.Disable;
 }
 //=======================================================
 //Author: LinhTing
 //Function : Them CheckPoints
 //=======================================================
 public int Insert(CheckPoints CheckPoints)
 {
     try
     {
         aDatabaseDA.CheckPoints.Add(CheckPoints);
         return aDatabaseDA.SaveChanges();
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("CheckPointsBO.Insert :" + ex.Message));
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            CheckPoints aCheckPoint = new CheckPoints();

            try
            {
                aCheckPoint.From = tetFrom.Time.TimeOfDay;
                aCheckPoint.To = tetTo.Time.TimeOfDay;

                double AddTime = 0;

                if(cbbAddTime.SelectedIndex == -1)
                {
                    AddTime = 0;
                }
                else if (cbbAddTime.SelectedIndex == 0)
                {
                    AddTime = 1;
                }
                else if (cbbAddTime.SelectedIndex == 1 )
                {
                    AddTime = 0.5;
                }

                aCheckPoint.AddTime = AddTime;
                aCheckPoint.Type = cbbType.SelectedIndex + 1;
                aCheckPoint.Status = cbbStatus.SelectedIndex + 1;
                aCheckPoint.Disable = Convert.ToBoolean(cbbDisable.Text);
                aCheckPointBO.Insert(aCheckPoint);

                MessageBox.Show("Thêm check point thành công");
                this.Close();
                if(this.frmCheckPoint_Old != null)
                {
                    this.frmCheckPoint_Old.ReloadData();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_CheckPoint.btnAdd_Click \n" + ex.Message);
            }
        }