private void Add() { var model = new localhost.ProductModel(); FillClass(model); ProductWS.Add(model); }
private void FillClass(localhost.ProductModel model) { model.ItemCode = txtItemCode.Text; model.ItemName = txtItemName.Text; model.Quantity = string.IsNullOrEmpty(txtQuantity.Text) ? 0 : Convert.ToInt32(txtQuantity.Text); model.Price = string.IsNullOrEmpty(txtPrice.Text) ? 0 : Convert.ToDecimal(txtPrice.Text); model.Total = string.IsNullOrEmpty(txtTotal.Text) ? 0 : Convert.ToDecimal(txtTotal.Text); }