//=========================================================================
        //  FunctionName : Query
        /// <summary>
        /// 检索方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public ShortMessageApplicationData Query(ShortMessageApplicationData appData)
        {
            ShortMessageBusinessEntity instanceShortMessageBusinessEntity = (ShortMessageBusinessEntity)CreateBusinessEntityInstance(typeof(ShortMessageBusinessEntity));

            instanceShortMessageBusinessEntity.AppData = appData;
            if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK)
            {
                instanceShortMessageBusinessEntity.SelectByKey();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID)
            {
                instanceShortMessageBusinessEntity.SelectByObjectID();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL)
            {
                instanceShortMessageBusinessEntity.SelectByAnyCondition();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                instanceShortMessageBusinessEntity.SelectByAnyCondition();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            return(instanceShortMessageBusinessEntity.AppData);
        }
        public static IEnumerable <ShortMessageApplicationData> GetCollectionFromImportDataTable(DataTable dt)
        {
            List <ShortMessageApplicationData> collection = new List <ShortMessageApplicationData>();

            foreach (DataRow dr in dt.Rows)
            {
                ShortMessageApplicationData applicationData = new ShortMessageApplicationData()
                {
                    ObjectID = (dr.ReadGuidNullable("ObjectID") == null ? null : dr.ReadGuidNullable("ObjectID").ToString()),
                    DXXBT    = dr.ReadString("DXXBT"),
                    DXXLX    = dr.ReadString("DXXLX"),
                    DXXNR    = dr.ReadString("DXXNR"),
                    DXXFJ    = dr.ReadString("DXXFJ"),
                    FSSJ     = dr.ReadDateTimeNullable("FSSJ"),
                    FSR      = dr.ReadString("FSR"),
                    FSBM     = dr.ReadString("FSBM"),
                    FSIP     = dr.ReadString("FSIP"),
                    JSR      = dr.ReadString("JSR"),
                    SFCK     = dr.ReadBooleanNullable("SFCK"),
                    CKSJ     = dr.ReadDateTimeNullable("CKSJ"),
                };
                collection.Add(applicationData);
            }
            return(collection);
        }
        //=========================================================================
        //  FunctionName : Count
        /// <summary>
        /// 统计记录数方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public ShortMessageApplicationData Count(ShortMessageApplicationData appData)
        {
            ShortMessageBusinessEntity instanceShortMessageBusinessEntity = (ShortMessageBusinessEntity)CreateBusinessEntityInstance(typeof(ShortMessageBusinessEntity));

            instanceShortMessageBusinessEntity.AppData = appData;
            instanceShortMessageBusinessEntity.CountByAnyCondition();
            instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            return(instanceShortMessageBusinessEntity.AppData);
        }
        //=========================================================================
        //  FunctionName : Modify
        /// <summary>
        /// 更新方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public ShortMessageApplicationData Modify(ShortMessageApplicationData appData)
        {
            ShortMessageBusinessEntity instanceShortMessageBusinessEntity = (ShortMessageBusinessEntity)CreateBusinessEntityInstance(typeof(ShortMessageBusinessEntity));

            instanceShortMessageBusinessEntity.AppData = appData;
            if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK)
            {
                if (instanceShortMessageBusinessEntity.IsExistByKey() == true)
                {
                    instanceShortMessageBusinessEntity.UpdateByKey();
                    instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
                }
                else
                {
                    instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
                }
            }
            else if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID)
            {
                if (instanceShortMessageBusinessEntity.IsExistByObjectID() == true)
                {
                    instanceShortMessageBusinessEntity.UpdateByObjectID();
                    instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
                }
                else
                {
                    instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
                }
            }
            else if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.BATCH)
            {
                instanceShortMessageBusinessEntity.UpdateByObjectIDBatch();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceShortMessageBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL)
            {
                instanceShortMessageBusinessEntity.UpdateByAnyCondition();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                if (instanceShortMessageBusinessEntity.IsExistByObjectID() == true)
                {
                    instanceShortMessageBusinessEntity.UpdateByObjectID();
                    instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
                }
                else
                {
                    instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
                }
            }
            return(instanceShortMessageBusinessEntity.AppData);
        }
Beispiel #5
0
        //=====================================================================
        //  FunctionName : GetDataByObjectID
        /// <summary>
        /// 以ObjectID为条件查询记录并返回AppData
        /// </summary>
        //=====================================================================
        public static ShortMessageApplicationData GetDataByObjectID(string strObjectID)
        {
            // 创建数据库连接
            Database  db          = DatabaseFactory.CreateDatabase("strConnManager");
            string    strProcName = "SP_SelectShortMessageByObjectID";
            DbCommand cmdProc     = db.GetStoredProcCommand(strProcName);

            // 设定存储过程输入参数
            db.AddInParameter(cmdProc, "@ObjectID", DbType.String);
            // 对存储过程参数赋值
            db.SetParameterValue(cmdProc, "@ObjectID", strObjectID);
            // 执行存储过程
            return(ShortMessageApplicationData.FillDataFromDataReader(db.ExecuteReader(cmdProc)));
        }
        //=========================================================================
        //  FunctionName : Add
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public ShortMessageApplicationData Add(ShortMessageApplicationData appData)
        {
            ShortMessageBusinessEntity instanceShortMessageBusinessEntity = (ShortMessageBusinessEntity)CreateBusinessEntityInstance(typeof(ShortMessageBusinessEntity));

            instanceShortMessageBusinessEntity.AppData = appData;
            if (instanceShortMessageBusinessEntity.IsExistByKey() == false)
            {
                instanceShortMessageBusinessEntity.Insert();
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                instanceShortMessageBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Failure;
            }
            return(instanceShortMessageBusinessEntity.AppData);
        }