public object Clone() { SOFormEntity newObj = new SOFormEntity(); newObj.saleParent = this.saleParent.Clone() as SaleParent; newObj.saleChildren.Clear(); foreach (SaleChild child in saleChildren) { newObj.saleChildren.Add(child.Clone() as SaleChild); } return newObj; }
public string SOSave(SOFormEntity soFormEntity) { return this.addOrUpdateSaleOrder(soFormEntity.SaleParent, soFormEntity.SaleChildren); }
private void ReloadData(string orderId) { if (null == orderId || orderId.Equals("")) { soFormEntity = new SOFormEntity(); return; } try { soFormEntity = icommodity.SOGetOederInfoById(orderId); soFormBack = soFormEntity.Clone() as SOFormEntity; } catch { ShowErrorInfo("读取数据失败。"); return; } }
public SOFormEntity SOGetOederInfoById(string strSaleOrderID) { SOFormEntity soFormEntity = new SOFormEntity(); try { SaleParent saleParent; List<SaleChild> saleChildList; saleParent = this.GetSaleParentByOrderId(strSaleOrderID); saleChildList = this.SOGetDetailByOrderId(strSaleOrderID); //populate purFormEntity.PurChildren; populate discount,freight and other pay into PurParent soFormEntity.SaleChildren = new List<SaleChild>(); saleParent.CommPay = 0; foreach (SaleChild saleChild in saleChildList) { if (saleChild.SaleKBN == 1) { //goods soFormEntity.SaleChildren.Add(saleChild); saleParent.CommPay += saleChild.PriceTotalActual; } else if (saleChild.SaleKBN == 2) { //discount saleParent.Rebate = saleChild.PriceTotalActual; } else if (saleChild.SaleKBN == 3) { //freight saleParent.Freight = saleChild.PriceTotalActual; } else if (saleChild.SaleKBN == 4) { //other pay saleParent.OtherPay = saleChild.PriceTotalActual; } } saleParent.DuePay = saleParent.CommPay + saleParent.Freight + saleParent.OtherPay - saleParent.Rebate; //populate purFormEntity.PurParent soFormEntity.SaleParent = saleParent; } catch (Exception ex) { throw; } return soFormEntity; }