Ejemplo n.º 1
0
        private void btn_themsim_Click(object sender, EventArgs e)
        {
            if (txt_sdt.Text.Trim().Equals(""))
            {
                MessageBox.Show("Xin hãy điền thông tin đầy đủ!", "Thông báo");
            }
            else if (txt_sdt.Text.Trim().Length != 10 || !int.TryParse(txt_sdt.Text.Trim(), out int check))
            {
                MessageBox.Show("Số điện thoại không hợp lệ!", "Thông báo");
            }
            else if (!cbbMaKH.Properties.Items.Contains(cbbMaKH.Text))
            {
                MessageBox.Show("Mã Khách Hàng không đúng!", "Thông báo");
            }
            else
            {
                DTO.ThongTinSIM thongtinSIM = new DTO.ThongTinSIM();

                thongtinSIM.IDSIM       = txt_idsim.Text;
                thongtinSIM.MaKH        = cbbMaKH.Text;
                thongtinSIM.SoDienThoai = txt_sdt.Text;
                thongtinSIM.NgayDangKy  = Convert.ToDateTime(dtpNgayDangKy.Text);
                thongtinSIM.NgayHetHan  = Convert.ToDateTime(dtpNgayHetHan.Text);
                thongtinSIM.Flag        = true;
                if (thongtinBUS.ThemThongTinSim(thongtinSIM))
                {
                    MessageBox.Show("Thêm thành công!", "Thông báo");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Thêm thất bại!", "Thông báo");
                }
            }
        }
Ejemplo n.º 2
0
        private void gvSIM_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            List <DTO.ThongTinSIM> sims = ((List <DTO.ThongTinSIM>)gcSIM.DataSource);

            DTO.ThongTinSIM sim = sims[gvSIM.FocusedRowHandle];
            gchoadontinhcuoc.DataSource = hdtc_BUS.LoadHDTC(sim.IDSIM);
        }
Ejemplo n.º 3
0
        private void gvSIM_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            List <DTO.ThongTinSIM> sims = ((List <DTO.ThongTinSIM>)gvSIM.DataSource);

            DTO.ThongTinSIM sim   = sims[gvSIM.FocusedRowHandle];
            string          masim = sim.IDSIM;

            gcHDDK.DataSource = hddkbus.LoadHoaDonDangKy(masim);
        }
Ejemplo n.º 4
0
        private void gvSim_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            List <DTO.ThongTinSIM> thongtinsims = ((List <DTO.ThongTinSIM>)gvSim.DataSource);

            DTO.ThongTinSIM thongtinsim = thongtinsims[gvSim.FocusedRowHandle];
            txt_idsim.Text              = thongtinsim.IDSIM;
            cbbMaKH.Text                = thongtinsim.MaKH;
            txt_sdt.Text                = thongtinsim.SoDienThoai;
            dtpNgayDangKy.Text          = thongtinsim.NgayDangKy.ToString();
            dtpNgayHetHan.Text          = thongtinsim.NgayHetHan.ToString();
            ce_trangthai.Checked        = (bool)thongtinsim.Flag.HasValue;
            btn_luukh.Enabled           = true;
            btn_themthongtinsim.Enabled = false;
        }
Ejemplo n.º 5
0
        private void btn_luukh_Click(object sender, EventArgs e)
        {
            Regex phone = new Regex(pphone);

            if (txt_sdt.Text.Trim().Equals(""))
            {
                MessageBox.Show("Xin hãy điền thông tin đầy đủ!", "Thông báo");
            }
            else if (!phone.Match(txt_sdt.Text).Success)
            {
                MessageBox.Show("Số điện thoại không hợp lệ!", "Thông báo");
            }
            else if (!cbbMaKH.Properties.Items.Contains(cbbMaKH.Text))
            {
                MessageBox.Show("Mã Khách Hàng không đúng!", "Thông báo");
            }
            else
            {
                DTO.ThongTinSIM thongtinSIM = new DTO.ThongTinSIM();

                thongtinSIM.IDSIM       = txt_idsim.Text;
                thongtinSIM.MaKH        = cbbMaKH.Text;
                thongtinSIM.SoDienThoai = txt_sdt.Text;
                thongtinSIM.NgayDangKy  = Convert.ToDateTime(dtpNgayDangKy.Text);
                thongtinSIM.NgayHetHan  = Convert.ToDateTime(dtpNgayHetHan.Text);
                thongtinSIM.Flag        = ce_trangthai.Checked;
                if (thongtinBUS.SuaThongTinSim(thongtinSIM))
                {
                    MessageBox.Show("Lưu thành công!", "Thông báo");
                }
                else
                {
                    MessageBox.Show("Lưu thất bại!", "Thông báo");
                }
                Load_SIM();
            }
        }