/// <summary> /// 保存 /// </summary> protected int SaveShiftProperty() { if (this.reflectClass == null) { MessageBox.Show(Language.Msg("请选择具体分类")); return(-1); } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction t = new Transaction(Neusoft.FrameWork.Management.Connection.Instance); //t.BeginTransaction(); this.shiftManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); if (this.shiftManager.DelShiftProperty(this.reflectClass.ID) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Language.Msg("删除原类变更属性失败") + this.shiftManager.Err); return(-1); } DateTime sysTime = this.shiftManager.GetDateTimeFromSysDateTime(); for (int i = 0; i < this.neuSpread1_Sheet1.Rows.Count; i++) { Neusoft.HISFC.Models.Base.ShiftProperty sf = this.neuSpread1_Sheet1.Rows[i].Tag as Neusoft.HISFC.Models.Base.ShiftProperty; sf.IsRecord = NConvert.ToBoolean(this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColRecord].Value); sf.ShiftCause = this.neuSpread1_Sheet1.Cells[i, (int)ColumnSet.ColShiftCause].Text; sf.Oper.ID = this.shiftManager.Operator.ID; sf.Oper.OperTime = sysTime; if (sf.ShiftCause == "") { sf.ShiftCause = sf.Property.Name; } if (this.shiftManager.InsertShiftProperty(sf) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Language.Msg("变更属性保存失败")); return(-1); } } Neusoft.FrameWork.Management.PublicTrans.Commit();; MessageBox.Show(Language.Msg("保存成功")); this.isNew = false; return(1); }
/// <summary> /// 向Fp内加入数据 /// </summary> /// <param name="sf">变更属性信息</param> /// <param name="iRowIndex">需增加行索引</param> /// <returns>成功返回1 失败返回-1</returns> private int AddDataToFp(Neusoft.HISFC.Models.Base.ShiftProperty sf, int iRowIndex) { this.neuSpread1_Sheet1.Rows.Add(iRowIndex, 1); this.neuSpread1_Sheet1.Cells[iRowIndex, (int)ColumnSet.ColRecord].Value = sf.IsRecord; this.neuSpread1_Sheet1.Cells[iRowIndex, (int)ColumnSet.ColPropertyName].Text = sf.Property.Name; this.neuSpread1_Sheet1.Cells[iRowIndex, (int)ColumnSet.ColDescription].Text = sf.PropertyDescription; this.neuSpread1_Sheet1.Cells[iRowIndex, (int)ColumnSet.ColShiftCause].Text = sf.ShiftCause; this.neuSpread1_Sheet1.Rows[iRowIndex].Tag = sf; return(1); }
/// <summary> /// 获取Sql参数数组 /// </summary> /// <param name="shiftProperty">变更属性记录类</param> /// <returns>成功返回参数数组 失败返回null</returns> private string[] GetSqlParamForShiftProperty(Neusoft.HISFC.Models.Base.ShiftProperty shiftProperty) { string[] strParam = new string[] { shiftProperty.ReflectClass.ID, shiftProperty.ReflectClass.Name, shiftProperty.Property.ID, shiftProperty.Property.Name, shiftProperty.PropertyDescription, Neusoft.FrameWork.Function.NConvert.ToInt32(shiftProperty.IsRecord).ToString(), shiftProperty.ShiftCause, shiftProperty.Memo, shiftProperty.Oper.ID, shiftProperty.Oper.OperTime.ToString() }; return(strParam); }
/// <summary> /// 执行sql语句获取变更属性信息 /// </summary> /// <param name="strExe">需执行的sql语句</param> /// <returns>成功返回List集合 失败返回null</returns> private List <Neusoft.HISFC.Models.Base.ShiftProperty> ExecSqlForShiftProperty(string strExe) { List <Neusoft.HISFC.Models.Base.ShiftProperty> al = new List <Neusoft.HISFC.Models.Base.ShiftProperty>(); Neusoft.HISFC.Models.Base.ShiftProperty sf = null; if (this.ExecQuery(strExe) == -1) { this.Err = "执行Sql语句发生异常" + this.Err; return(null); } try { while (this.Reader.Read()) { sf = new Neusoft.HISFC.Models.Base.ShiftProperty(); sf.ReflectClass.ID = this.Reader[0].ToString(); sf.ReflectClass.Name = this.Reader[1].ToString(); sf.Property.ID = this.Reader[2].ToString(); sf.Property.Name = this.Reader[3].ToString(); sf.PropertyDescription = this.Reader[4].ToString(); sf.IsRecord = Neusoft.FrameWork.Function.NConvert.ToBoolean(this.Reader[5]); sf.ShiftCause = this.Reader[6].ToString(); sf.Memo = this.Reader[7].ToString(); sf.Oper.ID = this.Reader[8].ToString(); sf.Oper.OperTime = Neusoft.FrameWork.Function.NConvert.ToDateTime(this.Reader[9]); al.Add(sf); } return(al); } catch (Exception ex) { this.Err = "由Reader内读取数据发生异常" + ex.Message; return(null); } finally { this.Reader.Close(); } }
/// <summary> /// 增加大类 /// </summary> protected void AddShiftProperty() { using (ucAddShiftType ucAdd = new ucAddShiftType()) { ucAdd.HsExitsClass = this.hsExitsClass; Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(ucAdd); if (ucAdd.Result == DialogResult.OK) { this.reflectClass = ucAdd.ReflectedClass; if (this.reflectClass.Name == "") { this.reflectClass.Name = this.reflectClass.ID; } TreeNode node = new TreeNode(this.reflectClass.Name); node.Tag = this.reflectClass; this.tvType.Nodes[0].Nodes.Add(node); this.tvType.SelectedNode = node; int iRowIndex = 0; foreach (Neusoft.FrameWork.Models.NeuObject property in ucAdd.Properties) { Neusoft.HISFC.Models.Base.ShiftProperty sf = new Neusoft.HISFC.Models.Base.ShiftProperty(); sf.ReflectClass = this.reflectClass; sf.Property = property; //属性信息 sf.PropertyDescription = property.Memo; //属性描述 this.AddDataToFp(sf, iRowIndex); iRowIndex++; } this.hsExitsClass.Add(this.reflectClass.ID, null); this.isNew = true; } } }
/// <summary> /// 数据插入 /// </summary> /// <param name="sf"></param> /// <returns></returns> public int InsertShiftProperty(Neusoft.HISFC.Models.Base.ShiftProperty sf) { string strSQL = ""; if (this.Sql.GetSql("Manager.ShiftData.InsertShiftProperty", ref strSQL) == -1) { return(-1); } string[] strParm; try { strParm = this.GetSqlParamForShiftProperty(sf); //取参数列表 strSQL = string.Format(strSQL, strParm); //替换SQL语句中的参数。 } catch (Exception ex) { this.Err = "付数值时候出错!" + ex.Message; this.WriteErr(); return(-1); } return(this.ExecNoQuery(strSQL, strParm)); }