protected void btnInsert_Click(object sender, EventArgs e) { bll.clsProduct toInsert = new bll.clsProduct(); try { toInsert.Category = Convert.ToInt32(ListCategoty.SelectedValue); toInsert.IsActive = checkActive.Enabled; toInsert.Name = inName.Text; toInsert.PricePerExtra = Convert.ToDouble(inPPE.Text); toInsert.PricePerUnit = Convert.ToDouble(inPPU.Text); toInsert.Insert(); } catch { lblError.Visible = true; lblError.Text = "Es gab einen Fehler bitte Versuchen sie es Erneut"; } }
protected void btnInsert_Click(object sender, EventArgs e) { bll.clsProduct toInsert= new bll.clsProduct(); try { toInsert.Category = Convert.ToInt32(ListCategoty.SelectedValue); toInsert.IsActive = checkActive.Enabled; toInsert.Name = inName.Text; toInsert.PricePerExtra = Convert.ToDouble(inPPE.Text); toInsert.PricePerUnit = Convert.ToDouble(inPPU.Text); toInsert.Insert(); } catch { lblError.Visible = true; lblError.Text = "Es gab einen Fehler bitte Versuchen sie es Erneut"; } }
protected void grdProducts_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = grdProducts.SelectedRow; DropDownList size = row.FindControl("lisSize") as DropDownList; DropDownList extras = row.FindControl("lisExtras") as DropDownList; CheckBox delivery = row.FindControl("checkDelivery") as CheckBox; TextBox menge = row.FindControl("inMenge") as TextBox; bll.clsProductFacade products; products = new bll.clsProductFacade(); int i = Convert.ToInt32(row.Cells[0].Text); bll.clsProduct product = products.ProductGetByID(i); bll.clsUser user = (bll.clsUser)Session["Current User"]; bll.clsOrder order; order = new bll.clsOrder(); bll.clsOrderFacade orders = new bll.clsOrderFacade(); order.OrderCount = 1;//Convert.ToInt32(inCount.Text); order.OrderDate = DateTime.UtcNow; order.OrderDelivery = delivery.Enabled; order.OrderExtras = Convert.ToInt32(extras.SelectedValue); // Convert.ToInt32(inExtras.Text); order.OrderSize = Convert.ToInt32(size.SelectedValue); //Convert.ToInt32(inSize.Text); order.OrderStatus = 0; order.ProductId = product.Id; order.UserId = user.ID; order.OrderSum = orders.CalculateOrderPrice(order); if (orders.OrderInsert(order)) { lblMessage1.Text = "Die Bestellung wurde erfolgreich aufgenommen."; lblMessage2.Text = "Die Bestellung kostet: " + order.OrderSum.ToString(); lblMessage3.Text = "Die Lieferzeit beträgt: " + ((user.Distance * 2) + 10).ToString() + "Minuten."; } }