private void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                TiepQuyDAL.DV_INSERT_TIEPQUY(
                    DateTime.Now,
                    Thong_tin_dang_nhap.ma_cn,
                    Thong_tin_dang_nhap.maNV,
                    cbATMID.SelectedItem.ToString(),
                    soTo50,
                    soTo100,
                    soTo200,
                    soTo500
                    );
            }
            catch
            {
                ErrorMessageDAL.DataAccessError();
                return;
            }
            KhoiTaoTiepQuy();
            Thread th = new Thread(TaoFileTiepQuy);

            th.Start();
        }
Exemple #2
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     //Luu CSDL
     KhoiTaoKiemQuy();
     try
     {
         KiemQuyDAL.DV_INSERT_KIEMQUY(
             tuNgay,
             denNgay,
             cbATMID.SelectedItem.ToString(),
             tpKiemQuy,
             qtTienTHT,
             qtMonCHT,
             qtTienCHT,
             timeTCO,
             timeCO,
             timeCI,
             soDuTCO,
             soDuCO,
             soDuCI,
             txtGhiChuIPCAS1.Text,
             txtGhiChuIPCAS2.Text,
             txtGhiChuIPCAS3.Text,
             timeSC,
             timeCE,
             fimiSC50,
             fimiSC100,
             fimiSC200,
             fimiSC500,
             fimiCE50,
             fimiCE100,
             fimiCE200,
             fimiCE500,
             demB50,
             demB100,
             demB200,
             demB500,
             demCC50,
             demCC100,
             demCC200,
             demCC500,
             demCL50,
             demCL100,
             demCL200,
             demCL500,
             thuaThieu,
             txtNguyenNhan.Text,
             txtKhacPhuc.Text
             );
     }
     catch
     {
         ErrorMessageDAL.DataAccessError();
         return;
     }
     //Tao file
     TaoFileKiemQuy();
     //Thread th = new Thread(TaoFileKiemQuy);
     //th.Start();
 }
Exemple #3
0
 void DSTheTheoCMND()
 {
     try
     {
         DataTable dt = TheDAL.TheTheoCMND(txtThongTin.Text);
         FillData(dt);
     }
     catch
     {
         ErrorMessageDAL.DataAccessError();
     }
 }
Exemple #4
0
 void TatCaThe()
 {
     try
     {
         DataTable dt = TheDAL.TatCaThe(dtpTuNgay.Text, dtpDenNgay.Text);
         FillData(dt);
     }
     catch
     {
         ErrorMessageDAL.DataAccessError();
     }
 }
Exemple #5
0
 void DSTheDaGiao()
 {
     try
     {
         DataTable dt = TheDAL.TheDaGiao(dtpTuNgay.Text, dtpDenNgay.Text);
         FillData(dt);
     }
     catch
     {
         ErrorMessageDAL.DataAccessError();
     }
 }
Exemple #6
0
        private void btnDeleteThe_Click(object sender, EventArgs e)
        {
            string soThe   = dgvThongTinThe.SelectedRows[0].Cells[3].Value.ToString();
            string soTK    = dgvThongTinThe.SelectedRows[0].Cells[2].Value.ToString();
            string loaiThe = dgvThongTinThe.SelectedRows[0].Cells[4].Value.ToString();

            try
            {
                The the = new The(ThongTinTheDAL.LayThongTinThe(soTK, loaiThe));

                if (Thong_tin_dang_nhap.ma_pb != the.maPB)
                {
                    MessageBox.Show("Không có quyền xóa thẻ này!\nLiên hệ chi nhánh phát hành thẻ để được hỗ trợ!", "Thông báo", MessageBoxButtons.OK);
                    return;
                }
            }
            catch
            {
                ErrorMessageDAL.DataAccessError();
                return;
            }

            DialogResult result = MessageBox.Show("Có chắc chắn xóa thẻ này?", "Thông báo", MessageBoxButtons.YesNo);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    if (string.IsNullOrEmpty(soThe))
                    {
                        TheDAL.XoaThe_TheoSoTK_LoaiThe(soTK, loaiThe);
                    }
                    else
                    {
                        TheDAL.XoaThe_TheoSoThe(soThe);
                    }
                    MessageBox.Show("Xóa thẻ " + soThe + " thành công!", "Thông báo", MessageBoxButtons.OK);
                    if (tcrlQuanLyThe.SelectedIndex == 1)
                    {
                        TimKiem_TheoThongTin();
                    }
                    else
                    {
                        TimKiem_TheoNgay();
                    }
                }
                catch
                {
                    ErrorMessageDAL.DataAccessError();
                }
            }
        }
Exemple #7
0
        void LayTTCanBo()
        {
            users        = new List <User>();
            usersKiemQuy = new List <User>();

            try
            {
                DataTable dt = KiemQuyDAL.DV_DSNhanVien_MaCN(Thong_tin_dang_nhap.ma_cn);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var u = new User(dt.Rows[i]);
                    users.Add(u);
                    cbCanBo.Items.Add(u.tennv);
                }
            }
            catch
            {
                ErrorMessageDAL.DataAccessError();
            }
        }
 public frmThanhLapToVanChuyen()
 {
     InitializeComponent();
     listDich  = new List <string>();
     listNguon = new List <string>();
     users     = new List <User>();
     try
     {
         DataTable dt = KiemQuyDAL.DV_DSNhanVien_MaCN(Thong_tin_dang_nhap.ma_cn);
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             users.Add(new User(dt.Rows[i]));
             cbToTruong.Items.Add(users[i].tennv);
             cbGiamSat1.Items.Add(users[i].tennv);
             cbGiamSat2.Items.Add(users[i].tennv);
         }
     }
     catch
     {
         ErrorMessageDAL.DataAccessError();
     }
 }
Exemple #9
0
 public frmKiemQuy()
 {
     InitializeComponent();
     listNguon = new List <string>();
     listDich  = new List <string>();
     LayTTCanBo();
     try
     {
         DataTable dt = KiemQuyDAL.DV_ATM_MACN();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             cbATMID.Items.Add(dt.Rows[i]["ID"].ToString());
         }
         if (cbATMID.Items.Count > 0)
         {
             cbATMID.SelectedIndex = 0;
         }
     }
     catch
     {
         ErrorMessageDAL.DataAccessError();
     }
 }
Exemple #10
0
        public frmThongTinThe(string soTK, string loaiThe)
        {
            InitializeComponent();
            try
            {
                DataRow row = ThongTinTheDAL.LayThongTinThe(soTK, loaiThe);
                if (row != null)
                {
                    the = new The(row);
                }
                txtHoTen.Text   = the.hoTen;
                txtSoTK.Text    = the.soTK;
                txtSoThe.Text   = the.soThe;
                txtLoaiThe.Text = the.loaiThe;
                txtHangThe.Text = the.hangThe;
                txtHTPH.Text    = the.hinhThucPhatHanh;
                txtHTNT.Text    = the.hinhThucNhanThe;
                txtDTDD.Text    = the.dtdd;
                txtUser.Text    = the.userPhatHanh;

                DataRow rPb = ThongTinTheDAL.LayPhongBan(the.maPB);
                if (!(bool)rPb["HS"])
                {
                    txtNoiPhatHanh.Text = rPb["TENPB"].ToString();
                }
                else
                {
                    txtNoiPhatHanh.Text = ThongTinTheDAL.LayTenChiNhanh(the.maPB);
                }

                if (the.maPB != Thong_tin_dang_nhap.ma_pb)
                {
                    btnLuu.Enabled = false;
                }

                if (the.hmgd != 0)
                {
                    txtHMGD.Text = the.hmgd.ToString();
                }
                txtNgayDangKy.Text = the.ngayDK.ToString("dd/MM/yyyy");
                if (the.ngayNhan == DateTime.MinValue)
                {
                    txtNgayNhanThe.Text = "";
                }
                else
                {
                    txtNgayNhanThe.Text = the.ngayNhan.ToString("dd/MM/yyyy");
                }
                if (the.ngayGiao == DateTime.MinValue)
                {
                    txtNgayGiaoThe.Text = "";
                }
                else
                {
                    txtNgayGiaoThe.Text = the.ngayGiao.ToString("dd/MM/yyyy");
                }

                if (!string.IsNullOrEmpty(txtDTDD.Text))
                {
                    ckbSMS.Checked = true;
                }

                if (!string.IsNullOrEmpty(txtHMGD.Text))
                {
                    ckbInternet.Checked = true;
                }

                if (the.baoHiem)
                {
                    ckbBaoHiem.Checked = true;
                }

                var txts  = GetAll(this, typeof(TextBox));
                var txtms = GetAll(this, typeof(MaskedTextBox));

                foreach (var c in txts)
                {
                    if (!string.IsNullOrEmpty(c.Text))
                    {
                        c.Enabled = false;
                    }
                }

                foreach (var c in txtms)
                {
                    if (c.Text != "  /  /")
                    {
                        c.Enabled = false;
                    }
                }
            }
            catch
            {
                ErrorMessageDAL.DataAccessError();
                this.Close();
            }
        }
Exemple #11
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSoThe.Text))
            {
                MessageBox.Show("Hãy nhập số thẻ!", "Thông báo", MessageBoxButtons.OK);
                txtSoThe.Focus();
                return;
            }
            else
            {
                the.soThe = txtSoThe.Text;
            }

            //Check ngay nhan
            if (CommonMethods.KiemTraNhapNgay(txtNgayNhanThe.Text))
            {
                the.ngayNhan = DateTime.ParseExact(txtNgayNhanThe.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            else
            {
                if (txtNgayGiaoThe.Text != "  /  /")
                {
                    MessageBox.Show("Nhập sai định dạng ngày tháng!", "Thông báo", MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show("Hãy nhập ngày nhận thẻ!", "Thông báo", MessageBoxButtons.OK);
                }
                txtNgayNhanThe.Focus();
                return;
            }

            //check ngay giao
            if (CommonMethods.KiemTraNhapNgay(txtNgayGiaoThe.Text))
            {
                the.ngayGiao = DateTime.ParseExact(txtNgayGiaoThe.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                try
                {
                    ThongTinTheDAL.GiaoThe(the);
                    this.Close();
                }
                catch
                {
                    ErrorMessageDAL.DataAccessError();
                }
            }
            else
            {
                if (txtNgayGiaoThe.Text != "  /  /")
                {
                    MessageBox.Show("Nhập sai định dạng ngày tháng!", "Thông báo", MessageBoxButtons.OK);
                    txtNgayGiaoThe.Focus();
                    return;
                }
                try
                {
                    ThongTinTheDAL.NhanThe(the);
                    this.Close();
                }
                catch
                {
                    ErrorMessageDAL.DataAccessError();
                }
            }
        }
        //public Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
        //string curVersion = Application.ProductVersion;
        private bool Kiemtracapnhat()
        {
            bool   has_update = false;
            string newVersion = "";

            // in newVersion variable we will store the
            // version info from xml file
            //Version newVersion = null;
            // and in this variable we will put the url we
            // would like to open so that the user can
            // download the new version
            // it can be a homepage or a direct
            // link to zip/exe file
            //string url = "";
            //XmlTextReader reader = null;
            try
            {
                // provide the XmlTextReader with the URL of
                // our xml document
                //string xmlURL = "http://192.168.1.150/update_crm.xml";
                ////string xmlURL = "http://10.14.0.30/update_crm.xml";
                //reader = new XmlTextReader(xmlURL);
                //// simply (and easily) skip the junk at the beginning
                //reader.MoveToContent();
                //// internal - as the XmlTextReader moves only
                //// forward, we save current xml element name
                //// in elementName variable. When we parse a
                //// text node, we refer to elementName to check
                //// what was the node name
                //string elementName = "";
                //// we check if the xml starts with a proper
                //// "ourfancyapp" element node
                //if ((reader.NodeType == XmlNodeType.Element) &&
                //    (reader.Name == "bss"))
                //{
                //    while (reader.Read())
                //    {
                //        // when we find an element node,
                //        // we remember its name
                //        if (reader.NodeType == XmlNodeType.Element)
                //            elementName = reader.Name;
                //        else
                //        {
                //            // for text nodes...
                //            if ((reader.NodeType == XmlNodeType.Text) &&
                //                (reader.HasValue))
                //            {
                //                // we check what the name of the node was
                //                switch (elementName)
                //                {
                //                    case "version":
                //                        // thats why we keep the version info
                //                        // in xxx.xxx.xxx.xxx format
                //                        // the Version class does the
                //                        // parsing for us
                //                        newVersion = new Version(reader.Value);
                //                        break;
                //                    case "url":
                //                        url = reader.Value;
                //                        break;
                //                }
                //            }
                //        }
                //    }
                //}

                newVersion = DangNhapDAL.DV_GET_CURRENT_APP_VERSION(Application.ProductName);
                //newVersion = new Version(newV);
            }
            catch (Exception)
            {
                ErrorMessageDAL.DataAccessError();
            }
            //finally
            //{
            //    //if (reader != null) reader.Close();
            //}

            if (curVersion.CompareTo(newVersion) < 0)
            {
                // ask the user if he would like
                // to download the new version
                string title    = "Thông báo cập nhật";
                string question = "Phiên bản bạn đang dùng " + curVersion.ToString() + ". Đã có phiên bản mới " + newVersion.ToString() + ". Bạn có muốn tải về?";
                if (DialogResult.Yes ==
                    MessageBox.Show(this, question, title,
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question))
                {
                    // navigate the default web
                    // browser to our app
                    // homepage (the url
                    // comes from the xml content)

                    //System.Diagnostics.Process.Start(url);
                    Process.Start(Application.StartupPath.ToString() + @"\BSS_UPDATE.exe");
                    has_update = true;
                }
            }
            return(has_update);
        }
        void KhoiTaoTiepQuy()
        {
            listNguon.Clear();
            listDich.Clear();

            //TT CHUNG
            listDich.Add("<CHI_NHANH>");
            listNguon.Add(Thong_tin_dang_nhap.ten_cn.ToUpper());
            listDich.Add("<KINH_GUI>");
            listNguon.Add("Giám đốc " + Thong_tin_dang_nhap.ten_cn);
            listDich.Add("<NGAY>");
            listNguon.Add(DateTime.Now.Day.ToString());
            listDich.Add("<THANG>");
            listNguon.Add(DateTime.Now.Month.ToString());
            listDich.Add("<NAM>");
            listNguon.Add(DateTime.Now.Year.ToString());

            listDich.Add("<ATM_ID>");
            listNguon.Add(cbATMID.SelectedItem.ToString());
            listDich.Add("<DIA_DIEM_ATM>");
            try
            {
                listNguon.Add(TiepQuyDAL.DV_GET_DIADIEM_ATM(cbATMID.SelectedItem.ToString()));
            }
            catch
            {
                ErrorMessageDAL.DataAccessError();
                return;
            }

            listDich.Add("<NGUOI_DE_NGHI>");
            listNguon.Add(txtTenCanBo.Text);

            listDich.Add("<PHONG>");
            listNguon.Add(Thong_tin_dang_nhap.tenPb + "" + Thong_tin_dang_nhap.ten_cn);

            //So to tiep quy
            listDich.Add("<SO_TO_50>");
            listNguon.Add(CommonMethods.ThemDauPhay(soTo50.ToString()));
            listDich.Add("<SO_TO_100>");
            listNguon.Add(CommonMethods.ThemDauPhay(soTo100.ToString()));
            listDich.Add("<SO_TO_200>");
            listNguon.Add(CommonMethods.ThemDauPhay(soTo200.ToString()));
            listDich.Add("<SO_TO_500>");
            listNguon.Add(CommonMethods.ThemDauPhay(soTo500.ToString()));

            listDich.Add("<THANH_TIEN_50>");
            listNguon.Add(CommonMethods.ThemDauPhay(tt50.ToString()));
            listDich.Add("<THANH_TIEN_100>");
            listNguon.Add(CommonMethods.ThemDauPhay(tt100.ToString()));
            listDich.Add("<THANH_TIEN_200>");
            listNguon.Add(CommonMethods.ThemDauPhay(tt200.ToString()));
            listDich.Add("<THANH_TIEN_500>");
            listNguon.Add(CommonMethods.ThemDauPhay(tt500.ToString()));

            listDich.Add("<TONG_TIEN_SO>");
            listNguon.Add(CommonMethods.ThemDauPhay(tong.ToString()));

            listDich.Add("<TONG_TIEN_CHU>");
            listNguon.Add(CommonMethods.FirstCharToUpper(CommonMethods.ChuyenSoSangChu(tong.ToString())));
        }