Пример #1
0
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            try
            {
                DangKySIMDAL dal = new DangKySIMDAL();
                if (txtmakh.Text == "" && cbngaydk.Checked == false && chidk.Text == "")
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (dal.testnumber(chidk.Text) == 0)
                {
                    MessageBox.Show("Chi phí đăng ký phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                else
                {
                    if (MaKH == "")
                    {
                        string a = "";
                        if (tttt.Checked == true)
                        {
                            a = "True";
                        }
                        else
                        {
                            a = "False";
                        }
                        dal.SuaHDDK(txtidhd.Text, ngaydk.Value.ToString("yyyy/MM/dd"), chidk.Text, a);
                        MessageBox.Show("Sửa hóa đơn " + txtidhd.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        Clear();
                    }
                    else
                    {
                        if (dal.textexistmakh(Convert.ToInt32(MaKH)) == IDKH_SUA)
                        {
                            string a = "";
                            if (tttt.Checked == true)
                            {
                                a = "True";
                            }
                            else
                            {
                                a = "False";
                            }
                            dal.SuaHDDK(txtidhd.Text, ngaydk.Value.ToString("yyyy/MM/dd"), chidk.Text, a);
                            MessageBox.Show("Sửa hóa đơn " + txtidhd.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            Clear();
                        }
                        else
                        {
                            MessageBox.Show("Không được sửa khách hàng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Đã có lỗi xảy ra!");
            }
        }
Пример #2
0
        public void Clear()
        {
            DangKySIMDAL dal = new DangKySIMDAL();

            txtidhd.Clear();
            txtmakh.Clear();
            cbngaydk.Checked = false;
            chidk.Clear();
            tttt.Checked = false;
            MaKH         = "";
            hoaDonDangKiesBindingSource1.DataSource = dal.Load();
        }
Пример #3
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            DangKySIMDAL dal = new DangKySIMDAL();

            if (txtidhd.Text == "")
            {
                MessageBox.Show("Vui lòng chọn hóa đơn 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.XoaHDDK(txtidhd.Text);
                MessageBox.Show("Xóa mã SIM " + txtidhd.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Clear();
            }
        }
Пример #4
0
 private void simpleButton4_Click(object sender, EventArgs e)
 {
     try
     {
         DangKySIMDAL dal = new DangKySIMDAL();
         if (MaKH == "" && cbngaydk.Checked == false && chidk.Text == "" && tttt.Checked == false)
         {
             var res = dal.TimHDDK("", "False", "", "", "False");
             hoaDonDangKiesBindingSource1.DataSource = res;
             MessageBox.Show("Tìm kiếm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             ClearHD();
         }
         else if (chidk.Text != "" && dal.testnumber(chidk.Text) == 0)
         {
             MessageBox.Show("Chi phí đăng ký phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             string a = "";
             string b = "";
             if (tttt.Checked == true)
             {
                 a = "True";
             }
             else
             {
                 a = "False";
             }
             if (cbngaydk.Checked == true)
             {
                 b = "True";
             }
             else
             {
                 b = "False";
             }
             var res = dal.TimHDDK(MaKH, b, ngaydk.Text, chidk.Text, a);
             hoaDonDangKiesBindingSource1.DataSource = res;
             MessageBox.Show("Tìm kiếm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             ClearHD();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Đã có lỗi xảy ra!");
     }
 }
Пример #5
0
        public DangKySIM()
        {
            InitializeComponent();
            // This line of code is generated by Data Source Configuration Wizard
            // Instantiate a new DBContext
            DangKySIMDAL dal = new DangKySIMDAL();
            var          res = dal.Load();

            // This line of code is generated by Data Source Configuration Wizard
            hoaDonDangKiesBindingSource1.DataSource = res;
            // 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.HoaDonDangKies.Load();
            //// This line of code is generated by Data Source Configuration Wizard
            //hoaDonDangKiesBindingSource1.DataSource = dbContext.HoaDonDangKies.Local.ToBindingList();
        }
Пример #6
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                DangKySIMDAL dal = new DangKySIMDAL();
                if (txtmakh.Text == "" || cbngaydk.Checked == false || chidk.Text == "")
                {
                    MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (dal.testnumber(chidk.Text) == 0)
                {
                    MessageBox.Show("Chi phí đăng ký phải là số", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (MaKH == "")
                {
                    MessageBox.Show("Vui lòng chọn khách hàng muốn đăng ký", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    string a = "";
                    if (tttt.Checked == true)
                    {
                        a = "True";
                    }
                    else
                    {
                        a = "False";
                    }

                    dal.ThemHDDK(MaKH, ngaydk.Value.ToString("yyyy/MM/dd"), chidk.Text, a);
                    MessageBox.Show("Thêm hóa đơn thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Đã có lỗi xảy ra!");
            }
        }
Пример #7
0
        public ThongTinHDDK(SIM ff, ThongtinSIM gg)
        {
            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.HoaDonDangKies.Load();
            //This line of code is generated by Data Source Configuration Wizard
            DangKySIMDAL dal = new DangKySIMDAL();
            var          res = dal.Load();

            hoaDonDangKiesBindingSource.DataSource = res;
            if (gg == null)
            {
                f = ff;
            }
            if (ff == null)
            {
                g = gg;
            }
            //txtmakh.Text = MaKH;
        }