public void getFavorable(string id, string cellPhone = "")
 {
     string ret = "{}";
     try
     {
         FavorableInfoEntity entity = new FavorableInfoEntity();
         if (!string.IsNullOrEmpty(cellPhone))
         {
             entity = OrderBLL.getFavorableInfo(cellPhone, id);
         }
         else
         {
             entity = OrderBLL.getFavorableInfoById(id);
         }
         if (entity != null)
         {
             ret = JSONHelper.GetJSON<FavorableInfoEntity>(entity);
         }
     }
     catch (Exception ex)
     {
         LogControl.WriteError("根据Id获取优惠信息失败:" + ex.Message);
     }
     Context.Response.Write(ret);
 }
Exemple #2
0
 public FavorableInfoEntity getFavorableInfoById(string id)
 {
     try
     {
         FavorableInfoEntity result = null;
         SqlParameter[] para = new SqlParameter[] { new SqlParameter("@Id", id) };
         var dt = helper.GetDataTableStoredProcedure("gsp_GetFavorableInfoById", para);
         if (dt != null && dt.Rows.Count > 0)
         {
             result = new FavorableInfoEntity()
             {
                 CouponCode = "",
                 ImgAlt = dt.Rows[0]["imgAlt"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[0]["imgAlt"]),
                 ImgBackColor = dt.Rows[0]["imgBackColor"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[0]["imgBackColor"]),
                 ImgPath = dt.Rows[0]["imgPath"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[0]["imgPath"]),
                 Price = 0,
                 UrlPath = dt.Rows[0]["urlPath"] == DBNull.Value ? "" : Convert.ToString(dt.Rows[0]["urlPath"])
             };
         }
         return result;
     }
     catch (Exception )
     {
         LogControl.WriteError("getFavorableInfoById获取优惠配置失败");
         return null;
     }
 }