Files
g.hnyhua.cn/Mtxfw.VipSite/API/CommonFunctions.cs

140 lines
5.0 KiB
C#
Raw Normal View History

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
/// <summary>
/// 只区分热卖推荐或兑换商城
/// </summary>
/// <param name="ds"></param>
/// <returns></returns>
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 = " 快递配送,&nbsp;"+provinceName + cityName + countyName + strIFFill + model.Address + "&nbsp;电话:" + model.Contacttel;
}
else
{
string remark = String.Empty;
if (!string.IsNullOrEmpty(model.Guests))
{
remark = "客户留言;" + model.Guests;
}
result = " 上门自取,&nbsp;取货人:" + model.Contactname + "&nbsp;手机号:" + model.Contacttel + "&nbsp;取货地址:" +
model.Address + remark;
}
}
else
{
result = "<p style='color:#8080809c;font-style: italic;'><b>暂无</b></p>";
}
return result;
}
public static string GetOrderAddress(int orderId,bool isShowHtml = true)
{
string result = String.Empty;
Sql db = new Sql();
var model = db.FindFirst<Model.order_info>(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 = "<p style='color:#8080809c;font-style: italic;'><b>暂无</b></p>";
}
else
{
result = "暂无";
}
}
return result;
}
#endregion
}
}