Exemplo n.º 1
0
        //=========================================================================
        //  FunctionName : AutoGenerateBMBH
        /// <summary>
        /// 自动生成BMBH编号方法
        /// </summary>
        /// <returns>返回BMBH新编号</returns>
        //=========================================================================
        public string AutoGenerateBMBH(T_BM_BMXXApplicationData appData)
        {
            int    intNumberLength = 8;
            string strPrefix       = ("BM").ToString();

            strPrefix = strPrefix.ToLower() == "null" ? "" : strPrefix;
            T_BM_BMXXBusinessEntity instanceT_BM_BMXXBusinessEntity = (T_BM_BMXXBusinessEntity)CreateBusinessEntityInstance(typeof(T_BM_BMXXBusinessEntity));
            string        strMaxValue;
            StringBuilder sbNewID = new StringBuilder(string.Empty);

            sbNewID.Append(strPrefix);

            strMaxValue = instanceT_BM_BMXXBusinessEntity.GetMaxValue(strPrefix, intNumberLength).ToString();
            if (strMaxValue != String.Empty)
            {
                if (strMaxValue.Length == strPrefix.Length + intNumberLength)
                {
                    int intMaxValue = Convert.ToInt32(strMaxValue.Substring(strPrefix.Length, intNumberLength)) + 1;
                    sbNewID.Append(FillZeroToString(intMaxValue.ToString(), intNumberLength));
                }
                else
                {
                    sbNewID.Append(FillZeroToString("1", intNumberLength));
                }
            }
            else
            {
                sbNewID.Append(FillZeroToString("1", intNumberLength));
            }

            return(sbNewID.ToString());
        }
Exemplo n.º 2
0
        //=========================================================================
        //  FunctionName : Query
        /// <summary>
        /// 检索方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_BM_BMXXApplicationData Query(T_BM_BMXXApplicationData appData)
        {
            T_BM_BMXXBusinessEntity instanceT_BM_BMXXBusinessEntity = (T_BM_BMXXBusinessEntity)CreateBusinessEntityInstance(typeof(T_BM_BMXXBusinessEntity));

            instanceT_BM_BMXXBusinessEntity.AppData = appData;
            if (instanceT_BM_BMXXBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.PK)
            {
                instanceT_BM_BMXXBusinessEntity.SelectByKey();
                instanceT_BM_BMXXBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceT_BM_BMXXBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ID)
            {
                instanceT_BM_BMXXBusinessEntity.SelectByObjectID();
                instanceT_BM_BMXXBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else if (instanceT_BM_BMXXBusinessEntity.AppData.OPCode == ApplicationDataBase.OPType.ALL)
            {
                instanceT_BM_BMXXBusinessEntity.SelectByAnyCondition();
                instanceT_BM_BMXXBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            else
            {
                instanceT_BM_BMXXBusinessEntity.SelectByAnyCondition();
                instanceT_BM_BMXXBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            }
            return(instanceT_BM_BMXXBusinessEntity.AppData);
        }
Exemplo n.º 3
0
        public static IEnumerable <T_BM_BMXXApplicationData> GetCollectionFromImportDataTable(DataTable dt)
        {
            List <T_BM_BMXXApplicationData> collection = new List <T_BM_BMXXApplicationData>();

            foreach (DataRow dr in dt.Rows)
            {
                T_BM_BMXXApplicationData applicationData = new T_BM_BMXXApplicationData()
                {
                    ObjectID = (dr.ReadGuidNullable("ObjectID") == null ? null : dr.ReadGuidNullable("ObjectID").ToString()),
                    BMBH     = dr.ReadString("BMBH"),
                    HYBH     = dr.ReadString("HYBH"),
                    KCJG     = dr.ReadDoubleNullable("KCJG"),
                    KSS      = dr.ReadInt32Nullable("KSS"),
                    KCZK     = dr.ReadDoubleNullable("KCZK"),
                    SJJG     = dr.ReadDoubleNullable("SJJG"),
                    SKR      = dr.ReadString("SKR"),
                    BMSJ     = dr.ReadDateTimeNullable("BMSJ"),
                    BZ       = dr.ReadString("BZ"),
                    LRR      = dr.ReadString("LRR"),
                    LRSJ     = dr.ReadDateTimeNullable("LRSJ"),
                };
                collection.Add(applicationData);
            }
            return(collection);
        }
Exemplo n.º 4
0
        //=========================================================================
        //  FunctionName : Count
        /// <summary>
        /// 统计记录数方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_BM_BMXXApplicationData Count(T_BM_BMXXApplicationData appData)
        {
            T_BM_BMXXBusinessEntity instanceT_BM_BMXXBusinessEntity = (T_BM_BMXXBusinessEntity)CreateBusinessEntityInstance(typeof(T_BM_BMXXBusinessEntity));

            instanceT_BM_BMXXBusinessEntity.AppData = appData;
            instanceT_BM_BMXXBusinessEntity.CountByAnyCondition();
            instanceT_BM_BMXXBusinessEntity.AppData.ResultCode = ApplicationDataBase.ResultState.Succeed;
            return(instanceT_BM_BMXXBusinessEntity.AppData);
        }
Exemplo n.º 5
0
        //=========================================================================
        //  FunctionName : Modify
        /// <summary>
        /// 更新方法
        /// </summary>
        /// <param name="appData">应用数据实体</param>
        /// <returns>返回数据实体对象</returns>
        //=========================================================================
        public T_BM_BMXXApplicationData Modify(T_BM_BMXXApplicationData appData)
        {
            T_BM_BMXXBusinessEntity instanceT_BM_BMXXBusinessEntity = (T_BM_BMXXBusinessEntity)CreateBusinessEntityInstance(typeof(T_BM_BMXXBusinessEntity));

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

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

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