Esempio n. 1
0
 /// <summary>
 /// 根据商品代码获取熔断_时间段标识
 /// </summary>
 /// <param name="CommodityCode">商品代码</param>
 /// <returns></returns>
 public DataSet GetCMFuseTimesectionByCommodityCode(string CommodityCode)
 {
     try
     {
         CM_FuseTimesectionDAL cMFuseTimesectionDAL = new CM_FuseTimesectionDAL();
         return(cMFuseTimesectionDAL.GetCMFuseTimesectionByCommodityCode(CommodityCode));
     }
     catch (Exception ex)
     {
         string      errCode   = "GL-6725";
         string      errMsg    = "根据商品代码获取所有熔断_时间段标识失败!";
         VTException exception = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(exception.ToString(), exception.InnerException);
         return(null);
     }
 }
        /// <summary>
        /// 删除可交易商品_熔断(同时删除同一商品代码的熔断_时间段标识表中的记录)
        /// </summary>
        /// <param name="CommodityCode">商品代码</param>
        /// <returns></returns>
        public bool DeleteCMCommodityFuseAbout(string CommodityCode)
        {
            CM_CommodityFuseDAL   cMCommodityFuseDAL   = new CM_CommodityFuseDAL();
            CM_FuseTimesectionDAL cMFuseTimesectionDAL = new CM_FuseTimesectionDAL();
            DbConnection          Conn = null;
            Database db = DatabaseFactory.CreateDatabase();

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

            try
            {
                if (!string.IsNullOrEmpty(CommodityCode))
                {
                    if (cMFuseTimesectionDAL.DeleteByCommodityCode(CommodityCode, Tran, db))
                    {
                        if (cMCommodityFuseDAL.Delete(CommodityCode, Tran, db))
                        {
                            Tran.Commit();
                            return(true);
                        }
                    }
                }
                Tran.Rollback();
                return(false);
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                string      errCode   = "GL-6704";
                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();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 根据商品代码删除交易商品(相关表的记录同时删除)
        /// </summary>
        /// <param name="CommodityCode">商品代码</param>
        /// <param name="BreedClassID">品种ID</param>
        /// <returns></returns>
        public bool DeleteCMCommodity(string CommodityCode, int BreedClassID)
        {
            CM_CommodityDAL            cMCommodityDAL          = new CM_CommodityDAL();
            RC_TradeCommodityAssignDAL TradeCommodityAssignDAL = new RC_TradeCommodityAssignDAL();
            CM_CommodityFuseDAL        cMCommodityFuseDAL      = new CM_CommodityFuseDAL();
            CM_FuseTimesectionDAL      cMFuseTimesectionDAL    = new CM_FuseTimesectionDAL();
            CM_BreedClassBLL           cM_BreedClassBLL        = new CM_BreedClassBLL();
            DbConnection Conn = null;
            Database     db   = DatabaseFactory.CreateDatabase();

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

            try
            {
                int breedClassTypeID = AppGlobalVariable.INIT_INT;//品种类型ID
                List <CM_BreedClass> cM_BreedClassList =
                    cM_BreedClassBLL.GetListArray(string.Format("BreedClassID={0}", BreedClassID));
                if (cM_BreedClassList.Count > 0)
                {
                    CM_BreedClass cM_BreedClass = cM_BreedClassList[0];
                    if (cM_BreedClass != null)
                    {
                        breedClassTypeID = Convert.ToInt32(cM_BreedClass.BreedClassTypeID);
                    }
                }
                if (breedClassTypeID == (int)GTA.VTS.Common.CommonObject.Types.BreedClassTypeEnum.StockIndexFuture)
                {
                    if (!string.IsNullOrEmpty(CommodityCode))
                    {
                        if (!cMFuseTimesectionDAL.DeleteByCommodityCode(CommodityCode, Tran, db))
                        {
                            Tran.Rollback();
                            return(false);
                        }
                        else
                        {
                            if (!cMCommodityFuseDAL.Delete(CommodityCode, Tran, db))
                            {
                                Tran.Rollback();
                                return(false);
                            }
                        }
                    }
                    TradeCommodityAssignDAL.DeleteByCommodityCode(CommodityCode, Tran, db);
                    if (!cMCommodityDAL.Delete(CommodityCode, Tran, db))
                    {
                        Tran.Rollback();
                        return(false);
                    }
                }
                else
                {
                    TradeCommodityAssignDAL.DeleteByCommodityCode(CommodityCode, Tran, db);
                    if (!cMCommodityDAL.Delete(CommodityCode, Tran, db))
                    {
                        Tran.Rollback();
                        return(false);
                    }
                }
                Tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                Tran.Rollback();
                string      errCode   = "GL-4301";
                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();
                }
            }
        }