public void UpdateQuoteDetails(QuoteDetail QuoteDetail) { try { QuoteDetail.ModifiedTime = DateTime.Now; context.Entry(QuoteDetail).State = EntityState.Modified; SaveChanges(); } catch (OptimisticConcurrencyException ex) { throw ex; } }
public void InsertQuoteDetails(QuoteDetail QuoteDetail) { try { QuoteDetail.CreatedTime = DateTime.Now; QuoteDetail.ModifiedTime = DateTime.Now; //context.Entry(QuoteDetail).State = EntityState.Added; //context.SaveChanges(); context.Entry(QuoteDetail).State = QuoteDetail.QuoteLineID == 0 ? EntityState.Added : EntityState.Modified; context.SaveChanges(); } catch (OptimisticConcurrencyException ex) { throw ex; } }
public void UpdateQuoteDetails(QuoteDetail QuoteDetail) { quoteRepository.UpdateQuoteDetails(QuoteDetail); }
private void SaveQuoteDetails() { int[] no = new int[QuoteDetailsGridView.Rows.Count]; int i = 0; //long QuoteID = Convert.ToInt64(Session["QuoteID"]); foreach (GridViewRow row in QuoteDetailsGridView.Rows) { QuoteDetail QuoteDetail = new QuoteDetail(); long QuoteID = Convert.ToInt64(Session["QuoteID"]); Label Name = row.FindControl("NameLabel") as Label; TextBox Quantity = row.FindControl("QuantityTextBox") as TextBox; TextBox CostPrice = row.FindControl("CostPriceTextBox") as TextBox; Label MftPartNum = row.FindControl("MftPartNumLabel") as Label; TextBox ListPrice = row.FindControl("ListPriceTextBox") as TextBox; TextBox Discount = row.FindControl("DiscountTextBox") as TextBox; TextBox Note = row.FindControl("NoteTextBox") as TextBox; Label ProductNo = row.FindControl("ProductIDLabel") as Label; Label QuoteLineID = row.FindControl("QuoteLineIDLabel") as Label; //hfQuotelineID.Value ="5"; if (QuoteLineID.Text != "") { QuoteDetail.QuoteLineID = Convert.ToInt64(QuoteLineID.Text); } QuoteDetail.QuoteID = QuoteID; QuoteDetail.Discount = Convert.ToInt64(Discount.Text); QuoteDetail.ProductID = Convert.ToInt64(ProductNo.Text); QuoteDetail.Cost = Convert.ToDecimal(CostPrice.Text); QuoteDetail.ListPrice = Convert.ToDecimal(ListPrice.Text); QuoteDetail.Quantity = Convert.ToInt32(Quantity.Text); if (Note.Text != "") { QuoteDetail.Note = Note.Text; } quoteBL.InsertQuoteDetails(QuoteDetail); } if (Session["DeleteProducts"] != null) { string deleted1 = Session["DeleteProducts"].ToString(); string del = deleted1.TrimEnd(','); string[] productdelete = del.Split(','); foreach (string QuoteLineId in productdelete) { //QuoteDetail QuoteDetail = new QuoteDetail(); //QuoteDetail.QuoteLineID = Convert.ToInt64(deleteproduct); //QuoteDetail.IsDeleted = true; long QuoteLineID = Convert.ToInt64(QuoteLineId); quoteBL.ProductRowDelete(QuoteLineID); } } }
public void InsertQuoteDetails(QuoteDetail QuoteDetail) { quoteRepository.InsertQuoteDetails(QuoteDetail); }