Esempio n. 1
0
        /// <summary>
        /// ��ȡָ����ŵ����Źؼ��ֶ���
        /// </summary>
        /// <param name="keyId">ָ���Ķ�����</param>
        /// <returns>�ñ�Ŷ�Ӧ�����Źؼ��ֶ���</returns>
        public SearchKeyInfo GetItem(long keyId)
        {
            SearchKeyInfo info = null;

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@strWhere","where SK_ID="+keyId.ToString()),
                new SqlParameter("@strTableName","b_SearchKey"),
                new SqlParameter("@strOrder","")
            };

            using (SqlDataReader reader = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.StoredProcedure, "XYP_SelectByWhere", param))
            {
                if (reader.Read())
                {
                    info = new SearchKeyInfo();

                    info.SK_ID = Core.MyConvert.GetInt64(reader["SK_ID"].ToString());
                    info.SK_Name = reader["SK_Name"].ToString();
                    info.SK_Sort = reader["SK_Sort"].ToString();
                    info.SK_Count = Core.MyConvert.GetInt64(reader["SK_Count"].ToString());
                    info.SK_IsCommend = Core.MyConvert.GetBoolean(reader["SK_IsCommend"].ToString());
                    info.SK_IsRanking = Core.MyConvert.GetBoolean(reader["SK_IsRanking"].ToString());
                    info.SK_AddTime = Core.MyConvert.GetDateTime(reader["SK_AddTime"].ToString());
                    info.SK_LastSearchTime = Core.MyConvert.GetDateTime(reader["SK_LastSearchTime"].ToString());
                    info.SK_CustomPrice = reader["SK_CustomPrice"].ToString();
                }
            }

            return info;
        }
Esempio n. 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;
            }

        }
    }
Esempio n. 3
0
        /// <summary>
        /// �޸�ָ�������Źؼ��ֶ���
        /// </summary>
        /// <param name="si">Ҫ�޸ĵĹؼ��ֶ���</param>
        /// <returns>����,���ڻ����0��ɹ�,С��0��ʧ��</returns>
        public int Update(SearchKeyInfo sk)
        {
            if (object.Equals(null, sk))
                return -1;

            return DAL.Update(sk);
        }
Esempio n. 4
0
 public bool IsExistsOnUpdate(SearchKeyInfo info)
 {
     return DAL.IsExistsOnUpdate(info);
 }
Esempio n. 5
0
        /// <summary>
        /// ����µ����������ؼ��ֶ���
        /// </summary>
        /// <param name="si">�ؼ��ֶ���</param>
        /// <returns>����,���ڻ����0��ɹ�,С��0��ʧ��</returns>
        public int Insert(SearchKeyInfo sk)
        {
            if (object.Equals(null, sk))
                return -1;

            return DAL.Insert(sk);
        }
Esempio n. 6
0
        /// <summary>
        /// �޸�ָ�������Źؼ��ֶ���
        /// </summary>
        /// <param name="si">Ҫ�޸ĵĹؼ��ֶ���</param>
        /// <returns>����,���ڻ����0��ɹ�,С��0��ʧ��</returns>
        public int Update(SearchKeyInfo info)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@SK_ID",info.SK_ID),
                new SqlParameter("@SK_Name",info.SK_Name),
                new SqlParameter("@SK_Sort",info.SK_Sort),
                new SqlParameter("@SK_Count",info.SK_Count),
                new SqlParameter("@SK_IsCommend",info.SK_IsCommend),
                new SqlParameter("@SK_IsRanking",info.SK_IsRanking),
                new SqlParameter("@SK_CustomPrice",info.SK_CustomPrice)
            };

            int row = XYECOM.Core.Data.SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "XYP_UpdateSearchKey", param);

            return row;
        }
Esempio n. 7
0
        public bool IsExistsOnUpdate(SearchKeyInfo info)
        {
            string sql = "select count(1) from b_SearchKey where SK_Name='{0}' and SK_Sort='{1}' and SK_ID<>{2}";
            sql = string.Format(sql, info.SK_Name, info.SK_Sort, info.SK_ID);

            object obj = XYECOM.Core.Data.SqlHelper.ExecuteScalar(sql);
            if (obj != null)
            {
                try
                {
                    return (int.Parse(obj.ToString()) > 0);

                }
                catch (Exception)
                {
                    return false;
                }

            }

            return false;
        }