Exemplo n.º 1
0
        /// <summary>
        /// 添加现货最小变动价位范围值
        /// </summary>
        /// <param name="xH_MinChangePriceValue">最小变动价位实体</param>
        /// <param name="cM_FieldRange">字段范围实体</param>
        /// <returns></returns>
        public bool AddXHMinChangePriceValue(XH_MinChangePriceValue xH_MinChangePriceValue, CM_FieldRange cM_FieldRange)
        {
            CM_FieldRangeDAL          cMFieldRangeDAL          = new CM_FieldRangeDAL();
            XH_MinChangePriceValueDAL xHMinChangePriceValueDAL = new XH_MinChangePriceValueDAL();
            DbConnection Conn = null;
            Database     db   = DatabaseFactory.CreateDatabase();

            Conn = db.CreateConnection();
            if (Conn.State != ConnectionState.Open)
            {
                Conn.Open();
            }
            DbTransaction Tran = Conn.BeginTransaction();

            int fieldRangeID = AppGlobalVariable.INIT_INT;

            try
            {
                fieldRangeID = cMFieldRangeDAL.Add(cM_FieldRange, Tran, db);

                if (fieldRangeID != AppGlobalVariable.INIT_INT)
                {
                    xH_MinChangePriceValue.FieldRangeID = fieldRangeID;

                    xHMinChangePriceValueDAL.Add(xH_MinChangePriceValue, Tran, db);

                    Tran.Commit();
                }

                return(true);
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                string      errCode   = "GL-5320";
                string      errMsg    = "添加现货最小变动价位范围值失败!";
                VTException exception = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(exception.ToString(), exception.InnerException);
                return(false);
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加现货交易费用交易手续费
        /// </summary>
        /// <param name="xH_SpotRangeCost">现货交易手续费实体</param>
        /// <param name="cM_FieldRange">字段范围实体</param>
        /// <returns></returns>
        public bool AddXHSpotRangeCost(XH_SpotRangeCost xH_SpotRangeCost, CM_FieldRange cM_FieldRange)
        {
            CM_FieldRangeDAL    cMFieldRangeDAL    = new CM_FieldRangeDAL();
            XH_SpotRangeCostDAL xHSpotRangeCostDAL = new XH_SpotRangeCostDAL();
            DbConnection        Conn = null;
            Database            db   = DatabaseFactory.CreateDatabase();

            Conn = db.CreateConnection();
            if (Conn.State != ConnectionState.Open)
            {
                Conn.Open();
            }
            DbTransaction Tran = Conn.BeginTransaction();

            int fieldRangeID = AppGlobalVariable.INIT_INT;

            try
            {
                fieldRangeID = cMFieldRangeDAL.Add(cM_FieldRange, Tran, db);

                if (fieldRangeID != AppGlobalVariable.INIT_INT)
                {
                    //xH_SpotRangeCost.FieldRangeID = fieldRangeID;

                    xHSpotRangeCostDAL.Add(xH_SpotRangeCost, Tran, db);

                    Tran.Commit();
                }

                return(true);
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                LogHelper.WriteError(ex.Message, ex);
                return(false);
            }
            finally
            {
                if (Conn != null && Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
            }
        }