Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string phone = textBox1.Text;

            if (phone == "")
            {
                MessageBox.Show("Số Điện thoại trống");
            }
            else
            {
                int     temp    = 0;
                CuocBIZ cuoc    = new CuocBIZ();
                var     listsim = new SimDAO().GetListPhone();
                foreach (var item in listsim)
                {
                    if (phone == item.idSim)
                    {
                        temp += 1;
                    }
                }
                if (temp == 0)
                {
                    cuoc.AddSim(phone);
                    MessageBox.Show("Lưu Sim thành công");
                }
                else
                {
                    MessageBox.Show("Số điện thoại đã tồn tại");
                }
            }
        }
Exemple #2
0
        public void AddData()
        {
            BillBIZ bills = new BillBIZ();

            SimDAO sim = new SimDAO();

            DateTime date  = DateTime.Now;
            int      thang = date.Month;

            foreach (var item in sim.GetPhone())
            {
                var MonthStart = (DateTime)item.NgayKichHoat;
                for (int i = MonthStart.Month; i < thang; i++)
                {
                    string  phone      = item.idSim;
                    decimal?totalprice = TinhCuocThang(i, item.idSim);
                    int     month      = i;
                    bills.AddBill(phone, totalprice, month);

                    var ListBillInf = from all in ListAll()
                                      where all.SoDT == item.idSim
                                      where all.TGBD.Month == i
                                      select all;
                    foreach (var items in ListBillInf)
                    {
                        int      id         = db.HoaDonCuocs.Select(g => g.idHD).DefaultIfEmpty(0).Max();
                        DateTime TGBD       = items.TGBD;
                        DateTime TGKT       = items.TGKT;
                        decimal? totalPrice = items.ThanhTien;
                        bills.AddBillInf(id, phone, TGBD, TGKT, totalPrice);
                    }
                }
            }
        }
Exemple #3
0
        void load()
        {
            SimDAO sim = new SimDAO();

            dataGridView1.DataSource = sim.GetListSim();

            textBox1.DataBindings.Add(new Binding("Text", dataGridView1.DataSource, "Phone"));
        }
Exemple #4
0
        public frmHome()
        {
            InitializeComponent();
            SimDAO d = new SimDAO();

            dataGridView1.DataSource = a.ListAll();
            fr = this;
        }
Exemple #5
0
        private void tínhCướcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmHome.fr.Controls.Clear();
            InitializeComponent();
            SimDAO d = new SimDAO();

            dataGridView1.DataSource = a.ListAll();
            fr = this;
        }
Exemple #6
0
        private void button4_Click_1(object sender, EventArgs e)
        {
            frmHome.fr.Controls.Clear();
            InitializeComponent();
            SimDAO d = new SimDAO();

            dataGridView1.DataSource = a.ListAll();
            fr = this;
        }
Exemple #7
0
 public static List <THONGTINSIM> LoadNotUsedSim()
 {
     return(SimDAO.LoadNotUsedTTS());
 }
Exemple #8
0
        public bool AddSim(string phone)
        {
            SimDAO sim = new SimDAO();

            return(sim.AddSim(phone));
        }