예제 #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", "") + "\"}");
     }
 }
예제 #2
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 protected void binding()
 {
     gi = BLL.goodsBLL.GetModel(goodsid, "GoodsId", "");
 }