protected void lvInvoiceDetail_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; Label lblMemberItemName = (Label)e.Item.FindControl("lblMemberItemName"); Label lblQuantity = (Label)e.Item.FindControl("lblQuantity"); Label lblCartonSize = (Label)e.Item.FindControl("lblCartonSize"); Label lblTotalProduct = (Label)e.Item.FindControl("lblTotalProduct"); Label lblCartonPrice = (Label)e.Item.FindControl("lblCartonPrice"); Label lblTotalAmount = (Label)e.Item.FindControl("lblTotalAmount"); Label lblNetWeight = (Label)e.Item.FindControl("lblNetWeight"); Label lblGrossWeight = (Label)e.Item.FindControl("lblGrossWeight"); LinkButton lnkBtnEdit = (LinkButton)e.Item.FindControl("lnkBtnEdit"); Inv_Detail item = dataItem.DataItem as Inv_Detail; lblMemberItemName.Text = item.Ins_MemberItem.Name; lblQuantity.Text = item.Quantity.ToString(); lblCartonSize.Text = item.CartonSize.ToString(); lblTotalProduct.Text = item.TotalItemCount.ToString(); lblCartonPrice.Text = item.UnitPrice.ToString("0.00"); lblTotalAmount.Text = item.TotalAmount.ToString("#.##"); lblNetWeight.Text = item.TotalWeight.ToString("0.00"); lblGrossWeight.Text = item.GrossWeight.ToString("0.00"); lnkBtnEdit.CommandArgument = item.IID.ToString(); lnkBtnEdit.CommandName = "editInvoiceDetail"; lnkBtnEdit.Text = "Edit"; } }
public Inv_Detail GetInvoiceDetailByID(long id) { Inv_Detail invDetail = new Inv_Detail(); invDetail = Database.Inv_Details.Single(i => i.IID == id && i.IsRemoved == 0); return(invDetail); }
private void LoadInvoiceDetails() { using (TheFacade facade = new TheFacade()) { Inv_Detail invoiceDetail = facade.InvoiceFacade.GetInvoiceDetailByID(InvoiceDetailId); ddlItem.SelectedValue = invoiceDetail.InsMemberItemId.ToString(); txtQuantity.Text = invoiceDetail.Quantity.ToString(); txtUnitPrice.Text = invoiceDetail.UnitPrice.ToString("#.##"); txtCartonSize.Text = invoiceDetail.CartonSize.ToString(); } }
private void SaveUpdateInvoiceDetail(long invoiceID, TheFacade facade) { Inv_Detail invoiceDetail; Ins_MemberItem item = facade.InsentiveFacade.GetMemberItemById(Convert.ToInt64(ddlItem.SelectedValue)); if (InvoiceDetailId <= 0) { if (!string.IsNullOrWhiteSpace(txtUnitPrice.Text) && !string.IsNullOrWhiteSpace(txtQuantity.Text) && Convert.ToInt32(ddlItem.SelectedValue) > 0) { invoiceDetail = new Inv_Detail(); invoiceDetail.InvMasterId = invoiceID; invoiceDetail.InsMemberItemId = Convert.ToInt64(ddlItem.SelectedValue); invoiceDetail.Quantity = Convert.ToInt32(txtQuantity.Text); //invoiceDetail.UnitPrice = Convert.ToInt32(txtUnitPrice.Text); invoiceDetail.UnitPrice = Convert.ToDecimal(txtUnitPrice.Text); invoiceDetail.CartonSize = Convert.ToInt32(txtCartonSize.Text); invoiceDetail.TotalItemCount = invoiceDetail.Quantity * invoiceDetail.CartonSize; invoiceDetail.TotalAmount = invoiceDetail.Quantity * invoiceDetail.UnitPrice; invoiceDetail.TotalWeight = string.IsNullOrEmpty(txtNetWeight.Text)?0: Convert.ToDecimal(txtNetWeight.Text); //item.ItemWeight.Value * invoiceDetail.TotalItemCount; invoiceDetail.GrossWeight = string.IsNullOrEmpty(txtGrossWeight.Text) ? 0 : Convert.ToDecimal(txtGrossWeight.Text); //invoiceDetail.TotalWeight + Convert.ToDecimal(invoiceDetail.CartonSize * 0.2); invoiceDetail.CreateBy = 1; //sustemuserid invoiceDetail.CreateDate = DateTime.Now; invoiceDetail.IsRemoved = 0; invoiceDetail.UpdateBy = 1; //sustemuserid invoiceDetail.UpdateDate = DateTime.Now; facade.Insert <Inv_Detail>(invoiceDetail); } } else { invoiceDetail = facade.InvoiceFacade.GetInvoiceDetailByID(InvoiceDetailId); invoiceDetail.InvMasterId = invoiceID; invoiceDetail.InsMemberItemId = Convert.ToInt32(ddlItem.SelectedValue); invoiceDetail.Quantity = Convert.ToInt32(txtQuantity.Text); invoiceDetail.UnitPrice = Convert.ToDecimal(txtUnitPrice.Text); invoiceDetail.CartonSize = Convert.ToInt32(txtCartonSize.Text); invoiceDetail.TotalItemCount = invoiceDetail.Quantity * invoiceDetail.CartonSize; invoiceDetail.TotalAmount = invoiceDetail.Quantity * invoiceDetail.UnitPrice; invoiceDetail.TotalWeight = string.IsNullOrEmpty(txtNetWeight.Text) ? 0 : Convert.ToDecimal(txtNetWeight.Text); //item.ItemWeight.Value * invoiceDetail.TotalItemCount; invoiceDetail.GrossWeight = string.IsNullOrEmpty(txtGrossWeight.Text) ? 0 : Convert.ToDecimal(txtGrossWeight.Text); //invoiceDetail.TotalWeight + Convert.ToDecimal(invoiceDetail.CartonSize * 0.2); //invoiceDetail.TotalWeight = item.ItemWeight.Value * invoiceDetail.TotalItemCount; //invoiceDetail.GrossWeight = invoiceDetail.TotalWeight + Convert.ToDecimal(invoiceDetail.CartonSize * 0.2); invoiceDetail.UpdateBy = 1;//sustemuserid invoiceDetail.UpdateDate = DateTime.Now; facade.Update <Inv_Detail>(invoiceDetail); } }