Пример #1
0
        private void tbtnSale_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < advBandedGridView1.RowCount; i++)
            {
                double total = Convert.ToDouble(advBandedGridView1.GetRowCellValue(i, "Total"));

                if (total > 0)
                {
                    int quantity = Convert.ToInt32(advBandedGridView1.GetRowCellValue(i, "Quantity"));


                    int id = Convert.ToInt32(advBandedGridView1.GetRowCellValue(i, "Id"));

                    DBLayer.Users.Details det = ((DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User"));

                    DBLayer.Sales.Details sDet = new FitnessProject.DBLayer.Sales.Details();

                    sDet.Date      = this.Date1;
                    sDet.ProductId = id;
                    sDet.UserId    = det.Id;
                    sDet.Quantity  = quantity;

                    DBLayer.Sales.Insert(sDet);
                }
            }

            MessageBox.Show("Изменения сохранены");
        }
Пример #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            DBLayer.Sales.Details det = new FitnessProject.DBLayer.Sales.Details();

            det.Date      = DateTime.Now.Date;
            det.ProductId = this.Product.Id;
            det.Quantity  = Convert.ToInt32(tbQuantity.Text);
            det.Time      = DateTime.Now.ToShortTimeString();

            DBLayer.Users.Details detU = (DBLayer.Users.Details)AppDomain.CurrentDomain.GetData("User");

            det.UserId = detU.Id;

            DBLayer.Sales.Insert(det);

            this.Close();
        }