public bool Add(tblSaleInvoiceDetail obj) { try { repository.tblSaleInvoiceDetails.Add(obj); repository.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Delete(int id) { try { tblSaleInvoiceDetail result = Get(id); if (result != null) { result.Deleted = true; repository.SaveChanges(); return(true); } return(false); } catch (Exception) { return(false); } }
public bool Update(tblSaleInvoiceDetail obj) { try { tblSaleInvoiceDetail result = Get(obj.InvoiceDetailId); if (result != null) { repository.Entry(result).CurrentValues.SetValues(obj); repository.SaveChanges(); return(true); } return(false); } catch (Exception) { return(false); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "0") { this.ShowErrorNotification("Please select proper id"); } else { Load_Data_Grid(); lblCustName.Visible = true; gridProduct1.Visible = true; lblTotal1.Visible = true; txtDiscount1.Visible = true; txtTax1.Visible = true; lblNetTotal1.Visible = true; SaleInvoice repository = new SaleInvoice(); tblSaleInvoice saleInvoice = repository.Get(Convert.ToInt32(DropDownList1.SelectedValue)); Customer c = new Customer(); tblCustomer cust = c.Get(saleInvoice.CustomerId); lblCustName.Text = cust.Firstname + " " +cust.Lastname; lblTotal1.Text= saleInvoice.TotalSale.ToString(); txtTax1.Text= saleInvoice.Tax.ToString(); txtDiscount1.Text=saleInvoice.Discount.ToString(); lblNetTotal1.Text=saleInvoice.NetSale.ToString(); SaleInvoiceDetail repo = new SaleInvoiceDetail(); tblSaleInvoiceDetail sid = new tblSaleInvoiceDetail(); IEnumerable<tblSaleInvoiceDetail> enume= repo.GetOnInvoiceId(Convert.ToInt32(saleInvoice.InvoiceId)); var enumer= enume.GetEnumerator(); while (enumer.MoveNext()) { int rowindex = enumer.Current.ProductId - 1; CheckBox cb = (CheckBox)gridProduct1.Rows[rowindex].FindControl("chkbox1"); cb.Checked = true; TextBox txt = (TextBox)gridProduct1.Rows[rowindex].FindControl("txtQuantity"); txt.Visible = true; txt.Text = enumer.Current.Quantity.ToString(); } total = Convert.ToDouble(lblTotal1.Text); } }