/// <summary> /// 取得表格中的加价率实体 /// </summary> /// <param name="rowIndex">行号</param> /// <returns></returns> protected virtual Neusoft.HISFC.Models.Material.MaterialAddRate GetAddRateFromFp(int rowIndex) { if (rowIndex >= 0) { Neusoft.HISFC.Models.Material.MaterialAddRate obj = new Neusoft.HISFC.Models.Material.MaterialAddRate(); Neusoft.FrameWork.Public.ObjectHelper myHelper = new Neusoft.FrameWork.Public.ObjectHelper(); obj.ID = this.FpAddRate_Sheet1.Cells[rowIndex, 1].Text.Trim(); obj.RateKind.ID = this.helper.GetID(this.FpAddRate_Sheet1.Cells[rowIndex, 2].Text.Trim()); obj.Specs = this.FpAddRate_Sheet1.Cells[rowIndex, 3].Text.Trim(); obj.PriceLow = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.FpAddRate_Sheet1.Cells[rowIndex, 4].Text.Trim()); obj.PriceHigh = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.FpAddRate_Sheet1.Cells[rowIndex, 5].Text.Trim()); obj.AddRate = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.FpAddRate_Sheet1.Cells[rowIndex, 6].Text.Trim()); obj.AppendFee = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.FpAddRate_Sheet1.Cells[rowIndex, 7].Text.Trim()); obj.Oper.ID = this.FpAddRate_Sheet1.Cells[rowIndex, 8].Text.Trim(); obj.MaterialKind.ID = this.FpAddRate_Sheet1.Cells[rowIndex, 10].Text.Trim(); return(obj); } else { return(null); } }
/// <summary> /// 保存 /// </summary> /// <returns></returns> protected virtual int SaveAddRate() { Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(this.addRateManager.Connection); //t.BeginTransaction(); this.addRateManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); for (int i = 0; i < this.FpAddRate_Sheet1.RowCount; i++) { if (this.FpAddRate_Sheet1.Cells[i, 0].Text == "ADD") { Neusoft.HISFC.Models.Material.MaterialAddRate obj = this.GetAddRateFromFp(i); obj.ID = this.addRateManager.GetNewAddRateID(); obj.Oper.ID = this.oper.ID; obj.OperDate = this.addRateManager.GetDateTimeFromSysDateTime(); if (this.addRateManager.InsertAddRate(obj) < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("插入加价率信息失败!" + this.addRateManager.Err); return(-1); } } else if (this.FpAddRate_Sheet1.Cells[i, 0].Text == "MODIFY") { Neusoft.HISFC.Models.Material.MaterialAddRate obj = this.GetAddRateFromFp(i); obj.Oper.ID = this.oper.ID; obj.OperDate = this.addRateManager.GetDateTimeFromSysDateTime(); if (this.addRateManager.UpdateAddRate(obj) < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("更新加价率信息失败!" + this.addRateManager.Err); return(-1); } } } Neusoft.FrameWork.Management.PublicTrans.Commit(); MessageBox.Show("保存成功!"); ArrayList al = this.addRateManager.QueryAddRateByRateKind(this.tvRateKind.SelectedNode.Tag.ToString()); this.FpAddRate_Sheet1.RowCount = 0; this.AddDataToFp(al); return(1); }
/// <summary> /// 表格设置 /// </summary> protected virtual void SetColumnType() { Neusoft.HISFC.Models.Material.MaterialAddRate addRate = new Neusoft.HISFC.Models.Material.MaterialAddRate(); FarPoint.Win.Spread.CellType.ComboBoxCellType cmbAddRuleCellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType(); cmbAddRuleCellType.Items = addRate.RateKind.StringItems; this.FpMetItemAddRule_Sheet1.Columns[5].CellType = cmbAddRuleCellType; this.FpMetItemAddRule_Sheet1.Columns[0].Visible = false; this.FpMetItemAddRule_Sheet1.Columns[1].Locked = true; this.FpMetItemAddRule_Sheet1.Columns[2].Locked = true; this.FpMetItemAddRule_Sheet1.Columns[3].Locked = true; this.FpMetItemAddRule_Sheet1.Columns[4].Locked = true; this.FpMetItemAddRule_Sheet1.Columns[8].Visible = false; }
/// <summary> /// 表格列设置 /// </summary> protected virtual void SetColumnType() { Neusoft.HISFC.Models.Material.MaterialAddRate addRate = new Neusoft.HISFC.Models.Material.MaterialAddRate(); FarPoint.Win.Spread.CellType.ComboBoxCellType cmbRateKindCellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType(); FarPoint.Win.Spread.CellType.NumberCellType numType = new FarPoint.Win.Spread.CellType.NumberCellType(); FarPoint.Win.Spread.CellType.DateTimeCellType dtType = new FarPoint.Win.Spread.CellType.DateTimeCellType(); cmbRateKindCellType.Items = addRate.RateKind.StringItems; this.FpAddRate_Sheet1.Columns[0].Visible = false; this.FpAddRate_Sheet1.Columns[1].Visible = false; this.FpAddRate_Sheet1.Columns[2].CellType = cmbRateKindCellType; this.FpAddRate_Sheet1.Columns[2].Locked = true; this.FpAddRate_Sheet1.Columns[4].CellType = numType; this.FpAddRate_Sheet1.Columns[5].CellType = numType; this.FpAddRate_Sheet1.Columns[6].CellType = numType; this.FpAddRate_Sheet1.Columns[7].CellType = numType; this.FpAddRate_Sheet1.Columns[8].Visible = false; this.FpAddRate_Sheet1.Columns[9].CellType = dtType; this.FpAddRate_Sheet1.Columns[10].Visible = false; }