private void NhapDuLieuVaoTruyenDi(int rowPosition)
        {
            grdCuocSanBayDuongDai.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo = (Taxi.Business.CheckCoDuongDai.CheckCoDuongDai)((GridEXSelectedItem)
                                                                                                                       grdCuocSanBayDuongDai.SelectedItems[0]).GetRow().DataRow;

            if (grdCuocSanBayDuongDai.SelectedItems.Count > 0)
            {
                if (DateTime.Now.AddHours(-24) <= objCheckCo.NgayTao)
                {
                    ThongTinSanBay_DuongDai frmSanBayDuongDai = new ThongTinSanBay_DuongDai(objCheckCo, G_arrProvince, G_arrDistrict, G_arrCommune);
                    DialogResult            diaResult         = frmSanBayDuongDai.ShowDialog();
                    if (diaResult == DialogResult.OK)
                    {
                        LoadDSCuoc();
                    }
                }
                else if (ThongTinDangNhap.USER_ID == "admin" || ThongTinDangNhap.IsInRole("TC") || ThongTinDangNhap.IsInRole("GD"))
                {
                    ThongTinSanBay_DuongDai frmSanBayDuongDai = new ThongTinSanBay_DuongDai(objCheckCo, G_arrProvince, G_arrDistrict, G_arrCommune);
                    DialogResult            diaResult         = frmSanBayDuongDai.ShowDialog();
                    if (diaResult == DialogResult.OK)
                    {
                        LoadDSCuoc();
                    }
                }
                else
                {
                    MessageBox.Show("Bạn chỉ có thể sửa dữ liệu trong vòng 24h");
                }
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            int thoiGian;

            if (cbThoiGian.SelectedIndex < 0)
            {
                thoiGian = 0;
            }
            else
            {
                thoiGian = int.Parse(cbThoiGian.SelectedValue.ToString());
            }
            int gara;

            if (cbGara.SelectedIndex < 0)
            {
                gara = 0;
            }
            else
            {
                gara = int.Parse(cbGara.SelectedValue.ToString());
            }
            List <Taxi.Business.CheckCoDuongDai.CheckCoDuongDai> lstCheckCo = new Taxi.Business.CheckCoDuongDai.CheckCoDuongDai().GetDSCuocDuongDaiSanBay_Gara(txtSoHieuXe.Text.Trim(), thoiGian, gara);

            grdCuocSanBayDuongDai.DataMember = "SanBayDuongDai";
            grdCuocSanBayDuongDai.SetDataBinding(lstCheckCo, "SanBayDuongDai");
        }
 public void btnDelete_Click(object sender, EventArgs e)
 {
     if (ThongTinDangNhap.USER_ID == "admin" || ThongTinDangNhap.IsInRole("TC") || ThongTinDangNhap.IsInRole("GD"))
     {
         if (new MessageBox.MessageBoxBA().Show("Bạn có muốn xóa không ?", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.YesNo, Taxi.MessageBox.MessageBoxIconBA.Question) == "Yes")
         {
             Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo = new Taxi.Business.CheckCoDuongDai.CheckCoDuongDai();
             if (objCheckCo.DeleteCheckCo(int.Parse(lbID.Text), ThongTinDangNhap.USER_ID) > 0)
             {
                 new MessageBox.MessageBoxBA().Show("Xóa thông tin thành công", "Thông báo",
                                                    Taxi.MessageBox.MessageBoxButtonsBA.OK,
                                                    Taxi.MessageBox.MessageBoxIconBA.Information);
                 isSuccess = true;
             }
             else
             {
                 new MessageBox.MessageBoxBA().Show("Xóa thông tin lỗi", "Thông báo",
                                                    Taxi.MessageBox.MessageBoxButtonsBA.OK,
                                                    Taxi.MessageBox.MessageBoxIconBA.Error);
             }
         }
     }
     else
     {
         new MessageBox.MessageBoxBA().Show("Bạn không có quyền xóa dữ liệu", "Thông báo",
                                            MessageBox.MessageBoxButtonsBA.OK,
                                            MessageBox.MessageBoxIconBA.Error);
     }
 }
 public ThongTinSanBay_DuongDai(Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo, List <Province> arrProvince, List <District> arrDistrict, List <Commune> arrCommune)
 {
     InitializeComponent();
     checkCoDuongDai1.G_arrCommune  = arrCommune;
     checkCoDuongDai1.G_arrDistrict = arrDistrict;
     checkCoDuongDai1.G_arrProvince = arrProvince;
     G_objCheckCo = objCheckCo;
     isUpdate     = true;
     checkCoDuongDai1.isInsert = false;
 }
예제 #5
0
 public int DuyetChecCo(CheckCoDuongDai objCheckCo, string nguoiSua, bool trangThaiDuyet)
 {
     try
     {
         int result = new Data.CheckCoDuongDai.CheckCoDuongDai().DuyetChecCo(objCheckCo.ID, nguoiSua, trangThaiDuyet);
         return(result);
     }
     catch (Exception ex)
     {
         new MessageBox.MessageBoxBA().Show(ex.ToString());
         return(0);
     }
 }
 /// <summary>
 /// hàm thực hiện validate thông tin form nhập
 /// co cuoc goi truyen vao
 /// </summary>
 private BangMaValidate ValidateFormNhap(Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo)
 {
     if (txtSoHieuXe.Text.Length <= 0)
     {
         txtSoHieuXe.Focus();
         return(BangMaValidate.Msg1);
     }
     if (objCheckCo.CheckSoHieuXe(txtSoHieuXe.Text) == false)
     {
         txtSoHieuXe.Focus();
         return(BangMaValidate.Msg2);
     }
     if (txtCoDau.Text.Length <= 0)
     {
         txtCoDau.Focus();
         return(BangMaValidate.Msg4);
     }
     if (cbThoiDiemDon.DateTime > cbThoiDiemTra.DateTime)
     {
         cbThoiDiemDon.Focus();
         return(BangMaValidate.Msg8);
     }
     //Vạn An Hải Phòng không cần nhập tỉnh thành phố sân bay đường dài!
     //else if (cbTinh_Di.SelectedValue == null || cbTinh_Di.SelectedIndex == 0)
     //{
     //    return BangMaValidate.Msg6;
     //}
     //else if (cbTinh_Den.SelectedValue == null || cbTinh_Den.SelectedIndex == 0)
     //{
     //    return BangMaValidate.Msg6;
     //}
     //else if (txtDienThoai.Text.Trim() == "")
     //{
     //    return BangMaValidate.Msg7;
     //}
     else
     {
         return(BangMaValidate.ValidateSuccess);
     }
 }
        public void SetValue(Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo)
        {
            if (objCheckCo == null)
            {
                return;
            }
            ValidatePermission();

            lbID.Text        = objCheckCo.ID.ToString();
            txtSoHieuXe.Text = objCheckCo.SoHieuXe;
            txtNoiDi.Text    = objCheckCo.NoiDi;
            txtNoiDen.Text   = objCheckCo.NoiDen;
            txtCoDau.Text    = objCheckCo.CoDau.ToString();
            txtCoCuoi.Text   = objCheckCo.CoCuoi.ToString();

            if (objCheckCo.ThoiDiemDi == DateTime.Parse("01/01/1900 00:00:00"))
            {
                cbThoiDiemDon.EditValue = CommonBL.GetTimeServer().Date;
            }
            else
            {
                cbThoiDiemDon.EditValue = objCheckCo.ThoiDiemDi;
            }

            if (objCheckCo.ThoiDiemVe == DateTime.Parse("01/01/1900 00:00:00") || objCheckCo.ThoiDiemVe == DateTime.Parse("01/01/0001 00:00:00"))
            {
                cbThoiDiemTra.EditValue = CommonBL.GetTimeServer().Date;
            }
            else
            {
                cbThoiDiemTra.EditValue = objCheckCo.ThoiDiemVe;
            }

            cbTinh_Den.SelectedValue = objCheckCo.TinhThanhDenID;
            if (objCheckCo.ChieuDi == "Một chiều")
            {
                chkMotChieu.Checked = true;
                chkHaiChieu.Checked = false;
            }
            else
            {
                chkHaiChieu.Checked = true;
                chkMotChieu.Checked = false;
            }
            txtTongTien.Text             = objCheckCo.TongTien.ToString();
            txtGhiChu.Text               = objCheckCo.GhiChu;
            txtDienThoai.Text            = objCheckCo.SoDienThoai;
            txtTenLaiXe.Text             = objCheckCo.TenLaiXe;
            chkChiaSe.Checked            = objCheckCo.isChiaSeChuyenDi;
            cb_PhuongXaDi.SelectedValue  = objCheckCo.FK_PhuongXaDiID;
            cb_PhuongXaDen.SelectedValue = objCheckCo.FK_PhuongXaDenID;
            cbQH_Di.SelectedValue        = objCheckCo.FK_QuanHuyenDiID;
            cbQH_Den.SelectedValue       = objCheckCo.FK_QuanHuyenDenID;
            cbTinh_Di.SelectedValue      = objCheckCo.FK_TinhThanhDiID;
            if (objCheckCo.NguoiDuyet != null)
            {
                G_isDaDuyet = true;
                if (objCheckCo.TrangThaiDuyet == true)
                {
                    cbDuyet.SelectedIndex = 2;
                }
                else
                {
                    cbDuyet.SelectedIndex = 1;
                }
            }
            else
            {
                G_isDaDuyet           = false;
                cbDuyet.SelectedIndex = 0;
            }

            btnDelete.Visible = true;
        }
        public void UpdateCheckCo()
        {
            Taxi.Business.CheckCoDuongDai.CheckCoDuongDai objCheckCo = new Taxi.Business.CheckCoDuongDai.CheckCoDuongDai();

            BangMaValidate maValidate = ValidateFormNhap(objCheckCo);

            HienThiThongBao(maValidate);
            if (maValidate == BangMaValidate.ValidateSuccess)
            {
                bool TrangThaiDuyet = false;
                if (cbDuyet.SelectedIndex == 1)
                {
                    TrangThaiDuyet = false;
                }
                else
                {
                    TrangThaiDuyet = true;
                }
                int   coCuoi   = 0;
                float tongTien = 0;
                bool  chieuDi  = true;
                if (txtTongTien.Text == string.Empty)
                {
                    tongTien = 0;
                }
                else
                {
                    try { tongTien = float.Parse(txtTongTien.Text); }
                    catch { tongTien = 0; }
                }
                if (txtCoCuoi.Text == string.Empty)
                {
                    coCuoi = 0;
                }
                else
                {
                    try { coCuoi = int.Parse(txtCoCuoi.Text); }
                    catch { coCuoi = 0; }
                }
                if (chkMotChieu.Checked)
                {
                    chieuDi = true;
                }
                else
                {
                    chieuDi = false;
                }
                int    TinhThanhDiID  = 0;
                int    QuanHuyenDiID  = 0;
                int    QuanHuyenDenID = 0;
                int    PhuongXaDiID   = 0;
                int    PhuongXaDenID  = 0;
                bool   isChiaSe       = chkChiaSe.Checked;
                string TenLaiXe       = txtTenLaiXe.Text.Trim();

                if (cbTinh_Di.SelectedIndex > 0)
                {
                    TinhThanhDiID = (int)cbTinh_Di.SelectedValue;
                }
                if (cbQH_Di.SelectedIndex > 0)
                {
                    QuanHuyenDiID = (int)cbQH_Di.SelectedValue;
                }
                if (cbQH_Den.SelectedIndex > 0)
                {
                    QuanHuyenDenID = (int)cbQH_Den.SelectedValue;
                }
                if (cb_PhuongXaDi.SelectedIndex > 0)
                {
                    PhuongXaDiID = (int)cb_PhuongXaDi.SelectedValue;
                }
                if (cb_PhuongXaDen.SelectedIndex > 0)
                {
                    PhuongXaDenID = (int)cb_PhuongXaDen.SelectedValue;
                }
                DateTime ThoiDiemTra = DateTime.MinValue;
                if (cbThoiDiemTra.Text != "")
                {
                    ThoiDiemTra = cbThoiDiemTra.DateTime;
                }


                if (objCheckCo.UpdateCheckCo(int.Parse(lbID.Text), txtSoHieuXe.Text, txtNoiDi.Text.ToUpperInvariant(), txtNoiDen.Text.ToUpperInvariant(),
                                             Convert.ToInt32(cbTinh_Den.SelectedValue), int.Parse(txtCoDau.Text), coCuoi,
                                             cbThoiDiemDon.DateTime, ThoiDiemTra, chieuDi, tongTien, txtGhiChu.Text, ThongTinDangNhap.USER_ID
                                             , TinhThanhDiID, QuanHuyenDiID, QuanHuyenDenID, PhuongXaDiID, PhuongXaDenID, TenLaiXe, txtDienThoai.Text.Trim(), isChiaSe, TrangThaiDuyet, G_isDaDuyet
                                             ) > 0)
                {
                    new MessageBox.MessageBoxBA().Show("Cập nhật thông tin thành công", "Thông báo",
                                                       Taxi.MessageBox.MessageBoxButtonsBA.OK,
                                                       Taxi.MessageBox.MessageBoxIconBA.Information);
                    G_isDaDuyet = true;
                    isSuccess   = true;
                }
                else
                {
                    new MessageBox.MessageBoxBA().Show("Cập nhật thông tin lỗi", "Thông báo",
                                                       Taxi.MessageBox.MessageBoxButtonsBA.OK,
                                                       Taxi.MessageBox.MessageBoxIconBA.Error);
                }
            }
        }
예제 #9
0
        public CheckCoDuongDai GetDSCheckCoDuongDai(DataRow drCheckCo)
        {
            CheckCoDuongDai objCheckCo = new CheckCoDuongDai();

            objCheckCo.ID       = Convert.ToInt32(drCheckCo["ID"]);
            objCheckCo.SoHieuXe = drCheckCo["FK_SoHieuXe"].ToString();
            objCheckCo.NoiDi    = drCheckCo["DiaDiemDi"].ToString();
            objCheckCo.NoiDen   = drCheckCo["DiaDiemDen"].ToString();
            if (!drCheckCo["FK_TinhThanhDenID"].ToString().Equals(""))
            {
                objCheckCo.TinhThanhDenID = (int)(drCheckCo["FK_TinhThanhDenID"]);
            }
            objCheckCo.CoDau            = Convert.ToInt32(drCheckCo["CoDau"]);
            objCheckCo.CoCuoi           = Convert.ToInt32(drCheckCo["CoCuoi"]);
            objCheckCo.ThoiDiemDi       = drCheckCo["ThoiDiemDi"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(drCheckCo["ThoiDiemDi"]);
            objCheckCo.ThoiDiemVe       = drCheckCo["ThoiDiemVe"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(drCheckCo["ThoiDiemVe"]);
            objCheckCo.ChieuDi          = drCheckCo["Is1Chieu"] == DBNull.Value || Convert.ToBoolean(drCheckCo["Is1Chieu"]) == false  ? "Hai chiều" : "Một chiều";
            objCheckCo.TongTien         = float.Parse(drCheckCo["TongTien"].ToString());
            objCheckCo.GhiChu           = drCheckCo["GhiChu"].ToString();
            objCheckCo.NgayTao          = Convert.ToDateTime(drCheckCo["CreatedDate"]);
            objCheckCo.NguoiTao         = drCheckCo["CreatedByUser"].ToString();
            objCheckCo.NgaySua          = drCheckCo["UpdatedDate"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(drCheckCo["UpdatedDate"]);
            objCheckCo.NguoiSua         = drCheckCo["UpdatedByUser"].ToString();
            objCheckCo.Gara             = drCheckCo["Gara"].ToString();
            objCheckCo.TenLaiXe         = drCheckCo["TenLaiXe"].ToString();
            objCheckCo.SoDienThoai      = drCheckCo["SoDienThoai"].ToString();
            objCheckCo.isChiaSeChuyenDi = drCheckCo["isChiaSeChuyenDi"] != DBNull.Value && Convert.ToBoolean(drCheckCo["isChiaSeChuyenDi"]);
            if (drCheckCo["TrangThaiDuyet"] != DBNull.Value)
            {
                objCheckCo.TrangThaiDuyet = Convert.ToBoolean(drCheckCo["TrangThaiDuyet"]);
                if (drCheckCo["ThoiDiemDuyet"] != DBNull.Value)
                {
                    objCheckCo.ThoiDiemDuyet = Convert.ToDateTime(drCheckCo["ThoiDiemDuyet"]);
                }
                objCheckCo.NguoiDuyet = drCheckCo["NguoiDuyet"].ToString();
            }

            //objCheckCo.TinhThanhDen = drCheckCo["TinhThanhDen"].ToString();
            //objCheckCo.TinhThanhDi = drCheckCo["TinhThanhDi"].ToString();

            if (!drCheckCo["FK_TinhThanhDiID"].ToString().Equals(""))
            {
                objCheckCo.FK_TinhThanhDiID = (int)(drCheckCo["FK_TinhThanhDiID"]);
            }
            if (!drCheckCo["FK_QuanHuyenDenID"].ToString().Equals(""))
            {
                objCheckCo.FK_QuanHuyenDenID = (int)(drCheckCo["FK_QuanHuyenDenID"]);
            }
            if (!drCheckCo["FK_QuanHuyenDiID"].ToString().Equals(""))
            {
                objCheckCo.FK_QuanHuyenDiID = (int)(drCheckCo["FK_QuanHuyenDiID"]);
            }
            if (!drCheckCo["FK_PhuongXaDenID"].ToString().Equals(""))
            {
                objCheckCo.FK_PhuongXaDenID = (int)(drCheckCo["FK_PhuongXaDenID"]);
            }
            if (!drCheckCo["FK_PhuongXaDiID"].ToString().Equals(""))
            {
                objCheckCo.FK_PhuongXaDiID = (int)(drCheckCo["FK_PhuongXaDiID"]);
            }

            return(objCheckCo);
        }