/// <summary> /// 删除药品常数信息 /// </summary> /// <returns></returns> protected int DelConstantList() { if (this.neuSpread1_Sheet1.Rows.Count < 0) { return(1); } //删除增加提示 by Sunjh 2010-8-25 {375E3D5C-F4B3-43bf-9908-CEE1C78BC5F2} if (MessageBox.Show("确定删除本条记录吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return(1); } if (this.neuSpread1_Sheet1.Rows[this.neuSpread1_Sheet1.ActiveRowIndex].Tag != null) { Neusoft.HISFC.Models.Pharmacy.DrugConstant info = this.neuSpread1_Sheet1.Rows[this.neuSpread1_Sheet1.ActiveRowIndex].Tag as Neusoft.HISFC.Models.Pharmacy.DrugConstant; if (info != null) { if (this.phaConsManager.DeleteDrugConstant(info) == -1) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("删除药品常数信息失败")); return(-1); } MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("删除成功")); } } this.neuSpread1_Sheet1.Rows.Remove(this.neuSpread1_Sheet1.ActiveRowIndex, 1); return(1); }
protected override int OnSave(object sender, object neuObject) { for (int i = 0; i < this.neuSpread1_Sheet1.Rows.Count; i++) { if (string.IsNullOrEmpty(this.neuSpread1_Sheet1.Cells[i, 0].Text) == true) { MessageBox.Show("请选择授权的药品类别", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(-1); } if (string.IsNullOrEmpty(this.neuSpread1_Sheet1.Cells[i, 1].Text) == true) { MessageBox.Show("请选择授权人员", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(-1); } } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); this.phaConsManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); //根据常数类别删除原维护的信息 if (this.phaConsManager.DeleteDrugConstant(Function.DrugTypePriv_ConsType) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("删除常数类别信息发生错误") + this.phaConsManager.Err); return(-1); } DateTime sysTime = this.phaConsManager.GetDateTimeFromSysDateTime(); Neusoft.HISFC.Models.Pharmacy.DrugConstant info = new Neusoft.HISFC.Models.Pharmacy.DrugConstant(); for (int i = 0; i < this.neuSpread1_Sheet1.Rows.Count; i++) { info = this.GetDrugConstant(i); if (info == null) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("由FarPoint内获取数据发生错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(-1); } info.Oper.ID = this.phaConsManager.Operator.ID; info.Oper.OperTime = sysTime; if (info != null) { if (this.phaConsManager.InsertDrugConstant(info) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("插入常数类别信息发生错误") + this.phaConsManager.Err); return(-1); } } } Neusoft.FrameWork.Management.PublicTrans.Commit(); MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("保存成功")); return(base.OnSave(sender, neuObject)); }
/// <summary> /// 由Fp内获取常数设置信息 /// </summary> /// <param name="iRowIndex"></param> /// <returns></returns> protected Neusoft.HISFC.Models.Pharmacy.DrugConstant GetDrugConstant(int iRowIndex) { Neusoft.HISFC.Models.Pharmacy.DrugConstant info = new Neusoft.HISFC.Models.Pharmacy.DrugConstant(); info.ConsType = Function.DrugTypePriv_ConsType; info.DrugType = this.neuSpread1_Sheet1.Cells[iRowIndex, 0].Text.Substring(1, 1); info.Dept.ID = "0"; info.Item.ID = this.neuSpread1_Sheet1.Cells[iRowIndex, 1].Text; info.Item.Name = this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text; info.Memo = Neusoft.FrameWork.Public.String.TakeOffSpecialChar(this.neuSpread1_Sheet1.Cells[iRowIndex, 3].Text); return(info); }