/// <summary>
 /// Copies the elements of the specified <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> array to the end of the collection.
 /// </summary>
 /// <param name="value">An array of type <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> containing the Components to add to the collection.</param>
 public void AddRange(Goodsrateinfo[] value)
 {
     for (int i = 0; (i < value.Length); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 设置用户信用(该方法会在用户进行评价之后调用)
        /// </summary>
        /// <param name="goodsrateinfo">评价信息</param>
        /// <param name="uid">被评价人的uid</param>
        /// <returns></returns>
        public static bool SetUserCredit(Goodsrateinfo goodsRateInfo, int uid)
        {
            //获取被评价人的信用信息
            GoodsusercreditinfoCollection goodsUserCreditInfoColl = GetUserCreditList(uid);

            //如果信用表中不存在, 则创建被评价人的信息
            if (goodsUserCreditInfoColl.Count == 0)
            {
                //当初始化信息失败时则返回
                if (DbProvider.GetInstance().InitGoodsUserCredit(uid) <= 0)
                    return false;

                //再次获取被评价人的信用信息
                goodsUserCreditInfoColl = GetUserCreditList(uid);
            }

            //用于绑定要更新的用户信用
            Goodsusercreditinfo cur_creditInfo = null;
            foreach (Goodsusercreditinfo goodsUserCreditInfo in goodsUserCreditInfoColl)
            {
                //查找符合条件的用户信用
                if (goodsRateInfo.Uidtype == goodsUserCreditInfo.Ratefrom && goodsRateInfo.Ratetype == goodsUserCreditInfo.Ratetype)
                    cur_creditInfo = goodsUserCreditInfo; break;
            }

            //当不为空, 表示找到了要更新的用户信用信息, 则进行下面的绑定操作
            if (cur_creditInfo != null)
            {
                IDataReader iDataReader = DbProvider.GetInstance().GetGoodsRateCount(uid, goodsRateInfo.Uidtype, goodsRateInfo.Ratetype);
                //绑定新的查询数据
                if (iDataReader.Read())
                {
                    cur_creditInfo.Ratefrom = goodsRateInfo.Uidtype;
                    cur_creditInfo.Ratetype = goodsRateInfo.Ratetype;
                    cur_creditInfo.Oneweek = TypeConverter.ObjectToInt(iDataReader["oneweek"]);
                    cur_creditInfo.Onemonth = TypeConverter.ObjectToInt(iDataReader["onemonth"]);
                    cur_creditInfo.Sixmonth = TypeConverter.ObjectToInt(iDataReader["sixmonth"]);
                    cur_creditInfo.Sixmonthago = TypeConverter.ObjectToInt(iDataReader["sixmonthago"]);
                    UpdateUserCredit(cur_creditInfo);                    
                }
                iDataReader.Close();
            }
            return true;
        }
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(Goodsrateinfo value)
 {
     return(this.List.Contains(value));
 }
 public int Add(Goodsrateinfo value)
 {
     return(this.List.Add(value));
 }
 public void Remove(Goodsrateinfo value)
 {
     List.Remove(value);
 }
 public void Insert(int index, Goodsrateinfo value)
 {
     List.Insert(index, value);
 }
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(Goodsrateinfo value)
 {
     return(this.List.IndexOf(value));
 }
Esempio n. 8
0
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

            headerad = "";
            footerad = "";

            // 如果商品交易日志不正确
            if (goodstradelogid <= 0)
            {
                AddErrLine("无效的交易日志信息.");
                return;
            }

            goodstradelog = TradeLogs.GetGoodsTradeLogInfo(goodstradelogid);
            int oldstatus = goodstradelog.Status;

            if (config.Enablemall == 1) //开启普通模式
                forumid = GoodsCategories.GetCategoriesFid(goodstradelog.Categoryid);
            else
                forumid = 0;

            ///得到广告列表
            ///头部
            headerad = Advertisements.GetOneHeaderAd("", forumid);
            footerad = Advertisements.GetOneFooterAd("", forumid);
            doublead = Advertisements.GetDoubleAd("", forumid);
            floatad = Advertisements.GetFloatAd("", forumid);

            if (goodstradelog.Sellerid != userid && goodstradelog.Buyerid != userid)
            {
                AddErrLine("您的身份不是买卖双方, 因为不能评价");
                return;
            }
            if (goodstradelog.Status != 7 && goodstradelog.Status != 17)
            {
                AddErrLine("交易尚未结束, 因为不能评价");
                return;
            }
            if (!GoodsRates.CanRate(goodstradelog.Id, userid)) //如果当前用户已评价过则不允许再评价
            {
                AddErrLine("不能重复评价");
                return;
            }
           

            //如果是提交...
            if (ispost)
            {
                Goodsrateinfo goodsrateinfo = new Goodsrateinfo();
                goodsrateinfo.Ip = DNTRequest.GetIP();
                goodsrateinfo.Postdatetime = DateTime.Now;
                goodsrateinfo.Price = goodstradelog.Number * goodstradelog.Price + goodstradelog.Transportfee;
                goodsrateinfo.Ratetype = DNTRequest.GetInt("ratetype", 0);
                goodsrateinfo.Uid = userid;
                goodsrateinfo.Username = username;
                goodsrateinfo.Message = DNTRequest.GetString("message");
                goodsrateinfo.Goodstradelogid = goodstradelog.Id;
                goodsrateinfo.Goodstitle = goodstradelog.Subject;
                goodsrateinfo.Goodsid = goodstradelog.Goodsid;
                goodsrateinfo.Explain = "";

                if (goodstradelog.Buyerid == userid)  //买家
                {
                    goodsrateinfo.Uidtype = 2;
                    goodsrateinfo.Ratetouid = goodstradelog.Sellerid;
                    goodsrateinfo.Ratetousername = goodstradelog.Seller;
                    goodstradelog.Ratestatus = 2;
                }
                else //卖家
                {
                    goodsrateinfo.Uidtype = 1;
                    goodsrateinfo.Ratetouid = goodstradelog.Buyerid;
                    goodsrateinfo.Ratetousername = goodstradelog.Buyer;
                    goodstradelog.Ratestatus = 1;
                }
                if (GoodsRates.CreateGoodsRate(goodsrateinfo) > 0) //如果评价成功
                {
                    if(GoodsRates.RateClosed(goodsrateinfo.Goodstradelogid,goodstradelog.Sellerid,goodstradelog.Buyerid))
                    {
                        goodstradelog.Ratestatus = 3;
                        TradeLogs.UpdateTradeLog(goodstradelog, oldstatus); //更新交易的评价状态
                    }

                    GoodsUserCredits.SetUserCredit(goodsrateinfo, goodsrateinfo.Uidtype == 1 ? goodstradelog.Buyerid : goodstradelog.Sellerid);

                    SetUrl(base.ShowGoodsAspxRewrite(goodsrateinfo.Goodsid));
                    SetMetaRefresh();
                    AddMsgLine("您的评价已经成功<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsrateinfo.Goodsid) + "\">点击这里返回商品页面</a>)<br />");
                }
            }
        }
Esempio n. 9
0
            /// <summary>
            /// 获得商品评价信息(DTO)
            /// </summary>
            /// <param name="dt">要转换的数据表</param>
            /// <returns>返回商品评价信息</returns>
            public static Goodsrateinfo[] GetGoodsRatesInfoArray(DataTable dt)
            {
                if (dt == null || dt.Rows.Count == 0)
                    return null;

                Goodsrateinfo[] goodsratesinfoarray = new Goodsrateinfo[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    goodsratesinfoarray[i] = new Goodsrateinfo();
                    goodsratesinfoarray[i].Id = TypeConverter.ObjectToInt(dt.Rows[i]["id"]);
                    goodsratesinfoarray[i].Goodstradelogid = TypeConverter.ObjectToInt(dt.Rows[i]["goodstradelogid"]);
                    goodsratesinfoarray[i].Message = dt.Rows[i]["message"].ToString();
                    goodsratesinfoarray[i].Explain = dt.Rows[i]["explain"].ToString();
                    goodsratesinfoarray[i].Ip = dt.Rows[i]["ip"].ToString();
                    goodsratesinfoarray[i].Uid = TypeConverter.ObjectToInt(dt.Rows[i]["uid"]);
                    goodsratesinfoarray[i].Uidtype = TypeConverter.ObjectToInt(dt.Rows[i]["uidtype"]);
                    goodsratesinfoarray[i].Ratetouid = TypeConverter.ObjectToInt(dt.Rows[i]["ratetouid"]);
                    goodsratesinfoarray[i].Username = dt.Rows[i]["username"].ToString();
                    goodsratesinfoarray[i].Postdatetime = Convert.ToDateTime(dt.Rows[i]["postdatetime"].ToString());
                    goodsratesinfoarray[i].Goodsid = TypeConverter.ObjectToInt(dt.Rows[i]["goodsid"]);
                    goodsratesinfoarray[i].Goodstitle = dt.Rows[i]["goodstitle"].ToString();
                    goodsratesinfoarray[i].Price = Convert.ToDecimal(dt.Rows[i]["price"].ToString());
                    goodsratesinfoarray[i].Ratetype = TypeConverter.ObjectToInt(dt.Rows[i]["ratetype"]);
                }
                dt.Dispose();
                return goodsratesinfoarray;
            }
 public int Add(Goodsrateinfo value)
 {
     return this.List.Add(value);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> class containing the specified array of <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> Components.
 /// </summary>
 /// <param name="value">An array of <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> Components with which to initialize the collection. </param>
 public GoodsrateinfoCollection(Goodsrateinfo[] value)
 {
     this.AddRange(value);
 }
 public void Remove(Goodsrateinfo value)
 {
     List.Remove(value);
 }
 public void Insert(int index, Goodsrateinfo value)
 {
     List.Insert(index, value);
 }
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(Goodsrateinfo value)
 {
     return this.List.IndexOf(value);
 }
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="GoodsrateinfoCollection">GoodsrateinfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(Goodsrateinfo value)
 {
     return this.List.Contains(value);
 }
Esempio n. 16
0
            /// <summary>
            /// 获得商品评价信息(DTO)
            /// </summary>
            /// <param name="__idatareader">要转换的数据</param>
            /// <returns>返回商品评价信息</returns>
            public static GoodsrateinfoCollection GetGoodsRateInfoList(IDataReader reader)
            {
                GoodsrateinfoCollection goodsRateInfoColl = new GoodsrateinfoCollection();

                while (reader.Read())
                {
                    Goodsrateinfo goodsRateInfo = new Goodsrateinfo();
                    goodsRateInfo.Id = TypeConverter.ObjectToInt(reader["id"]);
                    goodsRateInfo.Goodstradelogid = TypeConverter.ObjectToInt(reader["goodstradelogid"]);
                    goodsRateInfo.Message = reader["message"].ToString().Trim();
                    goodsRateInfo.Explain = reader["explain"].ToString().Trim();
                    goodsRateInfo.Ip = reader["ip"].ToString().Trim();
                    goodsRateInfo.Uid = TypeConverter.ObjectToInt(reader["uid"]);
                    goodsRateInfo.Uidtype = Convert.ToInt16(reader["uidtype"].ToString());
                    goodsRateInfo.Ratetouid = TypeConverter.ObjectToInt(reader["ratetouid"]);
                    goodsRateInfo.Username = reader["username"].ToString().Trim();
                    goodsRateInfo.Postdatetime = Convert.ToDateTime(reader["postdatetime"]);
                    goodsRateInfo.Goodsid = TypeConverter.ObjectToInt(reader["goodsid"]);
                    goodsRateInfo.Goodstitle = reader["goodstitle"].ToString().Trim();
                    goodsRateInfo.Price = Convert.ToDecimal(reader["price"].ToString());
                    goodsRateInfo.Ratetype = Convert.ToInt16(reader["ratetype"].ToString());

                    goodsRateInfoColl.Add(goodsRateInfo);
                }
                reader.Close();
                return goodsRateInfoColl;
            }
 /// <summary>
 /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
 /// <param name="index">The index of the array at which to begin inserting.</param>
 public void CopyTo(Goodsrateinfo[] array, int index)
 {
     this.List.CopyTo(array, index);
 }
Esempio n. 18
0
 /// <summary>
 /// 创建商品评价信息
 /// </summary>
 /// <param name="goodsrateinfo">要创建的商品评价信息</param>
 /// <returns></returns>
 public static int CreateGoodsRate(Goodsrateinfo goodsRateInfo)
 {
     return DbProvider.GetInstance().CreateGoodsRate(goodsRateInfo);
 }
Esempio n. 19
0
        /// <summary>
        /// 发表商品评价
        /// </summary>
        /// <param name="goodsrates">要创建的商品评价信息</param>
        /// <returns></returns>
        public int CreateGoodsRate(Goodsrateinfo goodsRates)
        {
            DbParameter[] parms = 
				{
						DbHelper.MakeInParam("@goodstradelogid", (DbType)SqlDbType.Int, 4,goodsRates.Goodstradelogid),
						DbHelper.MakeInParam("@message", (DbType)SqlDbType.NChar, 200,goodsRates.Message),
						DbHelper.MakeInParam("@explain", (DbType)SqlDbType.NChar, 200,goodsRates.Explain),
						DbHelper.MakeInParam("@ip", (DbType)SqlDbType.NVarChar, 15,goodsRates.Ip),
						DbHelper.MakeInParam("@uid", (DbType)SqlDbType.Int, 4,goodsRates.Uid),
						DbHelper.MakeInParam("@uidtype", (DbType)SqlDbType.TinyInt, 1,goodsRates.Uidtype),
                        DbHelper.MakeInParam("@ratetouid", (DbType)SqlDbType.Int, 4,goodsRates.Ratetouid),
                        DbHelper.MakeInParam("@ratetousername", (DbType)SqlDbType.NChar, 20,goodsRates.Ratetousername),
						DbHelper.MakeInParam("@username", (DbType)SqlDbType.NChar, 20,goodsRates.Username),
						DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.DateTime, 8,goodsRates.Postdatetime),
						DbHelper.MakeInParam("@goodsid", (DbType)SqlDbType.Int, 4,goodsRates.Goodsid),
						DbHelper.MakeInParam("@goodstitle", (DbType)SqlDbType.NChar, 60,goodsRates.Goodstitle),
						DbHelper.MakeInParam("@price", (DbType)SqlDbType.Decimal, 18,goodsRates.Price),
						DbHelper.MakeInParam("@ratetype", (DbType)SqlDbType.TinyInt, 1,goodsRates.Ratetype)
				};
            string commandText = String.Format("INSERT INTO [{0}goodsrates] ([goodstradelogid], [message], [explain], [ip], [uid], [uidtype], [ratetouid], [ratetousername], [username], [postdatetime], [goodsid], [goodstitle], [price], [ratetype]) VALUES (@goodstradelogid, @message, @explain, @ip, @uid, @uidtype, @ratetouid, @ratetousername, @username, @postdatetime, @goodsid, @goodstitle, @price, @ratetype);SELECT SCOPE_IDENTITY()  AS 'id'", BaseConfigs.GetTablePrefix);

            return TypeConverter.ObjectToInt(DbHelper.ExecuteDataset(CommandType.Text, commandText, parms).Tables[0].Rows[0][0], -1);
        }