Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (Global.Time.Day != DateTime.Now.Day || Global.Time.Month != DateTime.Now.Month || Global.Time.Year != DateTime.Now.Year)
            {
                //MessageBox.Show("Hoba");
                Global.BillNo = 1;
            }
            else
            {
                Global.BillNo++;
            }


            Global.Time = DateTime.Now;
            BillTemplate BillTemplate = new BillTemplate();

            BillTemplate.Session         = new Dictionary <string, object>();
            BillTemplate.Session["Bill"] = new BillModel();

            BillTemplate.Initialize();

            webBrowser1.DocumentText = BillTemplate.TransformText();


            businesslayer bl = new businesslayer();


            foreach (DataGridViewRow row in CartTable.Rows)
            {
                if (!row.IsNewRow)
                {
                    bl.Buy(Global.Time, row.Cells["CustomerSSN"].Value.ToString(), row.Cells["MobileSerial"].Value.ToString(), row.Cells["ModName"].Value.ToString(), row.Cells["ModSellPrice"].Value.ToString());
                }
            }

            bl.insertBill();
            MySqlDataReader dr    = bl.Select("all", "cart", "", "");
            DataTable       table = new DataTable();

            if (dr != null)
            {
                table.Load(dr);
                if (table != null)
                {
                    CartTable.DataSource = table;
                }
            }
        }