Esempio n. 1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     DTO.Chuyen chuyen = InsertToDTO();
     BUS_Chuyen.Instance.Chuyen_ThemChuyen(chuyen);
     LoadFrom();
     frmMain.Chuyen_LoadFrom();
 }
Esempio n. 2
0
        private DTO.Chuyen InsertToDTO()
        {
            DTO.Chuyen chuyen = new DTO.Chuyen();
            chuyen.ID      = Convert.ToInt32(txtMaChuyen.Text);
            chuyen.IDTaiXe = Convert.ToInt32(txtIDTaiXe.Text);
            chuyen.IDTuyen = Convert.ToInt32(txtIDTuyen.Text);
            chuyen.IdXe    = Convert.ToInt32(txtIDXe.Text);
            DateTime dt = dtpGioKhoiHanh.Value;

            chuyen.GioKhoiHanh  = dt.ToString("HH:mm");
            chuyen.NgayKhoiHanh = Convert.ToDateTime(dtpNgayKhoiHanh.Value);
            chuyen.GhiChi       = txtGhiChu.Text;
            return(chuyen);
        }
Esempio n. 3
0
        public void Chuyen_ThemChuyen(DTO.Chuyen chuyen)
        {
            DAO.DAO_Chuyen.Instance.ThemChuyen(chuyen);
            DataTable dt = DAO.DAO_Ghe.Instance.FillDGVGhe(chuyen.IdXe);

            DTO.Ve ve = new DTO.Ve();
            ve.IDChuyen = chuyen.ID;
            int kc = DAO.DAO_Tuyen.Instance.FindKhoangCach(chuyen.IDTuyen);

            ve.GiaTien  = kc * 1000;
            ve.NgayXuat = DateTime.Now;
            foreach (DataRow row in dt.Rows)
            {
                int idve = DAO.DAO_Ve.Instance.IdVeMax();
                idve++;
                ve.ID    = idve;
                ve.IDGhe = Convert.ToInt32(row["ID_Ghe"]);
                DAO.DAO_Ve.Instance.ThemVe(ve);
            }
        }
Esempio n. 4
0
        public void UpdateChuyen(DTO.Chuyen chuyen)
        {
            Provider p = new Provider();

            try
            {
                p.Connect();
                string strSql = "sp_UpdateChuyen";
                p.ExecuteNonQuery(CommandType.StoredProcedure, strSql,
                                  new SqlParameter {
                    ParameterName = "@ID", Value = chuyen.ID
                },
                                  new SqlParameter {
                    ParameterName = "@IdTuyen", Value = chuyen.IDTuyen
                },
                                  new SqlParameter {
                    ParameterName = "@NgayKhoiHanh", Value = chuyen.NgayKhoiHanh
                },
                                  new SqlParameter {
                    ParameterName = "@GioKhoiHanh", Value = chuyen.GioKhoiHanh
                },
                                  new SqlParameter {
                    ParameterName = "@GhiChu", Value = chuyen.GhiChi
                },
                                  new SqlParameter {
                    ParameterName = "@IdXe", Value = chuyen.IdXe
                },
                                  new SqlParameter {
                    ParameterName = "@IDTaiXe", Value = chuyen.IDTaiXe
                }
                                  );
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                p.Disconnect();
            }
        }
Esempio n. 5
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     DTO.Chuyen chuyen = InsertToDTO();
     DAO.DAO_Chuyen.Instance.UpdateChuyen(chuyen);
     frmMain.Chuyen_LoadFrom();
 }
Esempio n. 6
0
 public frm_SuaChuyen(frm_QuanLyChuyen main, DTO.Chuyen c)
 {
     InitializeComponent();
     frmMain = main;
     chuyen  = c;
 }