/// <summary> /// 克隆函数 /// </summary> /// <returns>成功返回克隆后的实体 失败返回null</returns> public new CostPrice Clone() { CostPrice c = base.Clone() as CostPrice; c.oper = this.oper.Clone(); c.drugItem = this.drugItem.Clone(); return(c); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="neuObject"></param> /// <returns></returns> protected override int OnSave(object sender, object neuObject) { Neusoft.FrameWork.Models.NeuObject info = this.tvList.SelectedNode.Tag as Neusoft.FrameWork.Models.NeuObject; Neusoft.HISFC.Models.Preparation.CostPrice costPrice = new Neusoft.HISFC.Models.Preparation.CostPrice( ); HISFC.Models.Pharmacy.Item item = itemMr.GetItem(info.ID); //判断item是否为空 if (item.ID == null || item == null) { } else { costPrice.ID = item.ID; costPrice.Name = item.Name; costPrice.Specs = item.Specs; costPrice.PactUnit = item.PackUnit; costPrice.PactQty = ( int )item.PackQty; costPrice.MinUnit = item.MinUnit; string costPriceFormula = this.neuTextBox1.Text; costPrice.CostPriceFormula = this.NameToCode(costPriceFormula); //判断表达式能否算出一个值,如果可以算出值证明合法。 object i = Neusoft.FrameWork.Public.String.ExpressionVal((this.Check(costPriceFormula))); costPrice.SalePriceFormula = ""; costPrice.PriceSource = ""; costPrice.PriceRate = item.PriceCollection.PriceRate; costPrice.Memo = item.Memo; costPrice.Extend = ""; costPrice.Oper.Name = ((Neusoft.HISFC.Models.Base.Employee)Neusoft.FrameWork.Management.Connection.Operator).ID; costPrice.Oper.OperTime = DateTime.Now; if (preparationManager.IsHaveCostPriceFormula(costPrice.ID)) { if (i == null) { MessageBox.Show("修改失败"); } else { if (costPrice.CostPriceFormula == null) { MessageBox.Show("修改失败"); } else { preparationManager.UpdateCostPrice(costPrice); MessageBox.Show("修改成功"); } } } else { if (preparationManager.InsertCostPrice(costPrice) == 1) { if (i == null) { MessageBox.Show("保存失败"); } else { if (costPrice.CostPriceFormula == null) { MessageBox.Show("保存失败"); } else { MessageBox.Show("保存成功"); } } } else { MessageBox.Show(preparationManager.Err); } } } return(base.OnSave(sender, neuObject)); }