예제 #1
0
    /// <summary>
    /// 绑定要修改的热门关键字
    /// </summary>
    /// <param name="skid"></param>
    private void BindData(string skid)
    {
        if (!string.IsNullOrEmpty(skid))
        {
            SearchKeyInfo ski = new SearchKey().GetItem(int.Parse(skid));

            if (ski == null) return;

            this.hidskid.Value = ski.SK_ID.ToString();
            this.txtKeywords.Text = ski.SK_Name;
            this.hidModuleName.Value = ski.SK_Sort.Trim();

            this.lbtype.Text = GetModuleCNName(ski.SK_Sort);

            this.txtCount.Text = ski.SK_Count.ToString();

            if (ski.SK_IsCommend == true)
                this.rbIsCommendTrue.Checked = true;

            if (ski.SK_IsCommend == false)
                this.rbIsCommendFalse.Checked = true;

            if (ski.SK_IsRanking)
            {
                this.rbIsRankingTrue.Checked = true;
                this.rbIsRankingFalse.Checked = false;
            }
            else
            {
                this.rbIsRankingTrue.Checked = false;
                this.rbIsRankingFalse.Checked = true;
            }

            if (!ski.SK_CustomPrice.Equals(""))
            {
                this.chkIsCustomPrice.Checked = true;
                InitPriceData(ski);
            }
        }
        else
        {
            Alert("要修改的热门关键字编号错误", backURL);
        }
    }
예제 #2
0
    protected void btadd_Click(object sender, EventArgs e)
    {
        XYECOM.Model.SearchKeyInfo keyInfo = new XYECOM.Model.SearchKeyInfo();
        XYECOM.Business.SearchKey BLL = new XYECOM.Business.SearchKey();

        string keywords = this.txtKeywords.Text.Trim().Replace(",,",",").Replace(",",",");

        string[] keys = keywords.Split(',');

        keyInfo.SK_Count = XYECOM.Core.MyConvert.GetInt32(this.txtCount.Text.Trim());

        if (this.rbIsCommendTrue.Checked == true)
            keyInfo.SK_IsCommend = true;
        else
            keyInfo.SK_IsCommend = false;

        if (rbIsRankingTrue.Checked)
            keyInfo.SK_IsRanking = true;
        else
            keyInfo.SK_IsRanking = false;

        keyInfo.SK_CustomPrice = "";

        //如果选定自定义价格
        if (chkIsCustomPrice.Checked)
        {
            XYECOM.Configuration.Ranking objRank = XYECOM.Configuration.Ranking.Instance;

            int total = objRank.Total;

            string strPrice = "";
            int iPrice = 0;

            //记录数据一样的数目
            int tempNumber = 0;

            string customPrice ="";

            for (short i = 1; i <= total; i++)
            {
                strPrice = XYECOM.Core.XYRequest.GetFormString("rank_" + i).Trim();

                iPrice =XYECOM.Core.MyConvert.GetInt32(strPrice);

                if(iPrice <=0)
                {
                    iPrice = objRank.GetPrice(i);
                }
                else
                {
                    if(iPrice == objRank.GetPrice(i))
                    {
                        tempNumber++;
                    }
                }

                if (customPrice.Equals(""))
                    customPrice = strPrice;
                else
                    customPrice += "|" + strPrice;
            }

            if (tempNumber == total)
                customPrice = "";

            keyInfo.SK_CustomPrice = customPrice;
        }

        string names = "";
        string errnames = "";

        if (this.hidskid.Value == "-1")
        {
            foreach (string k in keys)
            {
                if (k.Trim().Equals("")) continue;

                keyInfo.SK_Name = k;

                for (int i = 0; i < this.chkModules.Items.Count; i++)
                {
                    if (this.chkModules.Items[i].Selected == true)
                    {
                        keyInfo.SK_Sort = this.chkModules.Items[i].Value.Trim();
                        int row = BLL.Insert(keyInfo);
                        if (row == -1)
                        {
                            names += this.chkModules.Items[i].Text.Trim();
                        }
                        else if (row == -2)
                        {
                            errnames += this.chkModules.Items[i].Text.Trim();
                        }
                    }
                }
            }
            if (names != "")
            {
                Alert(names + "下已有雷同热词!", "/XYManage/basic/SearchKeyInfo.aspx");
                return;
            }
            else if (errnames != "")
            {
                Alert(errnames + "类别下热词添加失败,可重新添加!", "/XYManage/basic/SearchKeyInfo.aspx");
                return;
            }
            else
            {
                Response.Redirect(backURL);
            }
        }
        else
        {

            keyInfo.SK_Name = keywords;
            keyInfo.SK_ID = Int64.Parse(this.hidskid.Value.Trim());
            keyInfo.SK_Sort = this.hidModuleName.Value.Trim();
            if (!BLL.IsExistsOnUpdate(keyInfo))
            {
                int row = BLL.Update(keyInfo);
                if (row >= 0)
                {
                    Response.Redirect(backURL);
                }
                else
                {
                    Alert("修改热词失败,可重新操作!", "/XYManage/basic/SearchKeyInfo.aspx?sk_id=" + keyInfo.SK_ID);
                    return;
                }
            }
            else
            {
                //存在同名
                Alert(keywords + "下已有雷同热词!", "/XYManage/basic/SearchKeyInfo.aspx?sk_id=" + keyInfo.SK_ID);
                return;
            }

        }
    }
예제 #3
0
    /// <summary>
    /// 定义GridView内响应事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvlist_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int RowNow = Convert.ToInt32(e.CommandArgument);
        Int64 keyId = Convert.ToInt64(gvlist.DataKeys[RowNow].Value);

        if (keyId <= 0) return;

        XYECOM.Business.SearchKey BLL = new XYECOM.Business.SearchKey();
        XYECOM.Model.SearchKeyInfo info = BLL.GetItem(keyId);

        if (info == null) return;

        if (e.CommandName == "SetIsCommend")
        {
            LinkButton lb = (LinkButton)gvlist.Rows[RowNow].Cells[7].Controls[0];
            if (lb.ToolTip == COMMEND_TOOLTIP)
            {
                info.SK_IsCommend = false;
            }
            else if (lb.ToolTip == UNCOMMEND_TOOLTIP)
            {
                info.SK_IsCommend = true;
            }

            BLL.Update(info);
        }

        if (e.CommandName == "SetIsRanking")
        {
            LinkButton lb = (LinkButton)gvlist.Rows[RowNow].Cells[8].Controls[0];
            if (lb.ToolTip == COMMEND_TOOLTIP)
            {
                info.SK_IsRanking = false;
            }
            else if (lb.ToolTip == UNCOMMEND_TOOLTIP)
            {
                info.SK_IsRanking = true;
            }

            BLL.Update(info);
        }

        BindData();
    }
예제 #4
0
    /// <summary>
    /// 单击删除事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnkDel_Click(object sender, EventArgs e)
    {
        XYECOM.Business.SearchKey SK = new XYECOM.Business.SearchKey();

        string id = "";
        foreach (GridViewRow row in this.gvlist.Rows)
        {
            if (((CheckBox)(row.FindControl("chkExport"))).Checked == true)
                id += "," + this.gvlist.DataKeys[row.DataItemIndex].Value.ToString();
        }

        if (id.IndexOf(",") == 0)
            id = id.Substring(1);
        int rowAff = SK.Delete(id);

        BindData();

        if (rowAff < 0)
        {
            Alert("删除失败,可重新操作");
        }
    }
예제 #5
0
 /// <summary>
 /// 搜索次数归零
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnClear_Click(object sender, EventArgs e)
 {
     XYECOM.Business.SearchKey BLL = new XYECOM.Business.SearchKey();
       foreach (GridViewRow row in this.gvlist.Rows)
     {
         if (((CheckBox)(row.FindControl("chkExport"))).Checked == true)
         {
           int  id=XYECOM.Core.MyConvert.GetInt32( this.gvlist.DataKeys[row.DataItemIndex].Value.ToString());
           XYECOM.Model.SearchKeyInfo info = BLL.GetItem(id);
           info.SK_Count = 0;
           BLL.Update(info);
         }
     }
        BindData();
 }