using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Data; using System.IO; using Mtxfw.Utility.DataAccess; using Mtxfw.Utility; using Mtxfw.Model; using P_Product = Mtxfw.DAL.P_Product; namespace Mtxfw.VipSite.api { public class CommonFunctions { #region 只区分热卖推荐或兑换商城 /// /// 只区分热卖推荐或兑换商城 /// /// /// public static int GetOrderType(DataSet ds) { int result = 0; if (ds.Tables[0].Rows.Count > 0) { Mtxfw.DAL.P_Product dal = new P_Product(); foreach (DataRow row in ds.Tables[0].Rows) { int productId = Convert.ToInt32(row["ProductID"].ToString()); Mtxfw.Model.P_Product model = dal.GetModel(productId); if (model != null) { //model.utype 2表示热卖推荐,0表示兑换商城 if (model.utype == "0") { result = 1; //0表示热卖推荐,1表示兑换商城 break; } } } } return result; } #endregion #region 获取订单详细收获地址 public static string GetOrderAddress(Model.order_info model) { string result = String.Empty; if (model != null) { string provinceName = new Mtxfw.DAL.province().GetProvince(model.Province); string cityName = new Mtxfw.DAL.city().GetCity(model.City); string countyName = new Mtxfw.DAL.county().GetCounty(model.County); string strIFFill = string.Empty; if (model.IFFill == 1) { strIFFill=model.Tradingarea; } else { strIFFill = new Mtxfw.DAL.tradingarea().Gettradingarea(model.City,model.County, model.Tradingarea); } if (model.peitype == 0) { result = " 快递配送, "+provinceName + cityName + countyName + strIFFill + model.Address + ", 电话:" + model.Contacttel; } else { string remark = String.Empty; if (!string.IsNullOrEmpty(model.Guests)) { remark = "客户留言;" + model.Guests; } result = " 上门自取, 取货人:" + model.Contactname + ", 手机号:" + model.Contacttel + ", 取货地址:" + model.Address + remark; } } else { result = "

暂无

"; } return result; } public static string GetOrderAddress(int orderId,bool isShowHtml = true) { string result = String.Empty; Sql db = new Sql(); var model = db.FindFirst(u => u.Id == orderId); if (model != null) { string provinceName = new Mtxfw.DAL.province().GetProvince(model.Province); string cityName = new Mtxfw.DAL.city().GetCity(model.City); string countyName = new Mtxfw.DAL.county().GetCounty(model.County); string strIFFill = string.Empty; if (model.IFFill == 1) { strIFFill=model.Tradingarea; } else { strIFFill = new Mtxfw.DAL.tradingarea().Gettradingarea(model.City,model.County, model.Tradingarea); } if (model.peitype == 0) { result = " 快递配送,"+provinceName + cityName + countyName + strIFFill + model.Address + ",电话:" + model.Contacttel; } else { string remark = String.Empty; if (!string.IsNullOrEmpty(model.Guests)) { remark = "客户留言;" + model.Guests; } result = " 上门自取,取货人:" + model.Contactname + ",手机号:" + model.Contacttel + ",取货地址:" + model.Address + remark; } } else { if (isShowHtml) { result = "

暂无

"; } else { result = "暂无"; } } return result; } #endregion } }