Exemplo n.º 1
0
    /// <summary>
    /// 推送消息
    /// </summary>
    /// <param name="msgID">操作单</param>
    public void GetMsgService(string msgID, string type)
    {
        try
        {
            MsgID   = msgID.Trim();
            MsgType = type.Trim();
            Hi.Model.BD_CompNews order = new Hi.BLL.BD_CompNews().GetModel(int.Parse(MsgID));
            if (order == null)
            {
                return;
            }

            MsgThread();

            //this.threadMsg = new Thread(new ThreadStart(MsgThread));
            //this.threadTimer = new Thread(new ThreadStart(ThreadTimeOut));

            //threadMsg.Start();
            //threadTimer.Start();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        if (KeyID != 0)
        {
            Hi.Model.BD_Promotion proModel = new Hi.BLL.BD_Promotion().GetModel(KeyID);
            //促销公告
            List <Hi.Model.BD_CompNews> newsl = new Hi.BLL.BD_CompNews().GetList("", " PMID=" + KeyID, "");

            if (proModel != null)
            {
                proModel.IsEnabled = 1;
                proModel.dr        = 1;
                if (new Hi.BLL.BD_Promotion().Update(proModel))
                {
                    if (newsl != null && newsl.Count > 0)
                    {
                        Hi.Model.BD_CompNews newsModel = new Hi.Model.BD_CompNews();
                        foreach (Hi.Model.BD_CompNews item in newsl)
                        {
                            item.IsEnabled = 0;
                            item.dr        = 1;
                            newsModel      = item;
                        }
                        new Hi.BLL.BD_CompNews().Update(newsModel);
                    }
                    Response.Write("<script>window.location.href='PromotionList.aspx?type=" + Request["type"] + "';</script>");
                }
            }
        }
    }
Exemplo n.º 3
0
    //绑定新闻
    public void NewsBind()
    {
        string whereStr = "isnull(dr,0)=0 and IsEnabled=1 and Compid=" + CompID + " ";

        #region 新闻公告
        List <Hi.Model.BD_CompNews> LNew = new Hi.BLL.BD_CompNews().GetList("NewsTitle,isnull(ShowType,0) as ShowType,ID,CompID", whereStr, " istop desc,createdate desc");

        string Html = "";
        if (LNew.Count > 0)
        {
            for (int i = 0; i < 10; i++)
            {
                if (LNew.Count > i)
                {
                    LNew[i].ShowType = LNew[i].ShowType == null ? "" : LNew[i].ShowType;
                    if (LNew[i] != null)
                    {
                        Html += "<li><a " + (LNew[i].ShowType.IndexOf("2") >= 0 ? "style='color:red;'" : "") + " title='" + LNew[i].NewsTitle + "'  target=\"_blank\" href=\"/EShop/NewsInfo.aspx?ID=" + LNew[i].ID + "&comid=" + LNew[i].CompID + "&Type=3\">" + (LNew[i].NewsTitle.Length > 14 ? LNew[i].NewsTitle.Substring(0, 14) + "..." : LNew[i].NewsTitle) + "</a></li>";
                    }
                }
                else
                {
                    Html += "<li>&nbsp;</li>";
                }
            }
            NewsList.InnerHtml = Html;
        }
        else
        {
            NewsList.InnerHtml = "<li>暂无公告</li><li></li><li></li><li></li>";
        }
        #endregion
    }
Exemplo n.º 4
0
    protected void btn_Del(object sender, EventArgs e)
    {
        Hi.Model.BD_CompNews NewsNotice = new Hi.BLL.BD_CompNews().GetModel(KeyID);
        if (NewsNotice != null)
        {
            NewsNotice.dr         = 1;
            NewsNotice.ts         = DateTime.Now;
            NewsNotice.modifyuser = UserID;
            if (new Hi.BLL.BD_CompNews().Update(NewsNotice))
            {
                WebReference.AppService app = new AppService();
                try
                {
                    app.MsgPush(NewsNotice.ID.ToString(), "-1");
                }
                catch
                {
                    app.Abort();
                }

                if (Request["Type"] == "3")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Result", "<script>window.close();</script>");
                }
                else
                {
                    //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='NewsList.aspx'; }");
                    Response.Redirect("NewsList.aspx");
                }
            }
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// 禁用
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnNo_Click(object sender, EventArgs e)
    {
        if (KeyID != 0)
        {
            Hi.Model.BD_Promotion proModel = new Hi.BLL.BD_Promotion().GetModel(KeyID);

            //促销公告
            List <Hi.Model.BD_CompNews> newsl = new Hi.BLL.BD_CompNews().GetList("", " PMID=" + KeyID, "");

            if (proModel != null)
            {
                proModel.IsEnabled = 0;

                if (new Hi.BLL.BD_Promotion().Update(proModel))
                {
                    Hi.Model.BD_CompNews newsModel = new Hi.Model.BD_CompNews();
                    if (newsl != null && newsl.Count > 0)
                    {
                        foreach (Hi.Model.BD_CompNews item in newsl)
                        {
                            item.IsEnabled = 0;
                            newsModel      = item;
                        }
                        new Hi.BLL.BD_CompNews().Update(newsModel);
                    }

                    Response.Write("<script>window.location.href='PromotionInfo2.aspx?KeyId=" + Common.DesEncrypt(this.KeyID.ToString(), Common.EncryptKey) + "&type=" + Request["type"] + "';</script>");
                }
            }
        }
    }
Exemplo n.º 6
0
    public void Bind()
    {
        int pageCount = 0;
        int Counts    = 0;

        //每页显示的数据设置
        if (this.txtPageSize.Value.ToString() != "")
        {
            if (this.txtPageSize.Value.Trim().ToInt(0) >= 10000)
            {
                Pager.PageSize         = 100;
                this.txtPageSize.Value = "100";
            }
            else
            {
                Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0);
            }
        }
        List <Hi.Model.BD_CompNews> CompNewsNotice = new Hi.BLL.BD_CompNews().GetList(Pager.PageSize, Pager.CurrentPageIndex, "CreateDate", true, SearchWhere(), out pageCount, out Counts);

        this.Rpt_Distribute.DataSource = CompNewsNotice;
        this.Rpt_Distribute.DataBind();
        Pager.RecordCount = Counts;
        page = Pager.CurrentPageIndex.ToString();
    }
Exemplo n.º 7
0
    public void Databind()
    {
        if (KeyID > 0)
        {
            try
            {
                Hi.Model.BD_CompNews NewsNotice = new Hi.BLL.BD_CompNews().GetModel(KeyID);
                if (NewsNotice != null)
                {
                    if (NewsNotice.CompID != CompID)
                    {
                        Response.Write("你无权访问。");
                        Response.End();
                    }
                    txtNewsTitle.Value = NewsNotice.NewsTitle;
                    content7.Text      = NewsNotice.NewsContents;
                    //是否启用
                    int status = NewsNotice.IsEnabled;
                    this.RdIsbled1.Checked = (status == 1);
                    this.RdIsbled2.Checked = (status != 1);

                    string[] ShowType = NewsNotice.ShowType.Split(new char[] { ',' });
                    foreach (string s in ShowType)
                    {
                        switch (s)
                        {
                        case "1": CkShowType1.Checked = true; break;

                        case "2": CkShowType2.Checked = true; break;
                        }
                    }

                    //是否置顶
                    int istop = NewsNotice.IsTop;
                    this.RdTop3.Checked = (istop == 1);
                    this.RdTop4.Checked = (istop != 1);

                    //类型   1:新闻 2:公告 3:活动
                    int newstype = NewsNotice.NewsType;
                    this.RdType1.Checked = (newstype == 1);
                    this.RdType2.Checked = (newstype == 2);
                    this.RdType3.Checked = (newstype == 3);
                    this.RdType4.Checked = (newstype == 4);
                    this.RdType5.Checked = (newstype == 5);
                }
                else
                {
                    Response.Write("信息不存在。");
                    Response.End();
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
Exemplo n.º 8
0
 public void DataBinds()
 {
     if (KeyID > 0)
     {
         Hi.Model.BD_CompNews NewsNotice = new Hi.BLL.BD_CompNews().GetModel(KeyID);
         if (NewsNotice.CompID != this.CompID)
         {
             Response.Write("你无权限访问。");
             Response.End();
         }
         if (NewsNotice != null)
         {
             if (Request["Type"] == "3")
             {
                 libtnEdit.Visible = false;
                 libtnDel.Visible  = false;
                 libtnback.Visible = false;
                 liPreView.Visible = false;
             }
             //lblnewstitle.InnerText = NewsNotice.NewsTitle;
             title = NewsNotice.NewsTitle;
             //lblcontent.InnerText = NewsNotice.NewsContents;
             string pat   = "<[^<>]+>";
             Regex  regex = new Regex(pat, RegexOptions.None);
             content              = NewsNotice.NewsContents.Replace("<span>", "<p>").Replace("<span", "<p").Replace("</span>", "</p>");
             lblstate.InnerHtml   = NewsNotice.IsEnabled == 1 ? "是" : "<i style='color:red'>否</i>";
             lblistop.InnerHtml   = NewsNotice.IsTop == 1 ? "置顶" : "非置顶";
             lblnewtype.InnerHtml = Common.GetCPNewStateName(NewsNotice.NewsType);
             string[] showType = NewsNotice.ShowType.Split(new char[] { ',' });
             foreach (string s in showType)
             {
                 if (s == "1")
                 {
                     lblShowType.InnerText = "New";
                 }
                 if (s == "2")
                 {
                     if (lblShowType.InnerText == "")
                     {
                         lblShowType.InnerText = "标红";
                     }
                     else
                     {
                         lblShowType.InnerText += ",标红";
                     }
                 }
             }
         }
         else
         {
             Response.Write("信息不存在。");
             Response.End();
         }
     }
 }
Exemplo n.º 9
0
    public void DataBinds()
    {
        List <Hi.Model.BD_CompNews> CompNewS = new Hi.BLL.BD_CompNews().GetList("", " isnull(dr,0)=0 and CompID=" + CompID + " and ID='" + KeyID + "'", "");

        if (CompNewS.Count > 0)
        {
            Hi.Model.BD_CompNews CompNew = CompNewS[0];
            lblNewTitle.InnerHtml   = CompNew.NewsTitle + IsEnd(CompNew.PmID);
            lblNewContent.InnerHtml = CompNew.NewsContents;
            lblCreateDate.InnerText = CompNew.CreateDate.ToString("yyy-MM-dd HH:mm") + " 【" + Common.GetCPNewStateName(CompNew.NewsType) + "】" + (CompNew.IsTop == 1 ? "【置顶】" : "");
        }
        else
        {
            Response.Write("数据不存在");
            Response.End();
        }
    }
Exemplo n.º 10
0
    //绑定新闻
    public void NewsBind()
    {
        if (ShopList.Count == 0)
        {
            return;
        }
        string whereStr = "isnull(dr,0)=0 and IsEnabled=1 and Compid=" + Request["Comid"] + " ";

        if (HttpContext.Current.Session["UserModel"] == null)
        {
            //未登录
            whereStr += " and NewsType in (1,2,3,5)";
        }

        #region 新闻公告
        List <Hi.Model.BD_CompNews> LNew = new Hi.BLL.BD_CompNews().GetList("NewsTitle,isnull(ShowType,0) as ShowType,ID,CompID", whereStr, " istop desc,createdate desc");

        string Html = "";
        if (LNew.Count > 0)
        {
            for (int i = 0; i < 10; i++)
            {
                if (LNew.Count > i)
                {
                    LNew[i].ShowType = LNew[i].ShowType == null ? "" : LNew[i].ShowType;
                    if (LNew[i] != null)
                    {
                        Html += "<li><a " + (LNew[i].ShowType.IndexOf("2") >= 0 ? "style='color:red;'" : "") + " title='" + LNew[i].NewsTitle + "'  target=\"_blank\" href=\"/eshop/NewsInfo_" + LNew[i].ID + "_" + LNew[i].CompID + "_3.html\" >" + (LNew[i].NewsTitle.Length > 14 ? LNew[i].NewsTitle.Substring(0, 14) + "..." : LNew[i].NewsTitle) + "</a></li>";
                    }
                }
                else
                {
                    Html += "<li>&nbsp;</li>";
                }
            }
            NewsList.InnerHtml = Html;
        }
        else
        {
            NewsList.InnerHtml = "<li>暂无公告</li><li></li><li></li><li></li>";
        }
        #endregion
    }
Exemplo n.º 11
0
 public void Bind()
 {
     Hi.Model.BD_CompNews CompNew = new Hi.BLL.BD_CompNews().GetModel(KeyID);
     if (CompNew != null)
     {
         if (CompNew.CompID != this.CompID)
         {
             Response.Write("数据不存在");
             Response.End();
         }
         lblNewTitle.InnerHtml   = CompNew.NewsTitle + IsEnd(CompNew.PmID);
         lblCreateDate.InnerText = CompNew.CreateDate.ToString("yyy-MM-dd HH:mm") + " 【" + Common.GetCPNewStateName(CompNew.NewsType) + "】" + (CompNew.IsTop == 1 ? "【置顶】" : "");
         lblNewContent.InnerHtml = CompNew.NewsContents;
     }
     else
     {
         Response.Write("数据不存在");
         Response.End();
     }
 }
Exemplo n.º 12
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string  str              = string.Empty;
        string  ProTitle         = string.Empty;
        string  ProType          = string.Empty;
        string  ProIsEnabled     = string.Empty;
        string  ProInfos         = string.Empty;
        string  PromotionDate    = string.Empty;
        string  PromotionEndDate = string.Empty;
        decimal disCount         = 0; //折扣率
        decimal SendNum          = 0; //满送数量
        int     isComNew         = 0;

        #region 判断值是否为空,取值
        //促销标题
        if (this.txtPromotiontitle.Value == "")
        {
            str += " -- 促销标题不能为空。</br>";
        }
        else
        {
            ProTitle = Common.NoHTML(this.txtPromotiontitle.Value.Trim());
        }
        //促销方式
        ProType = Request["promotionType"].ToString();
        //是否启用
        ProIsEnabled = Request["IsEnabled"].ToString();

        //促销开始日期
        if (this.txtPromotionDate.Value.Trim() == "")
        {
            str += " -- 促销开始日期不能为空。</br>";
        }
        else
        {
            PromotionDate = this.txtPromotionDate.Value.Trim();
        }
        //促销结束日期
        if (this.txtPromotionDate1.Value.Trim() == "")
        {
            str += " -- 促销结束日期不能为空。</br>";
        }
        else
        {
            PromotionEndDate = this.txtPromotionDate1.Value.Trim();
        }
        ProInfos = Common.NoHTML(this.txtProInfos.Value.Trim().ToString());

        List <Hi.Model.BD_GoodsInfo> gl = Session["GoodsPrice"] as List <Hi.Model.BD_GoodsInfo>;

        if (gl == null || gl.Count <= 0)
        {
            str += " -- 促销商品信息不能为空。</br>";
        }
        // 促销类型判断取值
        if (Type == "1")
        {
            if (ProType == "3")
            {
                //满送
                disCount = this.txtSendFull.Value.Trim().ToString().ToDecimal(0);
                SendNum  = this.txtSendNum.Value.Trim().ToString().ToDecimal(0);

                if (disCount.ToString() == "" || SendNum.ToString() == "")
                {
                    if (disCount.ToString() == "")
                    {
                        str += " -- 满送订购数量不能为空。</br>";
                    }
                    else
                    {
                        str += " -- 获赠商品数量不能为空。</br>";
                    }
                }
            }
            else
            {
                //打折
                disCount = this.txtDiscount.Value.Trim().ToString().ToDecimal(0);
                if (disCount.ToString() != "")
                {
                    if ((int)disCount < 0 || (int)disCount > 100)
                    {
                        str += " -- 打折请输入0—100的数。</br>";
                    }
                }
                else
                {
                    str += " -- 打折不能为空。</br>";
                }
            }
        }

        if (str != "")
        {
            JScript.AlertMsgOne(this, str, JScript.IconOption.错误, 2500);
            ClientScript.RegisterStartupScript(this.GetType(), "Protype", "<script>Protype('" + ProType + "');</script>");
            return;
        }

        #endregion

        int ProId = 0;

        //是否发布促销公告
        isComNew = this.isOkComNews.Checked ? 1 : 0;

        string NewsContents = string.Empty;


        NewsContents = "<font size=\"3\" style=\"line-height:30px;\">";
        try
        {
            if (KeyID != 0)
            {
                #region 修改促销
                Hi.Model.BD_Promotion proModel = ProBll.GetModel(KeyID);

                if (proModel != null)
                {
                    proModel.Type         = Type.ToInt(0);
                    proModel.ProType      = ProType.ToInt(0);
                    proModel.ProTitle     = ProTitle;
                    proModel.IsEnabled    = ProIsEnabled.ToInt(0);
                    proModel.Discount     = disCount;
                    proModel.ProStartTime = PromotionDate.ToDateTime();
                    proModel.ProEndTime   = PromotionEndDate.ToDateTime();
                    proModel.ProInfos     = ProInfos;
                    proModel.modifyuser   = this.UserID;
                    proModel.ts           = DateTime.Now.ToString();

                    List <Hi.Model.BD_PromotionDetail> l = new List <Hi.Model.BD_PromotionDetail>();

                    Hi.Model.BD_PromotionDetail proDmodel = null;
                    foreach (var item in gl)
                    {
                        proDmodel            = new Hi.Model.BD_PromotionDetail();
                        proDmodel.CompID     = this.CompID;
                        proDmodel.GoodInfoID = item.ID;
                        proDmodel.GoodsID    = item.GoodsID;

                        if (ProType == "3")
                        {
                            //满送
                            proDmodel.SendGoodsinfoID = item.ID;
                            proDmodel.GoodsPrice      = SendNum;
                        }
                        else
                        {
                            proDmodel.SendGoodsinfoID = 0;

                            if (ProType == "4")
                            {
                                //打折
                                proDmodel.GoodsPrice = (item.SalePrice * (disCount / 100));
                            }
                            else
                            {
                                proDmodel.GoodsPrice = item.TinkerPrice;
                            }
                        }

                        proDmodel.GoodsName    = GoodsName(item.ID.ToString());
                        proDmodel.GoodsUnit    = GoodsUnit(item.ID.ToString());
                        proDmodel.Goodsmemo    = Goodsmemo(item.ID.ToString());
                        proDmodel.ts           = DateTime.Now.ToString();
                        proDmodel.modifyuser   = this.UserID;
                        proDmodel.CreateUserID = this.UserID;
                        proDmodel.CreateDate   = DateTime.Now;

                        string memo = proDmodel.Goodsmemo == "" ? "" : proDmodel.Goodsmemo.Substring(0, proDmodel.Goodsmemo.Length - 1);

                        NewsContents += proDmodel.GoodsName + "  " + memo + " /" + proDmodel.GoodsUnit + "  原价 " + item.SalePrice.ToString("N") + "   促销价  " + proDmodel.GoodsPrice.ToString("N") + "! </br>";

                        l.Add(proDmodel);
                    }
                    int Id = ProBll.ProUpdate(proModel, l);

                    NewsContents += "先到先得!";
                    ProInfos      = ProInfos == "" ? "" : "(" + ProInfos + ")";
                    NewsContents += ProInfos;

                    NewsContents += "</br> 活动时间:" + PromotionDate.ToDateTime().ToString("yyyy-MM-dd") + "至" + PromotionEndDate.ToDateTime().ToString("yyyy-MM-dd");

                    NewsContents += "</font>";

                    //促销公告
                    List <Hi.Model.BD_CompNews> newsl = new Hi.BLL.BD_CompNews().GetList("", " PMID=" + KeyID, "");
                    Hi.Model.BD_CompNews        news  = null;
                    if (newsl != null && newsl.Count > 0)
                    {
                        foreach (Hi.Model.BD_CompNews item in newsl)
                        {
                            news              = new Hi.Model.BD_CompNews();
                            news.ID           = item.ID;
                            news.PmID         = KeyID;
                            news.CompID       = item.CompID;
                            news.CreateDate   = DateTime.Now;
                            news.CreateUserID = UserID;
                            news.dr           = item.dr;
                            news.ts           = DateTime.Now;
                            if (ProIsEnabled.ToInt(0) == 1)
                            {
                                news.IsTop     = 1;
                                news.IsEnabled = 0;
                                news.NewsType  = 4;
                                news.ShowType  = "2";
                            }
                            else
                            {
                                news.IsTop     = item.IsTop;
                                news.IsEnabled = 0;
                                news.NewsType  = item.NewsType;
                                news.ShowType  = item.ShowType;
                            }
                            news.NewsTitle    = ProTitle;
                            news.NewsContents = NewsContents;
                            news.modifyuser   = UserID;
                        }
                    }
                    else
                    {
                        news              = new Hi.Model.BD_CompNews();
                        news.PmID         = KeyID;
                        news.CompID       = CompID;
                        news.CreateDate   = DateTime.Now;
                        news.CreateUserID = UserID;
                        news.dr           = 0;
                        news.ts           = DateTime.Now;
                        news.IsTop        = 1;
                        news.IsEnabled    = 1;
                        news.NewsType     = 4;
                        news.ShowType     = "2";
                        news.NewsTitle    = ProTitle;
                        news.NewsContents = NewsContents;
                        news.modifyuser   = UserID;
                    }

                    if (Id != 0)
                    {
                        if (isComNew == 1)
                        {
                            if (newsl != null && newsl.Count > 0)
                            {
                                //存在促销公告
                                new Hi.BLL.BD_CompNews().Update(news);
                            }
                            else
                            {
                                //不存在促销公告
                                new Hi.BLL.BD_CompNews().Add(news);
                            }
                        }
                        else
                        {
                            if (newsl != null && newsl.Count > 0)
                            {
                                news.IsEnabled = 0;
                                //存在促销公告
                                new Hi.BLL.BD_CompNews().Update(news);
                            }
                            else
                            {
                                news.IsEnabled = 0;
                                //不存在促销公告
                                new Hi.BLL.BD_CompNews().Add(news);
                            }
                        }

                        Response.Write("<script>window.location.href='../PmtManager/PromotionInfo.aspx?KeyId=" + Common.DesEncrypt(this.KeyID.ToString(), Common.EncryptKey) + "&type=" + Type + "';</script>");
                    }
                }
                #endregion
            }
            else
            {
                #region 新增促销
                Hi.Model.BD_Promotion proModel = new Hi.Model.BD_Promotion();

                proModel.Type         = Type.ToInt(0);
                proModel.CompID       = this.CompID;
                proModel.ProType      = ProType.ToInt(0);
                proModel.ProTitle     = ProTitle;
                proModel.IsEnabled    = ProIsEnabled.ToInt(0);
                proModel.Discount     = disCount;
                proModel.ProStartTime = PromotionDate.ToDateTime();
                proModel.ProEndTime   = PromotionEndDate.ToDateTime();
                proModel.ProInfos     = ProInfos;
                proModel.CreateUserID = this.UserID;
                proModel.CreateDate   = DateTime.Now;
                proModel.modifyuser   = this.UserID;
                proModel.ts           = DateTime.Now.ToString();

                List <Hi.Model.BD_PromotionDetail> l = new List <Hi.Model.BD_PromotionDetail>();

                Hi.Model.BD_PromotionDetail proDmodel = null;
                foreach (var item in gl)
                {
                    proDmodel            = new Hi.Model.BD_PromotionDetail();
                    proDmodel.CompID     = this.CompID;
                    proDmodel.GoodInfoID = item.ID;
                    proDmodel.GoodsID    = item.GoodsID;

                    if (ProType == "3")
                    {
                        //满送
                        proDmodel.SendGoodsinfoID = item.ID;
                        proDmodel.GoodsPrice      = SendNum;
                    }
                    else
                    {
                        proDmodel.SendGoodsinfoID = 0;
                        if (ProType == "4")
                        {
                            //打折
                            proDmodel.GoodsPrice = (item.SalePrice * (disCount / 100));
                        }
                        else
                        {
                            proDmodel.GoodsPrice = item.TinkerPrice;
                        }
                    }

                    proDmodel.GoodsName    = GoodsName(item.ID.ToString());
                    proDmodel.GoodsUnit    = GoodsUnit(item.ID.ToString());
                    proDmodel.Goodsmemo    = Goodsmemo(item.ID.ToString());
                    proDmodel.ts           = DateTime.Now.ToString();
                    proDmodel.modifyuser   = this.UserID;
                    proDmodel.CreateUserID = this.UserID;
                    proDmodel.CreateDate   = DateTime.Now;

                    string memo = proDmodel.Goodsmemo == "" ? "" : proDmodel.Goodsmemo.Substring(0, proDmodel.Goodsmemo.Length - 1);

                    NewsContents += proDmodel.GoodsName + "  " + memo + " /" + proDmodel.GoodsUnit + "  原价 " + item.SalePrice.ToString("N") + "   促销价  " + proDmodel.GoodsPrice.ToString("N") + "! </br>";
                    l.Add(proDmodel);
                }

                NewsContents += "先到先得!";
                ProInfos      = ProInfos == "" ? "" : "(" + ProInfos + ")";
                NewsContents += ProInfos;

                NewsContents += " </br> 活动时间:" + PromotionDate.ToDateTime().ToString("yyyy-MM-dd") + "至" + PromotionEndDate.ToDateTime().ToString("yyyy-MM-dd");

                NewsContents += "</font>";

                Hi.Model.BD_CompNews news = new Hi.Model.BD_CompNews();

                news.CompID       = CompID;
                news.CreateDate   = DateTime.Now;
                news.CreateUserID = UserID;
                news.dr           = 0;
                news.ts           = DateTime.Now;
                news.IsTop        = 1;
                news.IsEnabled    = 1;
                news.NewsType     = 4;
                news.ShowType     = "2";
                news.NewsTitle    = ProTitle;
                news.NewsContents = NewsContents;
                news.modifyuser   = UserID;

                int Id = ProBll.AddPro(proModel, l);

                if (Id != 0)
                {
                    news.PmID = Id;

                    if (isComNew == 1)
                    {
                        int count = new Hi.BLL.BD_CompNews().Add(news);

                        WebReference.AppService app = new AppService();
                        try
                        {
                            app.MsgPush(count.ToString(), "1");
                        }
                        catch
                        {
                            app.Abort();
                        }
                    }
                    Response.Write("<script>window.location.href='../PmtManager/PromotionInfo.aspx?KeyId=" + Common.DesEncrypt(Id.ToString(), Common.EncryptKey) + "&type=" + Type + "';</script>");
                }

                #endregion
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!(Session["UserModel"] as LoginModel).IsExistRole)
        {
            Response.Redirect("~/Distributor/UserEdit.aspx", true);
        }

        //获取当前时间
        DateTime date = DateTime.Now;
        //当天0点0分
        DateTime day0 = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
        //获取当前时间加一天
        DateTime Sday = day0.AddDays(1);

        //当月第一天
        DateTime day1 = new DateTime(date.Year, date.Month, 1);
        //本月  最后一天  多加一天
        DateTime mothday = day1.AddMonths(1);

        user = new Hi.BLL.SYS_Users().GetModel(this.UserID);

        orderl = new Hi.BLL.DIS_Order().GetList("", " isnull(dr,0)=0 and Otype<>9 and OState<>6  and CompID=" + this.CompID + " and DisID=" + this.DisID, " CreateDate desc");
        if (orderl != null)
        {
            #region

            //当天订单数
            dayOrderCount = orderl.FindAll(
                p => (p.OState == 2 || p.OState == 3 || p.OState == 4 || p.OState == 5 || p.OState == 7) && p.CreateDate >= day0 && p.CreateDate < Sday).Count;

            //本月订单数
            orderCount = orderl.FindAll(
                p => (p.OState == 2 || p.OState == 3 || p.OState == 4 || p.OState == 5 || p.OState == 7) && p.CreateDate >= day1 && p.CreateDate < mothday).Count;

            #endregion
            orderll = orderl.FindAll(p => (p.PayState == 0 || p.PayState == 1));
        }
        List <Hi.Model.DIS_Suggest> suggest = new Hi.BLL.DIS_Suggest().GetList("", " isnull(dr,0)=0 and Stype=0 and isanswer=1 and DisUserID=" + this.UserID, "");
        message = suggest.Count;
        if (message == 0)
        {
            //imessage.Attributes.Add("style", "display:none");
        }
        price = Convert.ToDecimal(new Hi.BLL.PAY_PrePayment().sums(this.DisID, this.CompID)).ToString("0.00");
        dis   = new Hi.BLL.BD_Distributor().GetModel(this.DisID);
        if (dis != null)//add by hgh  出现为null值
        {
            //if ( dis.CreditType == 0)
            //{
            //lisalesorder.Attributes.Add("style", "background-color:#fbfbfb");
            //}

            Hi.Model.BD_DisType distypemodel = new Hi.BLL.BD_DisType().GetModel(dis.DisTypeID);
            if (distypemodel != null)
            {
                disType = distypemodel.TypeName;
            }
            Hi.Model.BD_DisArea disaddrmodel = new Hi.BLL.BD_DisArea().GetModel(dis.AreaID);
            if (disaddrmodel != null)
            {
                disAreaID = disaddrmodel.AreaName;
            }
        }
        #region 促销商品

        string    Cx_sql = string.Format(@"SELECT count(1) num from BD_Goods
where ID in (SELECT GoodsID from BD_PromotionDetail where ProID in
(SELECT ID from BD_Promotion where compID={0} and ProStartTime<=getdate() 
and ProStartTime<=GETDATE() and DATEADD(D,1,ProEndTime)>= getDate() and IsEnabled=1	))and ID not in (	
select GoodsID from BD_GoodsAreas where	compID={0} and DisID={1} and isnull(dr,0)=0)
and compid= {0} and ISNULL(dr,0)=0 and IsEnabled = 1 and IsOffLine=1 ", this.CompID, this.DisID);
        DataTable Cx_Dt  = SqlHelper.Query(SqlHelper.LocalSqlServer, Cx_sql).Tables[0];
        if (Cx_Dt != null)
        {
            if (Cx_Dt.Rows.Count > 0)
            {
                decimal sum_CX = Convert.ToDecimal(Cx_Dt.Rows[0]["num"]);
                Cx_Sum = sum_CX.ToString();
            }
        }

        #endregion

        #region  快过期商品 goods_Sum
        //当前时间
        DateTime now = DateTime.Now;
        //快到期时间
        DateTime today = now.AddDays(30);

        string goods_sql = string.Format(@"select * from YZT_GoodsStock s where s.validDate<='" + today + "'" + " and DisID=" + DisID + " and dr=0 ");

        DataTable goods_Dt = SqlHelper.Query(SqlHelper.LocalSqlServer, goods_sql).Tables[0];
        if (goods_Dt != null && goods_Dt.Rows.Count > 0)
        {
            goods_Sum = goods_Dt.Rows.Count.ToString();
        }
        #endregion

        #region 当天订购额
        //add by hgh  //包含已退订单金额、退单处理
        string daysql = "SELECT SUM(AuditAmount) as AuditAmount FROM [dbo].[DIS_Order] where ostate in (2,3,4,5,7) and DisID=" +
                        this.DisID + " and CompID=" + this.CompID + " and CreateDate>='" + day0 + "' and CreateDate<'" + Sday + "'";
        DataTable dayDt = SqlHelper.Query(SqlHelper.LocalSqlServer, daysql).Tables[0];
        if (dayDt != null)
        {
            if (dayDt.Rows.Count > 0)
            {
                decimal sumAmount = dayDt.Rows[0]["AuditAmount"].ToString() == ""
                    ? sum.ToString().ToDecimal()
                    : Convert.ToDecimal(dayDt.Rows[0]["AuditAmount"]);
                DaySum = (sumAmount).ToString("N");
            }
        }
        #endregion

        #region 本月订购额
        string    monthsql = "SELECT SUM(AuditAmount) as AuditAmount FROM DIS_Order where OState in (2,3,4,5,7) and isnull(dr,0)=0 and Otype<>9 and DisID=" + this.DisID + " and CompID=" + this.CompID + " and CreateDate>='" + day1 + "' and CreateDate<'" + mothday + "'";
        DataTable monthDt  = SqlHelper.Query(SqlHelper.LocalSqlServer, monthsql).Tables[0];
        if (monthDt != null)
        {
            if (monthDt.Rows.Count > 0)
            {
                decimal sumAmount = monthDt.Rows[0]["AuditAmount"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(monthDt.Rows[0]["AuditAmount"]);
                MonthSum = (sumAmount).ToString("N");
            }
        }
        #endregion

        #region 当天付款额
        //付款额    add by hgh  CompCollection_view 状态   and status!=3
        string daypaggersql = "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where DisID=" + this.DisID +
                              "and CompID=" + this.CompID + " and status!=3 and Date>='" + day0 + "' and Date<'" + Sday + "' AND vedf9=1 ";

        DataTable daypaggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, daypaggersql).Tables[0];
        if (daypaggerdt != null)
        {
            if (daypaggerdt.Rows.Count > 0)
            {
                decimal Price = daypaggerdt.Rows[0]["Price"].ToString() == ""
                    ? sum.ToString().ToDecimal()
                    : Convert.ToDecimal(daypaggerdt.Rows[0]["Price"]);
                DayPaymentSum = (Price).ToString("N");
            }
        }

        #endregion

        #region 本月付款额
        //本月付款额    add by hgh  CompCollection_view 状态   and status!=3
        string paggersql = "SELECT SUM(Price) as Price FROM [dbo].[CompCollection_view] where OrderID not in (select ID from Dis_Order where ISNULL(dr,0)=0 and Otype=9) and DisID=" + this.DisID + "  and status!=3 and CompID=" + this.CompID + " and Date>='" + day1 + "' and Date<'" + mothday + "' AND vedf9=1 ";

        DataTable paggerdt = SqlHelper.Query(SqlHelper.LocalSqlServer, paggersql).Tables[0];
        if (paggerdt != null)
        {
            if (paggerdt.Rows.Count > 0)
            {
                decimal Price = paggerdt.Rows[0]["Price"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(paggerdt.Rows[0]["Price"]);
                PaymentSum = (Price).ToString("N");
            }
        }
        #endregion

        #region 本月应付额
        //本月应付额

        decimal AuditAmount = 0;
        decimal payAmount   = 0;
        decimal payyzf      = 0;

        //赊销订单  未支付的
        //string ArrearageSql = "SELECT SUM(AuditAmount) as AuditAmount FROM [dbo].[ArrearageRpt_view] where DisID=" + user.DisID + "and CompID=" + user.CompID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

        //DataTable ArrearageDt = SqlHelper.Query(SqlHelper.LocalSqlServer, ArrearageSql).Tables[0];
        //if (ArrearageDt != null)
        //{
        //    if (ArrearageDt.Rows.Count > 0)
        //    {
        //        AuditAmount = ArrearageDt.Rows[0]["AuditAmount"].ToString() == "" ? sum.ToString().ToDecimal() : Convert.ToDecimal(ArrearageDt.Rows[0]["AuditAmount"]);
        //    }
        //}

        //未支付订单金额
        //string paysql = "  select SUM(AuditAmount) as AuditAmount from DIS_Order where (( Otype=1 and OState not in (-1,0,1)  and PayState in (0,1) ) or( Otype<>1 and OState=2   and PayState in (0,1) )) and OState<>6 and ReturnState=0 and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";

        //DataTable payDt = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        //if (payDt != null && payDt.Rows.Count > 0)
        //{
        //    payAmount = payDt.Rows[0]["AuditAmount"].ToString() == "" ? 0 : payDt.Rows[0]["AuditAmount"].ToString().ToDecimal(0);
        //}
        //paysql = "  select SUM(PayedAmount) as PayedAmount from DIS_Order where (( Otype=1 and OState not in (-1,0,1)  and PayState in (0,1) ) or( Otype<>1 and OState=2   and PayState in (0,1) )) and OState<>6 and ReturnState=0 and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<='" + Sday + "'";
        //payDt = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        //if (payDt != null && payDt.Rows.Count > 0)
        //{
        //    payyzf = payDt.Rows[0]["PayedAmount"].ToString() == "" ? 0 : payDt.Rows[0]["PayedAmount"].ToString().ToDecimal(0);
        //}
        //PayableSum = (payAmount - payyzf + AuditAmount).ToString("N");


        //edit by hgh   正常合同 总额-已付
        string    paysql = "  select SUM(AuditAmount)-SUM(PayedAmount) as AuditAmount from DIS_Order where OState in(2,3,5) and isnull(dr,0)=0 and Otype!=9 and CompID=" + this.CompID + " and DisID=" + this.DisID + " and CreateDate>='" + day1 + "' and CreateDate<'" + Sday + "'";
        DataTable payDt  = SqlHelper.Query(SqlHelper.LocalSqlServer, paysql).Tables[0];
        if (payDt != null && payDt.Rows.Count > 0)
        {
            payAmount = payDt.Rows[0]["AuditAmount"].ToString() == "" ? 0 : payDt.Rows[0]["AuditAmount"].ToString().ToDecimal(0);
        }
        PayableSum = payAmount.ToString("N");
        #endregion

        #region 商家公告

        List <Hi.Model.BD_CompNews> LNew = new Hi.BLL.BD_CompNews().GetList("top 3 *", "isnull(dr,0)=0 and IsEnabled=1 and Compid=" + this.CompID + " ", " istop desc,createdate desc");
        string Html = "";
        if (LNew.Count > 0)
        {
            for (int i = 0; i < LNew.Count; i++)
            {
                if (LNew[i].ShowType == null)
                {
                    LNew[i].ShowType = "";
                }

                if (i <= 4)
                {
                    string type = LNew[i].ShowType == "1" ? "top" : LNew[i].ShowType == "2" ? "red" : LNew[i].ShowType == "1,2" ? "top red" : "";
                    Html += "<li class='" + type + "'><a title='" + LNew[i].NewsTitle + "' href=\"CompNewInfo.aspx?KeyID=" + Common.DesEncrypt(LNew[i].ID.ToString(), Common.EncryptKey) + "&Type=3\">【" + Common.GetCPNewStateName(LNew[i].NewsType) + "】" + (LNew[i].NewsTitle.Length > 16 ? LNew[i].NewsTitle.Substring(0, 16) + "..." : LNew[i].NewsTitle) + "</a>" + IsEnd(LNew[i].PmID) + (LNew[i].ShowType.IndexOf("1") >= 0 ? "<i class='newIcon'></i>" : "") + "<i class='date1'>" + LNew[i].CreateDate.ToString("yyyy-MM-dd") + "</i></li>";
                }
            }
            ULNewList.InnerHtml = Html;
        }
        else
        {
            //ULNewList.InnerHtml = "<li style='text-align:center'><span>暂无公告</span></li>";
            ULNewList.InnerHtml = "<div class='nomh-box'><i class='nomh-i'></i>暂无公告</div>";
        }
        #endregion

        if (!IsPostBack)
        {
            if (IsDisAdmin(this.UserID))
            {
                if (user.UserPwd == Util.md5("123456"))
                {
                    DisImport.Attributes.Add("style", "display:block");
                    zzc.Attributes.Add("style", "display:block");
                    return;
                }
            }
        }
    }
Exemplo n.º 14
0
    public ResultNewsList CompNewsList(string JSon)
    {
        try
        {
            StringBuilder str = new StringBuilder();

            #region JSon取值

            string userID          = string.Empty;
            string compID          = string.Empty;
            string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType         = string.Empty; //方向
            string rows            = string.Empty;
            string sortType        = string.Empty;
            string sort            = string.Empty;
            string orderType       = string.Empty;
            string DisID           = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompanyID"].ToString() != "" &&
                JInfo["Search"].ToString() != "" && JInfo["CriticalOrderID"].ToString() != "" &&
                JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" &&
                JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "" &&
                JInfo["OrderType"].ToString() != "")
            {
                userID = JInfo["UserID"].ToString().Trim();
                compID = JInfo["CompanyID"].ToString().Trim();
                str.Append(" AND CompID='" + compID + "' AND IsEnabled=1 and dr=0");
                criticalOrderID = JInfo["CriticalOrderID"].ToString();
                getType         = JInfo["GetType"].ToString();
                rows            = JInfo["Rows"].ToString();
                sortType        = JInfo["SortType"].ToString();
                sort            = JInfo["Sort"].ToString();
                orderType       = JInfo["OrderType"].ToString();//0:只按时间 1:置顶优先,再按时间排序
                //DisID = JInfo["ResellerID"].ToString();//经销商登录时需要传入经销商ID用于对登录信息进行判断
            }
            else
            {
                return(new ResultNewsList()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            //if (DisID == "")
            //{
            //    if (!new Common().IsLegitUser(int.Parse(userID), out user, int.Parse(compID)))
            //        return new ResultNewsList() { Result = "F", Description = "登录信息异常" };
            //    Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(compID));
            //    if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            //        return new ResultNewsList() { Result = "F", Description = "核心企业异常" };
            //}
            //else
            //{
            //    if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(DisID)))
            //        return new ResultNewsList() { Result = "F", Description = "登录信息异常" };
            //    //判断经销商信息是否异常
            //    Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(Convert.ToInt32(DisID));
            //    if (dis == null || dis.dr == 1 || dis.IsEnabled == 0 || dis.AuditState == 0)
            //        return new ResultNewsList() { Result = "F", Description = "经销商信息异常" };
            //    //判断经销商对应的核心企业信息是否异常
            //    Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(dis.CompID);
            //    if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            //        return new ResultNewsList() { Result = "F", Description = "核心企业异常" };
            //}

            JsonData JMsg = JInfo["Search"];
            if (JMsg.Count > 0)
            {
                string NewsID    = JMsg["NewsID"].ToString().Trim();
                string Title     = JMsg["Title"].ToString().Trim();
                string IsEnabled = JMsg["IsEnable"].ToString().Trim();
                string IsTop     = JMsg["IsTop"].ToString().Trim();
                string NewsType  = JMsg["NewsType"].ToString().Trim();

                string ShowType = JMsg["ShowType"].ToString().Trim();

                if (NewsID != "-1")
                {
                    str.Append(" and ID ='" + NewsID + "' ");
                }
                if (Title != "-1")
                {
                    str.Append(" and NewsTitle like '%" + Title + "%' ");
                }
                if (IsEnabled != "-1")
                {
                    str.Append(" and IsEnable = '" + IsEnabled + "' ");
                }
                if (IsTop != "-1")
                {
                    str.Append(" and IsTop = '" + IsTop + "' ");
                }
                if (NewsType != "-1")
                {
                    str.Append(" and NewsType = '" + NewsType + "' ");
                }
                if (ShowType != "-1")
                {
                    str.Append(ShowType == "3" ? " and ShowType = '1,2' " : " and ShowType = '" + ShowType + "' ");
                }
            }

            #endregion

            List <NewsInfo> NewsList = new List <NewsInfo>();

            if (orderType == "1")
            {
                #region 取当前置顶的新闻公告

                List <Hi.Model.BD_CompNews> newsList = new Hi.BLL.BD_CompNews().GetList("",
                                                                                        " IsEnabled =1 and IsTop =1 and CompID='" + compID + "' and dr=0", "createDate desc");
                if (newsList != null && newsList.Count != 0)
                {
                    str.Append(" and ID not in (-1");  //通用列表中去除置顶公告
                    if (criticalOrderID.Trim() == "-1")
                    {
                        //    List<NewsInfo> NewsList_select = newsList.Select(newsInfo => new NewsInfo()
                        //       {
                        //           NewsID = newsInfo.ID.ToString(),
                        //           Title = newsInfo.NewsTitle,
                        //           IsEnabled = newsInfo.IsEnabled.ToString(),
                        //           IsTop = newsInfo.IsTop.ToString(),
                        //           NewsType = newsInfo.NewsType.ToString(),

                        //           ShowType =
                        //               newsInfo.ShowType != "1" && newsInfo.ShowType != "2" && ClsSystem.gnvl(newsInfo.ShowType,"").Trim() != ""
                        //               ? "3" : newsInfo.ShowType,
                        //           CreateTime = newsInfo.CreateDate.ToString()
                        //       }
                        //   ).ToList();
                        foreach (
                            NewsInfo news in newsList.Select(newsInfo => new NewsInfo()
                        {
                            NewsID = newsInfo.ID.ToString(),
                            Title = newsInfo.NewsTitle,
                            IsEnabled = newsInfo.IsEnabled.ToString(),
                            IsTop = newsInfo.IsTop.ToString(),
                            NewsType = newsInfo.NewsType.ToString(),

                            ShowType =
                                newsInfo.ShowType != "1" && newsInfo.ShowType != "2" && ClsSystem.gnvl(newsInfo.ShowType, "").Trim() != ""
                                    ? "3" : newsInfo.ShowType,
                            CreateTime = newsInfo.CreateDate.ToString()
                        }
                                                             ))
                        //foreach (NewsInfo news in NewsList_select)
                        {
                            NewsList.Add(news);
                            str.Append("," + news.NewsID);
                        }
                    }
                    str.Append(")");
                }

                #endregion

                int dtRow = Convert.ToInt32(rows) - NewsList.Count;
                if (dtRow > 1)
                {
                    rows = dtRow.ToString();
                }
            }

            #region 模拟分页

            string tabName = " [dbo].[BD_CompNews]"; //表名
            string strsql  = string.Empty;           //搜索sql
            sortType = "CreateDate";
            sort     = "0";
            strsql   = new Common().PageSqlString(criticalOrderID, "ID", tabName, sortType, sort, str.ToString(), getType, rows);
            if (strsql == "")
            {
                return new ResultNewsList()
                       {
                           Result = "F", Description = "基础数据异常"
                       }
            }
            ;

            #endregion

            #region 赋值

            DataSet ds = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql);
            if (ds.Tables.Count == 0)
            {
                if (NewsList.Count == 0)
                {
                    return new ResultNewsList()
                           {
                               Result = "T", Description = "没有更多数据"
                           }
                }
                ;
                else
                {
                    return(new ResultNewsList()
                    {
                        Result = "T", Description = "", NewsList = NewsList
                    });
                }
            }
            DataTable dtList = ds.Tables[0];
            if (dtList != null)
            {
                if (dtList.Rows.Count == 0)
                {
                    if (NewsList.Count != 0)
                    {
                        return new ResultNewsList()
                               {
                                   Result = "T", Description = "", NewsList = NewsList
                               }
                    }
                    ;
                    else
                    {
                        return(new ResultNewsList()
                        {
                            Result = "F", Description = "没有更多数据"
                        });
                    }
                }
                foreach (DataRow newsInfo in dtList.Rows)
                {
                    NewsInfo news = new NewsInfo();

                    news.NewsID    = newsInfo["ID"].ToString();
                    news.Title     = newsInfo["NewsTitle"].ToString();
                    news.IsOverdue = "0";
                    if (newsInfo["NewsType"].ToString() == "4")
                    {
                        if (newsInfo["PmID"] != null && Convert.ToInt32(newsInfo["PmID"]) != 0)
                        {
                            Hi.Model.BD_Promotion pro = new Hi.BLL.BD_Promotion().GetModel(Convert.ToInt32(newsInfo["PmID"].ToString()));
                            if (pro.ProEndTime < DateTime.Now)
                            {
                                news.IsOverdue = "1";
                            }
                        }
                    }
                    news.IsEnabled = newsInfo["IsEnabled"].ToString();
                    news.IsTop     = newsInfo["IsTop"].ToString();
                    news.NewsType  = newsInfo["NewsType"].ToString();
                    news.ShowType  = newsInfo["ShowType"].ToString() != "1" && newsInfo["ShowType"].ToString() != "2" &&
                                     newsInfo["ShowType"].ToString().Trim() != "" ? "3" : newsInfo["ShowType"].ToString();
                    news.CreateTime = newsInfo["CreateDate"].ToString();

                    NewsList.Add(news);
                }
            }

            #endregion

            return(new ResultNewsList()
            {
                Result = "T", Description = "获取成功", NewsList = NewsList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "CompNewsList :" + JSon);
            return(new ResultNewsList()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Exemplo n.º 15
0
    /// <summary>
    /// 获取推送用户,返回推送类
    /// </summary>
    /// <param name="userType">0 (当前用户类型是企业,即推送至经销商) 1 (当前用户类型是经销商,即推送至企业) 2 全部 </param>
    /// <param name="sendType">类型同微信推送</param>
    /// <returns></returns>
    public PushPayload GetMsgUserModel(string orderID, string type)
    {
        Hi.Model.BD_CompNews order = new Hi.BLL.BD_CompNews().GetModel(int.Parse(orderID));
        if (order == null)
        {
            return(null);
        }

        //推送设置
        PushPayload payload = new PushPayload();

        payload.platform = Platform.android_ios();//推送平台

        //推送用户,0:推送给经销商 1:推送给企业
        //payload.audience = Audience.all();
        List <Hi.Model.SYS_CompUser> userList = new Hi.BLL.SYS_CompUser().GetList("",
                                                                                  " compID='" + order.CompID + "' and IsAudit = 2 and disID!=0 and dr=0 and IsEnabled=1 and (Utype=1 or Utype =5)", "");

        if (userList == null || userList.Count == 0)
        {
            return(null);
        }
        string[] arr = new String[userList.Count];
        for (int i = 0; i < userList.Count; i++)
        {
            //arr[i] = AESHelper.Encrypt_android(userList[i].ID.ToString());
            //arr[i] = AESHelper.Encrypt_android_old(userList[i].ID.ToString());
            arr[i] = AESHelper.Encrypt_MD5(userList[i].ID.ToString());//MD5加密
        }
        payload.audience = Audience.s_alias(arr);
        //payload.audience = Audience.s_alias(AESHelper.Encrypt_android("1304"));

        //推送通知
        string str = "{\"Type\":\"" + (type == "" || type == "-1" ? "-1" : order.NewsType.ToString()) +
                     "\",\"Title\":\"" + order.NewsTitle +
                     "\",\"ID\":\"" + order.ID.ToString() + "\",\"Date\":\"" + DateTime.Now.ToString("yyyy-MM-dd") + "\"}";

        // SendType 0:推送给经销商 1:推送给企业
        string sendStr = "{\"SendType\":\"0\",\"CompID\":\"" + order.CompID + "\"}";

        //AndroidNotification android = new AndroidNotification();
        //android.setAlert(GetAlertContent(order, sendType));//推送内容
        //payload.notification = new Notification().setAndroid(android);//推送内容
        payload.notification = new Notification().setAlert("您有一条新的信息公告!")
                               .setAndroid(new AndroidNotification()//设置Android的notification
                                           .AddExtra("Type", "2")
                                           .AddExtra("CheckUser", AESHelper.Encrypt_android(sendStr))
                                           .AddExtra("Json", AESHelper.Encrypt_android(str)))
                               .setIos(new IosNotification()              //设置IOS的notification
                                       .setAlert("您有一条新的信息公告")
                                       .autoBadge()
                                       .AddExtra("Type", "2")
                                       .AddExtra("CheckUser", AESHelper.Encrypt_android(sendStr))
                                       .AddExtra("Json", AESHelper.Encrypt_android(str)));

        //推送消息
        payload.message = Message.content("您有一条新的短消息!")
                          .AddExtras("Type", "2")
                          .AddExtras("CheckUser", AESHelper.Encrypt_android(sendStr))
                          .AddExtras("Json", AESHelper.Encrypt_android(str));
        Options op = new Options();

        op.apns_production = false;
        payload.options    = op;

        return(payload);
    }
Exemplo n.º 16
0
    public ResultNewsInfo GetNewsInfo(string JSon)
    {
        try
        {
            #region JSon取值

            string userID = string.Empty;
            string compID = string.Empty;
            string newsID = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompanyID"].ToString() != "" &&
                JInfo["NewsID"].ToString() != "")
            {
                userID = JInfo["UserID"].ToString().Trim();
                compID = JInfo["CompanyID"].ToString().Trim();
                newsID = JInfo["NewsID"].ToString().Trim();
            }
            else
            {
                return(new ResultNewsInfo()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            //Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            //if (!new Common().IsLegitUser(int.Parse(userID), out user, int.Parse(compID)))
            //    return new ResultNewsInfo() { Result = "F", Description = "登录信息异常" };

            #endregion

            Hi.Model.BD_CompNews newsInfo = new Hi.BLL.BD_CompNews().GetModel(Convert.ToInt32(newsID));
            if (newsInfo == null)
            {
                return new ResultNewsInfo()
                       {
                           Result = "F", Description = "未找到信息"
                       }
            }
            ;
            NewsInfo news = new NewsInfo()
            {
                NewsID     = newsInfo.ID.ToString(),
                Title      = newsInfo.NewsTitle,
                Contents   = newsInfo.NewsContents,
                IsEnabled  = newsInfo.IsEnabled.ToString(),
                IsTop      = newsInfo.IsTop.ToString(),
                NewsType   = newsInfo.NewsType.ToString(),
                ShowType   = newsInfo.ShowType != "1" && newsInfo.ShowType != "2" && newsInfo.ShowType.Trim() != "" ? "3" : newsInfo.ShowType,
                CreateTime = newsInfo.CreateDate.ToString()
            };
            return(new ResultNewsInfo()
            {
                Result = "T", Description = "返回成功", NewsInfo = news
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetNewsInfo :" + JSon);
            return(new ResultNewsInfo()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Exemplo n.º 17
0
    public ResultNewsAdd CompNewsAdd(string JSon)
    {
        try
        {
            #region JSon取值

            string userID    = string.Empty;
            string compID    = string.Empty;
            string title     = string.Empty;
            string contents  = string.Empty;
            string IsEnabled = string.Empty;
            string IsTop     = string.Empty;
            string NewsType  = string.Empty;
            string ShowType  = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompanyID"].ToString() != "" &&
                JInfo["Title"].ToString() != "" &&
                JInfo["IsEnable"].ToString() != "" && JInfo["IsTop"].ToString() != "" &&
                JInfo["NewsType"].ToString() != "")
            {
                userID = JInfo["UserID"].ToString();

                compID    = JInfo["CompanyID"].ToString();
                title     = Common.NoHTML(JInfo["Title"].ToString());
                contents  = Common.NoHTML(JInfo["Contents"].ToString());
                IsEnabled = JInfo["IsEnable"].ToString();
                IsTop     = JInfo["IsTop"].ToString();
                NewsType  = JInfo["NewsType"].ToString();
                ShowType  = JInfo["ShowType"].ToString();
            }
            else
            {
                return(new ResultNewsAdd()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, int.Parse(compID)))
            {
                return new ResultNewsAdd()
                       {
                           Result = "F", Description = "登录信息异常"
                       }
            }
            ;

            #endregion

            Hi.Model.BD_CompNews NewsNotice = new Hi.Model.BD_CompNews();
            NewsNotice.CompID       = Convert.ToInt32(compID);
            NewsNotice.NewsTitle    = title;
            NewsNotice.NewsContents = contents;
            NewsNotice.IsEnabled    = IsEnabled == "1" ? 1 : 0; //是否启用
            NewsNotice.IsTop        = IsTop == "1" ? 1 : 0;     //是否置顶
            if (NewsType.Trim() != "1" && NewsType.Trim() != "2" && NewsType.Trim() != "3" &&
                NewsType.Trim() != "4" && NewsType.Trim() != "5")
            {
                return new ResultNewsAdd()
                       {
                           Result = "F", Description = "类别异常"
                       }
            }
            ;
            NewsNotice.NewsType = Convert.ToInt32(NewsType);//类别
            if (ShowType.Trim() != "1" && ShowType.Trim() != "2" && ShowType.Trim() != "3" && ShowType.Trim() != "-1")
            {
                return new ResultNewsAdd()
                       {
                           Result = "F", Description = "展示效果异常"
                       }
            }
            ;
            if (ShowType != "-1")
            {
                NewsNotice.ShowType = ShowType == "3"?"1,2":ShowType;//标红、加new
            }
            //标准参数
            NewsNotice.CreateDate   = DateTime.Now;
            NewsNotice.CreateUserID = Convert.ToInt32(userID);
            NewsNotice.ts           = DateTime.Now;
            NewsNotice.modifyuser   = Convert.ToInt32(userID);
            int newsrid = 0;
            newsrid = new Hi.BLL.BD_CompNews().Add(NewsNotice);

            if (newsrid <= 0)
            {
                return new ResultNewsAdd()
                       {
                           Result = "F", Description = "添加失败", NewsID = newsrid.ToString()
                       }
            }
            ;
            if (IsTop == "1")//置顶数量不能超过3个
            {
                List <Hi.Model.BD_CompNews> CompNew = new Hi.BLL.BD_CompNews().GetList("", " isnull(dr,0)=0 and Compid=" + compID + " and IsEnabled=1 and istop=1 and PMID=0", " createdate desc");

                if (CompNew.Count > 3)
                {
                    for (int i = 0; i < CompNew.Count; i++)
                    {
                        if (i > 1 && CompNew[i].ID != newsrid)
                        {
                            CompNew[i].IsTop      = 0;
                            NewsNotice.ts         = DateTime.Now;
                            NewsNotice.modifyuser = Convert.ToInt32(userID);
                            new Hi.BLL.BD_CompNews().Update(CompNew[i]);
                        }
                    }
                }
            }

            new MsgSend().GetMsgService(newsrid.ToString(), "1");
            return(new ResultNewsAdd()
            {
                Result = "T", Description = "添加成功", NewsID = newsrid.ToString()
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "CompNewsAdd :" + JSon);
            return(new ResultNewsAdd()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Exemplo n.º 18
0
    public ResultNoTime GetMessageDeleteId(string JSon)
    {
        try
        {
            string userID = string.Empty;
            string disID  = string.Empty;
            string IDlist = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["UnreadMessageID"].ToString() != "")
            {
                userID = JInfo["UserID"].ToString().Trim();

                disID  = JInfo["ResellerID"].ToString().Trim();
                IDlist = JInfo["UnreadMessageID"].ToString().Trim();
            }
            else
            {
                return(new ResultNoTime()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultNoTime()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.IsEnabled == 0)
            {
                return new ResultNoTime()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;

            string     newlist = string.Empty;
            List <int> intList = new List <int>();
            List <Hi.Model.BD_CompNews> list = new Hi.BLL.BD_CompNews().GetList("", "ID in (" + IDlist + ") and (dr=1 or IsEnabled=0)", "");
            if (list != null && list.Count > 0)
            {
                newlist = string.Join(",", list.Select(p => p.ID));
            }
            return(new ResultNoTime()
            {
                Result = "T", Description = "获取成功", DeleteMessageID = newlist
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetMessageDeleteId :" + JSon);
            return(new ResultNoTime()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
Exemplo n.º 19
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtNewsTitle.Value.Trim()))
        {
            JScript.AlertMsgOne(this, "消息标题不能为空!", JScript.IconOption.错误);
            return;
        }

        Hi.Model.BD_CompNews NewsNotice = null;

        if (KeyID != 0)
        {
            NewsNotice              = new Hi.BLL.BD_CompNews().GetModel(KeyID);
            NewsNotice.NewsTitle    = Common.NoHTML(txtNewsTitle.Value.Trim());
            NewsNotice.NewsContents = content7.Text.Trim();
            //是否启用
            if (this.RdIsbled1.Checked)
            {
                NewsNotice.IsEnabled = 1;
            }
            else
            {
                NewsNotice.IsEnabled = 0;
            }
            //是否置顶
            if (this.RdTop3.Checked)
            {
                NewsNotice.IsTop = 1;
            }
            else
            {
                NewsNotice.IsTop = 0;
            }
            //类别
            if (this.RdType1.Checked)
            {
                NewsNotice.NewsType = 1;
            }
            else if (this.RdType2.Checked)
            {
                NewsNotice.NewsType = 2;
            }
            else if (this.RdType3.Checked)
            {
                NewsNotice.NewsType = 3;
            }
            else if (this.RdType4.Checked)
            {
                NewsNotice.NewsType = 4;
            }
            else if (this.RdType5.Checked)
            {
                NewsNotice.NewsType = 5;
            }
            string ShowType = "";
            if (CkShowType1.Checked)
            {
                ShowType = "1";
            }
            if (CkShowType2.Checked)
            {
                if (ShowType == "")
                {
                    ShowType = "2";
                }
                else
                {
                    ShowType += "," + "2";
                }
            }
            NewsNotice.ShowType   = ShowType;
            NewsNotice.ts         = DateTime.Now;
            NewsNotice.modifyuser = UserID;
            if (new Hi.BLL.BD_CompNews().Update(NewsNotice))
            {
                if (this.RdTop3.Checked)
                {
                    List <Hi.Model.BD_CompNews> CompNew = new Hi.BLL.BD_CompNews().GetList("", " isnull(dr,0)=0 and Compid=" + CompID + " and IsEnabled=1 and istop=1", " CreateDate desc");
                    if (CompNew.Count > 3)
                    {
                        for (int i = 0; i < CompNew.Count; i++)
                        {
                            if (i > 1 && CompNew[i].ID != NewsNotice.ID)
                            {
                                CompNew[i].IsTop = 0;
                                new Hi.BLL.BD_CompNews().Update(CompNew[i]);
                            }
                        }
                    }
                }
                //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='NewsInfo.aspx?KeyID=" + KeyID + "'; }");
                Response.Redirect("NewsInfo.aspx?KeyID=" + KeyID);
            }
        }
        else
        {
            NewsNotice              = new Hi.Model.BD_CompNews();
            NewsNotice.CompID       = CompID;
            NewsNotice.NewsTitle    = Common.NoHTML(txtNewsTitle.Value.Trim());
            NewsNotice.NewsContents = content7.Text.Trim();
            //是否启用
            if (this.RdIsbled1.Checked)
            {
                NewsNotice.IsEnabled = 1;
            }
            else
            {
                NewsNotice.IsEnabled = 0;
            }
            //是否置顶
            if (this.RdTop3.Checked)
            {
                NewsNotice.IsTop = 1;
            }
            else
            {
                NewsNotice.IsTop = 0;
            }
            //类别
            if (this.RdType1.Checked)
            {
                NewsNotice.NewsType = 1;
            }
            else if (this.RdType2.Checked)
            {
                NewsNotice.NewsType = 2;
            }
            else if (this.RdType3.Checked)
            {
                NewsNotice.NewsType = 3;
            }
            else if (this.RdType4.Checked)
            {
                NewsNotice.NewsType = 4;
            }
            else if (this.RdType5.Checked)
            {
                NewsNotice.NewsType = 5;
            }
            string ShowType = "";
            if (CkShowType1.Checked)
            {
                ShowType = "1";
            }
            if (CkShowType2.Checked)
            {
                if (ShowType == "")
                {
                    ShowType = "2";
                }
                else
                {
                    ShowType += "," + "2";
                }
            }
            NewsNotice.ShowType = ShowType;
            //标准参数
            NewsNotice.CreateDate   = DateTime.Now;
            NewsNotice.CreateUserID = UserID;
            NewsNotice.ts           = DateTime.Now;
            NewsNotice.modifyuser   = UserID;
            int newsrid = 0;
            newsrid = new Hi.BLL.BD_CompNews().Add(NewsNotice);
            if (newsrid > 0)
            {
                WebReference.AppService app = new AppService();
                try
                {
                    app.MsgPush(newsrid.ToString(), "1");
                }
                catch
                {
                    app.Abort();
                }

                if (this.RdTop3.Checked)
                {
                    List <Hi.Model.BD_CompNews> CompNew = new Hi.BLL.BD_CompNews().GetList("", " isnull(dr,0)=0 and Compid=" + CompID + " and IsEnabled=1 and istop=1 and PMID=0", " createdate desc");
                    if (CompNew.Count > 3)
                    {
                        for (int i = 0; i < CompNew.Count; i++)
                        {
                            if (i > 1 && CompNew[i].ID != newsrid)
                            {
                                CompNew[i].IsTop = 0;
                                new Hi.BLL.BD_CompNews().Update(CompNew[i]);
                            }
                        }
                    }
                }
                Response.Redirect("NewsInfo.aspx?KeyID=" + newsrid);
            }
        }
    }
Exemplo n.º 20
0
    public void Bind()
    {
        //首次进行页面清除Session
        Session.Remove("GoodsPrice");
        if (KeyID != 0)
        {
            string Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", CompID);
            Hi.Model.BD_Promotion ProModel = ProBll.GetModel(KeyID);

            //促销公告
            List <Hi.Model.BD_CompNews> newsl = new Hi.BLL.BD_CompNews().GetList("", " PMID=" + KeyID + "and isnull(IsEnabled,0)=1", "");

            if (ProModel != null)
            {
                this.txtPromotiontitle.Value = ProModel.ProTitle;
                this.txtPromotionDate.Value  = ProModel.ProStartTime == DateTime.MinValue ? "" : ProModel.ProStartTime.ToString("yyyy-MM-dd");
                this.txtPromotionDate1.Value = ProModel.ProEndTime == DateTime.MinValue ? "" : ProModel.ProEndTime.ToString("yyyy-MM-dd");
                this.txtProInfos.Value       = ProModel.ProInfos;

                if (newsl != null && newsl.Count > 0)
                {
                    this.isOkComNews.Checked = true;
                    this.isNoComNews.Checked = false;
                }
                else
                {
                    this.isOkComNews.Checked = false;
                    this.isNoComNews.Checked = true;
                }

                //促销方式
                if (ProModel.ProType == 3)
                {
                    this.promotionType3.Checked = true;
                    this.txtSendFull.Value      = string.Format("{0:N4}", ProModel.Discount.ToString("#,####" + Digits));
                }
                else
                {
                    this.promotionType4.Checked = true;
                    this.txtDiscount.Value      = string.Format("{0:N4}", ProModel.Discount.ToString("#,####" + Digits));
                }
                //促销禁用
                if (ProModel.IsEnabled == 0)
                {
                    this.IsEnabled0.Checked = true;
                }
                else
                {
                    this.IsEnabled1.Checked = true;
                }

                decimal count = 0;
                //促销活动商品明细
                List <Hi.Model.BD_PromotionDetail> gl = ProDBll.GetList("", " CompId=" + this.CompID + " and ProID=" + KeyID, "");
                if (gl != null && gl.Count > 0)
                {
                    List <Hi.Model.BD_GoodsInfo> ll = new List <Hi.Model.BD_GoodsInfo>();

                    Hi.Model.BD_GoodsInfo model = null;
                    foreach (var item in gl)
                    {
                        model              = new Hi.Model.BD_GoodsInfo();
                        model.CompID       = this.CompID;
                        model.IsEnabled    = true;
                        model.CreateUserID = this.UserID;
                        model.CreateDate   = DateTime.Now;
                        model.ts           = DateTime.Now;
                        model.modifyuser   = this.UserID;
                        model.ID           = item.GoodInfoID;
                        model.GoodsID      = item.GoodsID;
                        model.SalePrice    = GoodsPrice(item.GoodInfoID.ToString());
                        model.TinkerPrice  = item.GoodsPrice; //促销价
                        count              = item.GoodsPrice;
                        ll.Add(model);
                    }
                    if (ProModel.ProType == 3)
                    {
                        //满送
                        this.txtSendNum.Value = string.Format("{0:N4}", count.ToString("#,####" + Digits));
                    }
                    Session["GoodsPrice"] = ll;
                    this.rpDtl.DataSource = ll;
                    this.rpDtl.DataBind();
                }
            }
        }
        else
        {
            this.rpDtl.DataSource = "";
            this.rpDtl.DataBind();
        }
    }
Exemplo n.º 21
0
    /// <summary>
    /// 数据绑定
    /// </summary>
    private void Bind()
    {
        if (KeyID != 0)
        {
            Hi.Model.BD_Promotion ProModel = new Hi.BLL.BD_Promotion().GetModel(KeyID);
            //促销公告
            List <Hi.Model.BD_CompNews> newsl = new Hi.BLL.BD_CompNews().GetList("", " PMID=" + KeyID + "and isnull(IsEnabled,0)=1", "");

            if (ProModel != null)
            {
                if (newsl != null && newsl.Count > 0)
                {
                    this.isOkComNews.Checked = true;
                    this.isNoComNews.Checked = false;
                }
                else
                {
                    this.isOkComNews.Checked = false;
                    this.isNoComNews.Checked = true;
                }
                this.txtPromotionDate.Value  = ProModel.ProStartTime == DateTime.MinValue ? "" : ProModel.ProStartTime.ToString("yyyy-MM-dd");
                this.txtPromotionDate1.Value = ProModel.ProEndTime == DateTime.MinValue ? "" : ProModel.ProEndTime.ToString("yyyy-MM-dd");
                this.txtProInfos.Value       = ProModel.ProInfos;
                //促销禁用
                if (ProModel.IsEnabled == 0)
                {
                    this.IsEnabled0.Checked = true;
                    this.IsEnabled1.Checked = false;
                }
                else
                {
                    this.IsEnabled0.Checked = false;
                    this.IsEnabled1.Checked = true;
                }
                List <Hi.Model.BD_PromotionDetail2> ll = new Hi.BLL.BD_PromotionDetail2().GetList("", "isnull(dr,0)=0 and proId=" + KeyID + " and compId=" + this.CompID, "");
                if (ll.Count > 1)
                {
                    this.Radio1.Checked = true;
                    this.Radio2.Checked = false;
                }
                else
                {
                    this.Radio2.Checked = true;
                    this.Radio1.Checked = false;
                }
                string html = "";
                if (ProModel.ProType == 5)
                {
                    this.promotionType3.Checked = true;
                    this.promotionType4.Checked = false;
                    int z = 0;
                    foreach (Hi.Model.BD_PromotionDetail2 item in ll)
                    {
                        z++;

                        html += "<label>订单金额满¥<input type=\"text\" onkeyup='KeyInt2(this)' id=\"txtPrice" + z + "\" class=\"send txtPrice\" style=\"width: 50px;\" name=\"txtPrice\" value=\"" + item.OrderPrice.ToString("f2") + "\" />,立减¥<input type=\"text\" id=\"txtSendFull" + z + "\" onkeyup='KeyInt2(this)' class=\"send txtSendFull\" name=\"txtSendFull\" style=\"width: 50px;\" value=\"" + item.Discount.ToString("f2") + "\"/>";
                        if (z > 1)
                        {
                            html += "<a class=\"theme-color ml20 deleteItem\" href=\"javascript:;\">删除</a>";
                        }
                        html += "</label><br>";
                    }
                    this.SendFull.InnerHtml = html.Substring(0, html.LastIndexOf("<"));
                }
                else if (ProModel.ProType == 6)
                {
                    this.promotionType4.Checked = true;
                    this.promotionType3.Checked = false;
                    int x = 0;
                    foreach (Hi.Model.BD_PromotionDetail2 item in ll)
                    {
                        x++;
                        html += "<label>订单金额满¥<input type=\"text\" onkeyup='KeyInt2(this)' id=\"txtPrices" + x + "\" class=\"send txtPrices\" style=\"width: 50px;\" name=\"txtPrices\"  value=\"" + item.OrderPrice.ToString("f2") + "\"/>,打折(<input type=\"text\" id=\"txtDiscount" + x + "\" onkeyup='KeyInt2(this)' class=\"send txtDiscount\" name=\"txtDiscount\" style=\"width: 20px;\"  value=\"" + Convert.ToInt32(item.Discount) + "\"/>)%";
                        if (x > 1)
                        {
                            html += "<a class=\"theme-color ml20 deleteItem\" href=\"javascript:;\">删除</a>";
                        }
                        html += "</label><br>";
                    }
                    this.Discount.InnerHtml = html.Substring(0, html.LastIndexOf("<"));
                }
            }
        }
    }