Esempio n. 1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (listGuideChoose.Count > 0)
     {
         if (TestPrice())
         {
             current.TrangThai = cbbStatus.SelectedItem.ToString() == "Đang mở" ? 1 : cbbStatus.SelectedItem.ToString() == "Đã đóng" ? 0 : -1;
             current.MTour     = (cbbTours.SelectedItem as Tour).ID;
             current.NgayDi    = dtpStart.Value;
             current.NgayVe    = dtpEnd.Value;
             current.Gia       = MyConvert.ToDouble(txtPrice.Text);
             if (Chuyen.Update(current))
             {
                 MessageBox.Show("Updating is sucessful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 this.DialogResult = System.Windows.Forms.DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("Updating had been failse!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             return;
         }
     }
     MessageBox.Show("You need choose the guiders!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
Esempio n. 2
0
        private void UpdateStatus()
        {
            List <Chuyen> list = listTrip.FindAll(
                delegate(Chuyen t)
            {
                return(t.TrangThai == 1 && t.NgayDi >= DateTime.Now);
            });

            if (list.Count > 0)
            {
                foreach (Chuyen item in list)
                {
                    item.TrangThai = 0;
                    if (!Chuyen.Update(item))
                    {
                        DialogResult dlg = MessageBox.Show(String.Format("Updating had been failse at the trip which has code {0}! Do you want to be Updeting?", item.MChuyen), "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                        if (dlg == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                    }
                }
                MessageBox.Show("Updating is sucessful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }