/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private WOFollowFieldSet EntityGet() { WOFollowFieldSet entity = new WOFollowFieldSet(); entity.ID = HTDataID; return(entity); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { WOFollowFieldSet MasterEntity = (WOFollowFieldSet)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Enum_WOFollowFieldSet WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
/// <summary> /// 删除 /// </summary> public override void EntityDelete() { WOFollowFieldSetRule rule = new WOFollowFieldSetRule(); WOFollowFieldSet entity = EntityGet(); rule.RDelete(entity); }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { WOFollowFieldSetRule rule = new WOFollowFieldSetRule(); WOFollowFieldSet entity = EntityGet(); rule.RAdd(entity); return(entity.ID); }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { WOFollowFieldSet MasterEntity = (WOFollowFieldSet)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE Enum_WOFollowFieldSet SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" WOFollowTypeID=" + SysString.ToDBString(MasterEntity.WOFollowTypeID) + ","); UpdateBuilder.Append(" FTableType=" + SysString.ToDBString(MasterEntity.FTableType) + ","); if (MasterEntity.DFieldName != 0) { UpdateBuilder.Append(" DFieldName=" + SysString.ToDBString(MasterEntity.DFieldName) + ","); } else { UpdateBuilder.Append(" DFieldName=null,"); } UpdateBuilder.Append(" DCaption=" + SysString.ToDBString(MasterEntity.DCaption) + ","); UpdateBuilder.Append(" DShowFlag=" + SysString.ToDBString(MasterEntity.DShowFlag) + ","); UpdateBuilder.Append(" UpdateMainFieldName=" + SysString.ToDBString(MasterEntity.UpdateMainFieldName) + ","); UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark)); UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private WOFollowFieldSet EntityGet() { WOFollowFieldSet entity = new WOFollowFieldSet(); entity.ID = HTDataID; entity.SelectByID(); entity.WOFollowTypeID = SysConvert.ToInt32(drpWOFollowTypeID.EditValue); entity.FTableType = SysConvert.ToInt32(txtFTableType.Text.Trim()); entity.DFieldName = SysConvert.ToInt32(txtDFieldName.Text.Trim()); entity.DCaption = txtDCaption.Text.Trim(); entity.DShowFlag = SysConvert.ToInt32(txtDShowFlag.Text.Trim()); entity.UpdateMainFieldName = txtUpdateMainFieldName.Text.Trim(); entity.Remark = txtRemark.Text.Trim(); return(entity); }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WOFollowFieldSet entity = (WOFollowFieldSet)p_BE; WOFollowFieldSetCtl control = new WOFollowFieldSetCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); WOFollowFieldSet entity = (WOFollowFieldSet)p_BE; WOFollowFieldSetCtl control = new WOFollowFieldSetCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Enum_WOFollowFieldSet, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// 设置 /// </summary> public override void EntitySet() { WOFollowFieldSet entity = new WOFollowFieldSet(); entity.ID = HTDataID; bool findFlag = entity.SelectByID(); drpWOFollowTypeID.EditValue = entity.WOFollowTypeID; txtFTableType.Text = entity.FTableType.ToString(); txtDFieldName.Text = entity.DFieldName.ToString(); txtDCaption.Text = entity.DCaption.ToString(); txtDShowFlag.Text = entity.DShowFlag.ToString(); txtUpdateMainFieldName.Text = entity.UpdateMainFieldName.ToString(); txtRemark.Text = entity.Remark.ToString(); if (!findFlag) { } }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { WOFollowFieldSet entity = (WOFollowFieldSet)p_BE; }
/// <summary> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { WOFollowFieldSet MasterEntity = (WOFollowFieldSet)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO Enum_WOFollowFieldSet("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("WOFollowTypeID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.WOFollowTypeID) + ","); MasterField.Append("FTableType" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.FTableType) + ","); MasterField.Append("DFieldName" + ","); if (MasterEntity.DFieldName != 0) { MasterValue.Append(SysString.ToDBString(MasterEntity.DFieldName) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("DCaption" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DCaption) + ","); MasterField.Append("DShowFlag" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.DShowFlag) + ","); MasterField.Append("UpdateMainFieldName" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.UpdateMainFieldName) + ","); MasterField.Append("Remark" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ")"); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }