Пример #1
0
        private void cart_Paint(object sender, PaintEventArgs e)
        {
            businesslayer   bl    = new businesslayer();
            MySqlDataReader dr    = bl.Select("all", "cart", "", "");
            DataTable       table = new DataTable();

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

            foreach (DataGridViewRow row in CartTable.Rows)
            {
                if (!row.IsNewRow)
                {
                    Price += Convert.ToDouble(row.Cells["ModSellPrice"].Value);
                }
            }
            TotalPrice.Text = Price.ToString() + " L.E.";
            foreach (DataGridViewRow row in CartTable.SelectedRows)
            {
                if (!row.IsNewRow)
                {
                    bl.DeleteRow("cart", "MobileSerial", row.Cells["MobileSerial"].Value + "");
                    CartTable.Rows.Remove(row);
                    MessageBox.Show("Delete Operation is Completed");
                }
            }
        }
Пример #2
0
        public void GetData(int Num, DateTime DT)
        {
            BillNo  = Num.ToString();
            this.DT = DT;

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

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

            foreach (DataRow row in table.Rows)
            {
                MobileSerial.Add(row["MobileSerial"].ToString());
                CustomerSSN.Add(row["CustomerSSN"].ToString());
                ModSellPrice.Add(row["ModSellPrice"].ToString());
                ModCompany.Add(row["ModCompany"].ToString());

                TotalPrice += Convert.ToDouble(row["ModSellPrice"].ToString());
            }
            TotalPriceSTR = TotalPrice + " L.E.";
        }
        public void LoadAutoCompleteTextBoxes()
        {
            businesslayer   bl = new businesslayer();
            MySqlDataReader dr = bl.Select("all", "company", null, null);
            AutoCompleteStringCollection MyCollection = new AutoCompleteStringCollection();

            while (dr.Read())
            {
                MyCollection.Add(dr.GetString(1));
            }
            CompanyName.AutoCompleteCustomSource = MyCollection;
            dr           = bl.Select("all", "model", null, null);
            MyCollection = new AutoCompleteStringCollection();
            while (dr.Read())
            {
                MyCollection.Add(dr.GetString(1));
            }
            ModelName.AutoCompleteCustomSource = MyCollection;
        }
Пример #4
0
        private void Browse_Paint(object sender, PaintEventArgs e)
        {
            businesslayer   bl    = new businesslayer();
            MySqlDataReader dr    = bl.Select("all", "returnpayment", "", "");
            DataTable       table = new DataTable();

            if (dr != null)
            {
                table.Load(dr);
                if (table != null)
                {
                    dataGridView1.DataSource = table;
                }
            }
        }
Пример #5
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;
                }
            }
        }