Exemplo n.º 1
0
        public string IsTransType(int liveId)
        {
            AnalystLive model = new AnalystLive();

            model = analystLiveBLL.Get("LiveId", liveId);
            return(model.TransType);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加直播分析信息
        /// </summary>
        /// <param name="analystLive"></param>
        /// <returns></returns>
        public int AddAnalystLive(AnalystLive analystLive, int AnalystType)
        {
            if (analystLive.LiveType == 2)
            {
                analystLive.ProfitRate = EditKcInfo(analystLive.BuyLiveId, analystLive.TransPrice);
            }

            SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(SqlConnectFactory.CMS, up_AnalystLive_Insert);
            commandParameters[0].Value  = analystLive.LiveType;
            commandParameters[1].Value  = analystLive.ActualName;
            commandParameters[2].Value  = analystLive.ActualCode;
            commandParameters[3].Value  = analystLive.TransPrice;
            commandParameters[4].Value  = analystLive.TransType;
            commandParameters[5].Value  = analystLive.StopProfit;
            commandParameters[6].Value  = analystLive.StopLoss;
            commandParameters[7].Value  = analystLive.CreateTime;
            commandParameters[8].Value  = analystLive.AnalystId;
            commandParameters[9].Value  = analystLive.AnalystName;
            commandParameters[10].Value = analystLive.Info;
            commandParameters[11].Value = analystLive.ImgUrl;
            commandParameters[12].Value = analystLive.LinkUrl;
            commandParameters[13].Value = analystLive.BuyLiveId;
            commandParameters[14].Value = analystLive.ProfitRate;
            commandParameters[15].Value = analystLive.IsSell;
            SqlHelper.ExecuteNonQuery(SqlConnectFactory.CMS, CommandType.StoredProcedure, up_AnalystLive_Insert, commandParameters);
            ToatalV(analystLive.LiveType, analystLive.AnalystId, analystLive.AnalystName, AnalystType);
            return(int.Parse(commandParameters[16].Value.ToString()));
        }
Exemplo n.º 3
0
 /// <summary>
 /// 添加/编辑商品信息
 /// </summary>
 /// <param name="analystlive"></param>
 /// <param name="operateType"></param>
 /// <returns></returns>
 public int AddEditAnalystLive(AnalystLive analystlive, string operateType, int AnalystType)
 {
     if (operateType == "add")
     {
         return(dal.AddAnalystLive(analystlive, AnalystType));
     }
     else
     {
         return(dal.EditAnalystLive(analystlive, AnalystType));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 获取开多/开空/盈利/亏损/成功次数/比例
        /// </summary>
        /// <param name="AnalystId"></param>
        /// <returns></returns>
        public AnalystLive GetTransStatisticsNum(int AnalystId)
        {
            string      sql   = "";
            AnalystLive model = new AnalystLive();

            SqlParameter[] parsms = new SqlParameter[] { new SqlParameter("@AnalystId", AnalystId) };
            sql = "select ProfitNum,LossNum,SuccessRate,MarkupBuyNum,FallBuyNum from TransStatistics where AnalystId=@AnalystId";
            using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlConnectFactory.CMS, CommandType.Text, sql, parsms))
            {
                if (dr.Read())
                {
                    model.ProfitNum   = int.Parse(dr["ProfitNum"].ToString());
                    model.LossNum     = int.Parse(dr["LossNum"].ToString());
                    model.SuccessRate = Decimal.Parse(dr["SuccessRate"].ToString());
                    model.BigNum      = int.Parse(dr["MarkupBuyNum"].ToString());
                    model.EmptyNum    = int.Parse(dr["FallBuyNum"].ToString());
                }
            }
            return(model);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 删除单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Delete(AnalystLive obj)
 {
     return(dal.Delete(obj));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 更新单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Update(AnalystLive obj)
 {
     return(dal.Update(obj));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 添加单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Add(AnalystLive obj)
 {
     return(dal.Add(obj));
 }
Exemplo n.º 8
0
        public string AddEditAnalystLive(AnalystLive analystlive, int pc_LiveId, string pc_ActualCode, string pc_ActualName, string operate, int AnalystType)
        {
            analystlive.AnalystName = analystlive.AnalystName;
            analystlive.AnalystId   = analystlive.AnalystId;
            analystlive.Info        = analystlive.Content;
            if (analystlive.LiveType == 0)
            {
                return("000001");  //请选择一个操作类型
            }
            else if (analystlive.LiveType == 1 || analystlive.LiveType == 2)
            {
                if (analystlive.TransType == "0")
                {
                    return("000002"); //请选择一个交易类型
                }
            }
            if (analystlive.LiveType == 1)
            {
                if (operate == "add")
                {
                    if (string.IsNullOrEmpty(analystlive.ActualName.ToString()))
                    {
                        return("000005");
                    }
                }
                else
                {
                    analystlive.ActualName = pc_ActualName;
                }
            }
            else if (analystlive.LiveType == 2)
            {
                if (string.IsNullOrEmpty(pc_ActualName.ToString()))
                {
                    return("000005");
                }
            }
            else
            {
                if (string.IsNullOrEmpty(analystlive.Info))
                {
                    return("000006");
                }
            }
            if (!string.IsNullOrEmpty(analystlive.Info))
            {
                if (StringHelper.WipeHtml(analystlive.Info).Length > 2000)
                {
                    return("000007");
                }
            }
            if (string.IsNullOrEmpty(analystlive.TransPrice.ToString()) && analystlive.LiveType != 3)
            {
                return("000003");
            }
            try
            {
                Convert.ToDecimal(analystlive.TransPrice);
            }
            catch
            {
                return("000003");
            }
            if (analystlive.LiveType == 1)
            {
                try
                {
                    if (!string.IsNullOrEmpty(analystlive.StopProfit.ToString()) || !string.IsNullOrEmpty(analystlive.StopLoss.ToString()))
                    {
                        Convert.ToDecimal(analystlive.StopProfit);
                        Convert.ToDecimal(analystlive.StopLoss);
                    }
                }
                catch
                {
                    return("000003");
                }
                if (string.IsNullOrEmpty(analystlive.IsSell.ToString()))
                {
                    analystlive.IsSell = 0;
                }
                //if(analystLiveBLL.IsSell(analystlive.ActualCode))
                //{
                //    return "000004";  //这个商品已经开仓过还未平仓
                //}
            }
            else if (analystlive.LiveType == 2)
            {
                if (string.IsNullOrEmpty(pc_ActualName))
                {
                    return("000005");
                }
                else
                {
                    analystlive.ActualName = pc_ActualName;
                }

                analystlive.IsSell     = 1;
                analystlive.ActualCode = pc_ActualCode;
                analystlive.BuyLiveId  = pc_LiveId;
            }
            else
            {
                analystlive.TransType = "观点";
            }
            if (string.IsNullOrEmpty(analystlive.CreateTime.ToString()))
            {
                analystlive.CreateTime = DateTime.Now;
            }
            int result = analystLiveBLL.AddEditAnalystLive(analystlive, operate, AnalystType);

            MakeData();
            return(result.ToString());
        }