Пример #1
0
        public void Clear()
        {
            SIMDAL dal = new SIMDAL();

            txthddk.Clear();
            txtsosim.Clear();
            txtidsim.Clear();
            txttensim.Clear();
            sIMsBindingSource2.DataSource = dal.Load();
        }
Пример #2
0
        public ThongtinSIM(HoaDonTC ff)
        {
            InitializeComponent();
            // This line of code is generated by Data Source Configuration Wizard
            // Instantiate a new DBContext
            SIMDAL dal = new SIMDAL();

            var res = dal.Load();

            // This line of code is generated by Data Source Configuration Wizard
            sIMsBindingSource2.DataSource = res;

            f = ff;
        }
Пример #3
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            SIMDAL dal = new SIMDAL();

            if (txtidsim.Text == "")
            {
                MessageBox.Show("Vui lòng chọn SIM muốn xóa!!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (MessageBox.Show("Bạn có thật sự muốn xóa?", "Xóa SIM", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                dal.XoaSIM(txtidsim.Text);
                MessageBox.Show("Xóa mã SIM " + txtidsim.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Clear();
            }
        }
Пример #4
0
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            try
            {
                SIMDAL dal = new SIMDAL();
                if (txttensim.Text == "" || txtsosim.Text == "" || txtidhd.Text == "")
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (dal.testnumber(txtsosim.Text) == 0)
                {
                    MessageBox.Show("Số sim phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (dal.testsosim(txtsosim.Text) == 0)
                {
                    MessageBox.Show("Số sim không hợp lệ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                else if (dal.testexistidhd(Convert.ToInt32(txtidhd.Text)) != IDHDDK_SUA)
                {
                    MessageBox.Show("Hóa đơn đăng ký đã tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (dal.testexistsim(txtsosim.Text, SoSIM_SUA) == "Success")
                    {
                        if (dal.testexistidhd(Convert.ToInt32(txtidhd.Text)) == IDHDDK_SUA)
                        {
                            dal.SuaSIM(txtidsim.Text, txttensim.Text, txtsosim.Text);
                            MessageBox.Show("Sửa Sim thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            Clear();
                        }
                        else
                        {
                            MessageBox.Show("Hóa đơn đăng ký đã tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Số SIM đã tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Đã có lỗi xảy ra!");
            }
        }
Пример #5
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            SIMDAL dal = new SIMDAL();

            if (txttensim.Text == "" && txtsosim.Text == "" && txthddk.Text == "")
            {
                MessageBox.Show("Vui lòng nhập thông tin cần tìm", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                var res = dal.TimSIM(txttensim.Text, txtsosim.Text, txthddk.Text);
                sIMsBindingSource2.DataSource = res;
                MessageBox.Show("Tìm kiếm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                ClearSIM();
            }
        }
Пример #6
0
        public SIM()
        {
            InitializeComponent();

            // This line of code is generated by Data Source Configuration Wizard
            // Instantiate a new DBContext
            //Model.EFModel.QLCuocDTContext dbContext = new Model.EFModel.QLCuocDTContext();
            //// Call the Load method to get the data for the given DbSet from the database.
            //dbContext.SIMs.Load();
            //// This line of code is generated by Data Source Configuration Wizard
            //sIMsBindingSource1.DataSource = dbContext.SIMs.Local.ToBindingList();
            // This line of code is generated by Data Source Configuration Wizard
            // Instantiate a new DBContext
            //Model.EFModel.QLCuocDTContext dbContext = new Model.EFModel.QLCuocDTContext();
            //// Call the Load method to get the data for the given DbSet from the database.
            //dbContext.SIMs.Load();
            // This line of code is generated by Data Source Configuration Wizard
            SIMDAL dal = new SIMDAL();
            var    res = dal.Load();

            sIMsBindingSource.DataSource = res;
        }