コード例 #1
0
        /// <summary>
        /// 根据商品代码获取熔断触发比例 如果没有找到要熔断对象则返回默认值
        /// </summary>
        public decimal GetFuseTriggeringScaleByCommodityCode(string commodityCode)
        {
            CM_CommodityFuse model = CommonDataCacheProxy.Instanse.GetCacheCommodityFuseByCode(commodityCode);

            if (model == null)
            {
                return(RulesDefaultValue.DefaultFuseScale);
            }
            else
            {
                return((decimal)model.TriggeringScale);
            }
        }
コード例 #2
0
 /// <summary>
 /// 修改可交易商品_熔断
 /// </summary>
 /// <param name="model">可交易商品_熔断实体</param>
 /// <returns></returns>
 public bool UpdateCMCommodityFuse(CM_CommodityFuse model)
 {
     try
     {
         return(cM_CommodityFuseDAL.Update(model));
     }
     catch (Exception ex)
     {
         string      errCode   = "GL-6702";
         string      errMsg    = " 修改可交易商品_熔断失败!";
         VTException exception = new VTException(errCode, errMsg, ex);
         LogHelper.WriteError(exception.ToString(), exception.InnerException);
         return(false);
     }
 }
コード例 #3
0
        /// <summary>
        /// 确定按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (m_EditType == 1)
            {
                #region 添加操作

                try
                {
                    CM_CommodityFuse cM_CommodityFuse = new CM_CommodityFuse();
                    if (CommonParameterSetCommon.ExistsCommodityCode(this.cmbCommodityCode.Text))
                    {
                        ShowMessageBox.ShowInformation("此代码的熔断已存在!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.cmbCommodityCode.Text))
                    {
                        cM_CommodityFuse.CommodityCode = this.cmbCommodityCode.SelectedItem.ToString();
                    }
                    else
                    {
                        //cM_CommodityFuse.CommodityCode = AppGlobalVariable.INIT_STRING;
                        ShowMessageBox.ShowInformation("请选择代码!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.txTriggeringScale.Text))
                    {
                        //cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text);
                        if (InputTest.DecimalTest(this.txTriggeringScale.Text))
                        {
                            cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入数字或小数点!");
                            return;
                        }
                    }
                    else
                    {
                        //cM_CommodityFuse.TriggeringScale = AppGlobalVariable.INIT_DECIMAL;
                        ShowMessageBox.ShowInformation("触发比例不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtFuseTimeOfDay.Text))
                    {
                        if (InputTest.intTest(this.txtFuseTimeOfDay.Text))
                        {
                            cM_CommodityFuse.FuseTimeOfDay = Convert.ToInt32(this.txtFuseTimeOfDay.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入整数!");
                            return;
                        }
                    }
                    else
                    {
                        // cM_CommodityFuse.FuseTimeOfDay = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("熔断次数不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtTriggeringDuration.Text))
                    {
                        //cM_CommodityFuse.TriggeringDuration = Convert.ToInt32(this.txtTriggeringDuration.Text);
                        if (InputTest.intTest(this.txtTriggeringDuration.Text))
                        {
                            cM_CommodityFuse.TriggeringDuration = Convert.ToInt32(this.txtTriggeringDuration.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入整数!");
                            return;
                        }
                    }
                    else
                    {
                        //cM_CommodityFuse.TriggeringDuration = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("触发持续时间限制不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtFuseDurationLimit.Text))
                    {
                        if (InputTest.intTest(this.txtFuseDurationLimit.Text))
                        {
                            cM_CommodityFuse.FuseDurationLimit = Convert.ToInt32(this.txtFuseDurationLimit.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入整数!");
                            return;
                        }
                    }
                    else
                    {
                        // cM_CommodityFuse.FuseDurationLimit = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("熔断持续时间限制不能为空!");
                        return;
                    }
                    m_Result = CommonParameterSetCommon.AddCMCommodityFuse(cM_CommodityFuse);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("添加成功!");
                        this.ClearAll();
                        this.QueryCMCommodityFuse();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("添加失败!");
                    }
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-6801";
                    string      errMsg    = "添加可交易商品_熔断失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion
            }
            else if (m_EditType == 2)
            {
                #region 修改操作

                try
                {
                    CM_CommodityFuse cM_CommodityFuse = new CM_CommodityFuse();
                    if (m_CommodityCode == AppGlobalVariable.INIT_STRING)
                    {
                        ShowMessageBox.ShowInformation("请选择更新数据!");
                        return;
                    }
                    cM_CommodityFuse.CommodityCode = this.cmbCommodityCode.SelectedItem.ToString();
                    //cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text);
                    if (!string.IsNullOrEmpty(this.txTriggeringScale.Text))
                    {
                        if (InputTest.DecimalTest(this.txTriggeringScale.Text))
                        {
                            cM_CommodityFuse.TriggeringScale = Convert.ToDecimal(this.txTriggeringScale.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入数字或小数点!");
                            return;
                        }
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("触发比例不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtFuseTimeOfDay.Text))
                    {
                        if (InputTest.intTest(this.txtFuseTimeOfDay.Text))
                        {
                            cM_CommodityFuse.FuseTimeOfDay = Convert.ToInt32(this.txtFuseTimeOfDay.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入整数!");
                            return;
                        }
                    }
                    else
                    {
                        //cM_CommodityFuse.FuseTimeOfDay = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("熔断次数不能为空!");
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.txtTriggeringDuration.Text))
                    {
                        if (InputTest.intTest(this.txtTriggeringDuration.Text))
                        {
                            cM_CommodityFuse.TriggeringDuration = Convert.ToInt32(this.txtTriggeringDuration.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入整数!");
                            return;
                        }
                    }
                    else
                    {
                        //cM_CommodityFuse.TriggeringDuration = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("触发持续时间限制不能为空!");
                        return;
                    }

                    if (!string.IsNullOrEmpty(this.txtFuseDurationLimit.Text))
                    {
                        if (InputTest.intTest(this.txtFuseDurationLimit.Text))
                        {
                            cM_CommodityFuse.FuseDurationLimit = Convert.ToInt32(this.txtFuseDurationLimit.Text);
                        }
                        else
                        {
                            ShowMessageBox.ShowInformation("请输入整数!");
                            return;
                        }
                    }
                    else
                    {
                        //cM_CommodityFuse.FuseDurationLimit = AppGlobalVariable.INIT_INT;
                        ShowMessageBox.ShowInformation("熔断持续时间限制不能为空!");
                        return;
                    }
                    m_Result = CommonParameterSetCommon.UpdateCMCommodityFuse(cM_CommodityFuse);
                    if (m_Result)
                    {
                        ShowMessageBox.ShowInformation("修改成功!");
                        this.ClearAll();
                    }
                    else
                    {
                        ShowMessageBox.ShowInformation("修改失败!");
                    }
                    this.QueryCMCommodityFuse();
                    this.cmbCommodityCode.Enabled = true;
                }
                catch (Exception ex)
                {
                    string      errCode   = "GL-6802";
                    string      errMsg    = "修改可交易商品_熔断失败!";
                    VTException exception = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(exception.ToString(), exception.InnerException);
                    return;
                }

                #endregion
            }
        }
コード例 #4
0
        /// <summary>
        /// 修改涨跌幅状态
        /// </summary>
        /// <param name="code">代码</param>
        public void ModifyState(string code)
        {
            //熔断实体是否存在
            //判断当前时间是否启动熔断时间
            if (!FuseManager.Instanse.CompareNowTimeIsFuseTime(code))
            {
                //初始化熔断
                InitFuseEntity(code);
                return;
            }
            //管理中心熔断初始化数据
            CM_CommodityFuse fuse = CommonDataCacheProxy.Instanse.GetCacheCommodityFuseByCode(code);

            if (fuse == null)
            {
                return;
            }

            //修改熔断实体
            lock (((ICollection)MatchCenterManager.Instance.FuseHanderEntityList).SyncRoot)
            {
                FuseHanderEntity entity = MatchCenterManager.Instance.FuseHanderEntityList[code];
                if (entity == null)
                {
                    return;
                }
                //是否产生熔断
                if (entity.IsFuse)
                {
                    //熔断持续时间
                    // int FuseContinuTime = CalculationTime(entity.FuseTime);
                    int FuseContinuTime = (int)Utils.TimeSpanSecondsToNowDateTime(entity.FuseTime);
                    if (FuseContinuTime >= fuse.FuseDurationLimit * 60)
                    {
                        //是否产生熔断
                        entity.IsFuse    = false;
                        entity.PriorFuse = false;
                    }
                }
                else
                {
                    //涨跌幅判断标志
                    if (entity.PriorFuse)
                    {
                        //if (JudgePrice((decimal) fuse.TriggeringScale, code))
                        if (FuseManager.Instanse.CompareHQScaleIsFuse((decimal)fuse.TriggeringScale, code))
                        {
                            //int contrinueTime = CalculationTime(entity.FuseTime);
                            int contrinueTime = (int)Utils.TimeSpanSecondsToNowDateTime(entity.FuseTime);
                            if (contrinueTime >= fuse.TriggeringDuration * 60 && entity.FuseCount < fuse.FuseTimeOfDay)
                            {
                                //熔断数量
                                entity.FuseCount = entity.FuseCount + 1;
                                //熔断标志
                                entity.IsFuse = true;
                                //熔断启动时间
                                entity.StartFuseTime = DateTime.Now;
                            }
                        }
                    }
                    else
                    {
                        //熔断涨跌幅度判断
                        if (FuseManager.Instanse.CompareHQScaleIsFuse((decimal)fuse.TriggeringScale, code))
                        {
                            entity.PriorFuse = true;
                            entity.FuseTime  = DateTime.Now;
                        }
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// 修改可交易商品_熔断
        /// </summary>
        /// <param name="model">可交易商品_熔断实体</param>
        /// <returns></returns>
        public static bool UpdateCMCommodityFuse(CM_CommodityFuse model)
        {
            CM_CommodityFuseBLL cM_CommodityFuseBLL = new CM_CommodityFuseBLL();

            return(cM_CommodityFuseBLL.UpdateCMCommodityFuse(model));
        }