//========================================================================= // FunctionName : Query /// <summary> /// 检索方法 /// </summary> /// <param name="appData">应用数据实体</param> /// <returns>返回数据实体对象</returns> //========================================================================= public DictionaryApplicationData Query(DictionaryApplicationData appData) { DictionaryBusinessEntity instanceDictionaryBusinessEntity = (DictionaryBusinessEntity)CreateBusinessEntityInstance(typeof(DictionaryBusinessEntity)); instanceDictionaryBusinessEntity.AppData = appData; if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK) { instanceDictionaryBusinessEntity.SelectByKey(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID) { instanceDictionaryBusinessEntity.SelectByObjectID(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL) { instanceDictionaryBusinessEntity.SelectByAnyCondition(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else { instanceDictionaryBusinessEntity.SelectByAnyCondition(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } return(instanceDictionaryBusinessEntity.AppData); }
//========================================================================= // FunctionName : Count /// <summary> /// 统计记录数方法 /// </summary> /// <param name="appData">应用数据实体</param> /// <returns>返回数据实体对象</returns> //========================================================================= public DictionaryApplicationData Count(DictionaryApplicationData appData) { DictionaryBusinessEntity instanceDictionaryBusinessEntity = (DictionaryBusinessEntity)CreateBusinessEntityInstance(typeof(DictionaryBusinessEntity)); instanceDictionaryBusinessEntity.AppData = appData; instanceDictionaryBusinessEntity.CountByAnyCondition(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; return(instanceDictionaryBusinessEntity.AppData); }
//========================================================================= // FunctionName : Modify /// <summary> /// 更新方法 /// </summary> /// <param name="appData">应用数据实体</param> /// <returns>返回数据实体对象</returns> //========================================================================= public DictionaryApplicationData Modify(DictionaryApplicationData appData) { DictionaryBusinessEntity instanceDictionaryBusinessEntity = (DictionaryBusinessEntity)CreateBusinessEntityInstance(typeof(DictionaryBusinessEntity)); instanceDictionaryBusinessEntity.AppData = appData; if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK) { if (instanceDictionaryBusinessEntity.IsExistByKey() == true) { instanceDictionaryBusinessEntity.UpdateByKey(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else { instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure; } } else if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID) { if (instanceDictionaryBusinessEntity.IsExistByObjectID() == true) { instanceDictionaryBusinessEntity.UpdateByObjectID(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else { instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure; } } else if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.BATCH) { instanceDictionaryBusinessEntity.UpdateByObjectIDBatch(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else if (instanceDictionaryBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL) { instanceDictionaryBusinessEntity.UpdateByAnyCondition(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else { if (instanceDictionaryBusinessEntity.IsExistByObjectID() == true) { instanceDictionaryBusinessEntity.UpdateByObjectID(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else { instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure; } } return(instanceDictionaryBusinessEntity.AppData); }
//===================================================================== // FunctionName : GetDataByObjectID /// <summary> /// 以ObjectID为条件查询记录并返回AppData /// </summary> //===================================================================== public static DictionaryApplicationData GetDataByObjectID(string strObjectID) { // 创建数据库连接 Database db = DatabaseFactory.CreateDatabase("strConnManager"); string strProcName = "SP_SelectDictionaryByObjectID"; DbCommand cmdProc = db.GetStoredProcCommand(strProcName); // 设定存储过程输入参数 db.AddInParameter(cmdProc, "@ObjectID", DbType.String); // 对存储过程参数赋值 db.SetParameterValue(cmdProc, "@ObjectID", strObjectID); // 执行存储过程 return(DictionaryApplicationData.FillDataFromDataReader(db.ExecuteReader(cmdProc))); }
//========================================================================= // FunctionName : Add /// <summary> /// 添加方法 /// </summary> /// <param name="appData">应用数据实体</param> /// <returns>返回数据实体对象</returns> //========================================================================= public DictionaryApplicationData Add(DictionaryApplicationData appData) { DictionaryBusinessEntity instanceDictionaryBusinessEntity = (DictionaryBusinessEntity)CreateBusinessEntityInstance(typeof(DictionaryBusinessEntity)); instanceDictionaryBusinessEntity.AppData = appData; if (instanceDictionaryBusinessEntity.IsExistByKey() == false) { instanceDictionaryBusinessEntity.Insert(); instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed; } else { instanceDictionaryBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure; } return(instanceDictionaryBusinessEntity.AppData); }
public static IEnumerable <DictionaryApplicationData> GetCollectionFromImportDataTable(DataTable dt) { List <DictionaryApplicationData> collection = new List <DictionaryApplicationData>(); foreach (DataRow dr in dt.Rows) { DictionaryApplicationData applicationData = new DictionaryApplicationData() { ObjectID = (dr.ReadGuidNullable("ObjectID") == null ? null : dr.ReadGuidNullable("ObjectID").ToString()), DM = dr.ReadString("DM"), LX = dr.ReadString("LX"), MC = dr.ReadString("MC"), SJDM = dr.ReadString("SJDM"), SM = dr.ReadString("SM"), }; collection.Add(applicationData); } return(collection); }