Ejemplo n.º 1
0
 /// <summary>
 /// 添加订单
 /// </summary>
 protected string addcart(int spid)
 {
     try
     {
         if (spid <= 0)
         {
             return("{\"result\":0,\"msg\":\"id错误\"}");
         }
         Model.goodsInfo go = BLL.goodsBLL.GetModel(spid);
         if (go != null && go.GoodsId == spid)
         {
             Model.g_orderInfo gor = new g_orderInfo();
             gor.uid         = uid;
             gor.companyid   = 0;
             gor.goods_count = Convert.ToInt32(Request.Form["number"]);
             gor.goodsid     = spid;
             gor.totalprice  = Convert.ToDecimal(Request.Form["total_price"]);
             gor.ordertype   = go.GoodsType;
             string resultMsg = "";
             int    result    = new BLL.g_orderBLL().add(gor, ref resultMsg);
             if (result > 0)
             {
                 return("{\"result\":" + result + ",\"msg\":\"\"}");
             }
             return("{\"result\":" + result + ",\"msg\":\"" + resultMsg.Replace("\"", "").Replace("\r", "").Replace("\n", "") + "\"}");
         }
         return("{\"result\":0,\"msg\":\"无对应的商品信息\"}");
     }
     catch (Exception exc) {
         return("{\"result\":0,\"msg\":\"" + exc.Message.Replace("\"", "").Replace("\r", "").Replace("\n", "") + "\"}");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 用户兑换
        /// </summary>
        /// <param name="ExchId"></param>
        /// <param name="sellerid">当前商家</param>
        /// <param name="resultMsg"></param>
        /// <returns></returns>
        public static int exch(int ExchId, int sellerid, ref string resultMsg)
        {
            try
            {
                if (ExchId <= 0)
                {
                    resultMsg = "兑换ID错误";
                    return(0);
                }
                if (sellerid <= 0)
                {
                    resultMsg = "商家ID错误";
                    return(0);
                }

                DateTime      now  = DateTime.Now;
                goodsExchInfo info = GetModel(ExchId);
                if (info == null || info.ExchId != ExchId)
                {
                    resultMsg = "不存在对应的兑换信息";
                    return(0);
                }
                g_orderInfo g_orderinfo = BLL.g_orderBLL.GetModel(info.orderid);
                if (g_orderinfo == null || g_orderinfo.orderid != info.orderid)
                {
                    resultMsg = "不存在对应的订单信息";
                    return(0);
                }
                goodsInfo goodsinfo = BLL.goodsBLL.GetModel(info.goodsid);
                if (goodsinfo == null || goodsinfo.GoodsId != info.goodsid)
                {
                    resultMsg = "不存在对应的商品信息";
                    return(0);
                }
                if (goodsinfo.sellerid != sellerid)
                {
                    resultMsg = "此兑换单不属于当前商家";
                    return(0);
                }
                if (now > goodsinfo.EndDate)
                {
                    resultMsg = "此活动已到期";
                    return(0);
                }

                //info.status = 1;
                //info.ExchName = "";
                //info.ExchTel = "";
                //info.ExchZipCode = "";
                //info.ExchAddress = "";
                //return Update(info);
                int result = new goodsExchDAL().exch(ExchId, info.goodsid, ref resultMsg);

                return(result);
            }
            catch (Exception exc) { resultMsg = exc.Message; }
            return(0);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         int         id   = Convert.ToInt32(e.CommandArgument);
         g_orderInfo info = BLL.g_orderBLL.GetModel(id);
         if (info == null || info.orderid != id)
         {
             return;
         }
         int b = BLL.g_orderBLL.Delete(id, "orderid");
         if (b > 0)
         {
             Repeater1bind();
         }
         else
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), DateTime.Now.ToString(), "alert('删除失败!');", true);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 给订单评价
 /// </summary>
 /// <param name="info"></param>
 /// <param name="imglist"></param>
 /// <param name="resultMsg"></param>
 /// <returns></returns>
 public static int add(g_order_evaluationInfo info, List <g_order_evaluation_imgsInfo> imglist, ref string resultMsg)
 {
     try
     {
         if (info.orderno == null || info.orderno.Trim().Length == 0)
         {
             resultMsg = "orderno错误";
             return(0);
         }
         if (info.goodsid <= 0)
         {
             resultMsg = "goodsid错误";
             return(0);
         }
         if (info.uid <= 0)
         {
             resultMsg = "uid错误";
             return(0);
         }
         g_orderInfo g_orderinfo = BLL.g_orderBLL.GetModel(info.orderno, "orderno", "*");
         if (g_orderinfo == null || !g_orderinfo.orderno.Equals(info.orderno))
         {
             resultMsg = "不存在对应的订单信息";
             return(0);
         }
         if (g_orderinfo.ordertype == 2)
         {
             if (g_orderinfo.status != (int)Common.enum_orderstatus.payed)
             {
                 resultMsg = "订单(" + info.orderno + ")未支付,不能评价";
                 return(0);
             }
         }
         if (info.uid != g_orderinfo.uid)
         {
             resultMsg = "你没有对订单(" + info.orderno + ")评价权限";
             return(0);
         }
         if (info.score < 1 || info.score > 5)
         {
             resultMsg = "score参数错误,请选择1-5分的评分";
             return(0);
         }
         if (info.evalua < 0 || info.evalua > 4)
         {
             resultMsg = "evalua参数错误,请选择0-4分的评价";
             return(0);
         }
         if (info.evalua_id > 0)
         {
             string msg = "";
             delete(info.evalua_id, ref msg);
         }
         bool isexists = IsExist("uid=" + info.uid + " and orderno='" + info.orderno + "'");
         if (isexists)
         {
             resultMsg = "您已评价过,不能重复评价";
             return(0);
         }
         int result = Insert(info, BS.Components.Data.Entity.ReturnTypes.Identity);
         if (result > 0)
         {
             if (imglist != null && imglist.Count > 0)
             {
                 try
                 {
                     foreach (g_order_evaluation_imgsInfo imginfo in imglist)
                     {
                         if (imginfo.img == null || imginfo.img.Trim().Equals(""))
                         {
                             continue;
                         }
                         imginfo.evalua_id = result;
                         g_order_evaluation_imgsBLL.Insert(imginfo, BS.Components.Data.Entity.ReturnTypes.Identity);
                     }
                 }
                 catch { }
             }
             //g_orderinfo.has_evalua
             int s = BLL.g_orderBLL.Update("g_order", "has_evalua=1", "orderno='" + info.orderno + "'");
         }
         return(result);
     }
     catch (Exception exc) { resultMsg = exc.Message; }
     return(0);
 }