4232 lines
203 KiB
C#
4232 lines
203 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Net;
|
|||
|
|
using System.Web.SessionState;
|
|||
|
|
using System.Text.RegularExpressions;
|
|||
|
|
using System.Globalization;
|
|||
|
|
using Newtonsoft.Json;
|
|||
|
|
namespace Mtxfw.shop
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Ajax 处理页面
|
|||
|
|
/// </summary>
|
|||
|
|
public class ashxAjax : IHttpHandler, IRequiresSessionState
|
|||
|
|
{
|
|||
|
|
private Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
|||
|
|
public void ProcessRequest(HttpContext context)
|
|||
|
|
{
|
|||
|
|
context.Response.ContentType = "text/plain";
|
|||
|
|
|
|||
|
|
//方式
|
|||
|
|
switch (context.Request["action"])
|
|||
|
|
{
|
|||
|
|
case "IsExists": IsExists(context); break;
|
|||
|
|
case "GetCode": GetCode(context); break;
|
|||
|
|
case "GetCity": GetCity(context); break;
|
|||
|
|
case "GetCounty": GetCounty(context); break;
|
|||
|
|
case "GetCity2": GetCity2(context); break;
|
|||
|
|
case "GetCounty2": GetCounty2(context); break;
|
|||
|
|
case "GetProductLB": GetProductLB(context); break;
|
|||
|
|
case "GetProductLB2": GetProductLB2(context); break;
|
|||
|
|
case "AddGuest": AddGuest(context); break;
|
|||
|
|
case "Addpinglun": Addpinglun(context); break;
|
|||
|
|
case "Addwenda": Addwenda(context); break;
|
|||
|
|
case "zanpinglun": zanpinglun(context); break;
|
|||
|
|
case "savewenda": savewenda(context); break;
|
|||
|
|
case "GetPages": GetPages(context); break;
|
|||
|
|
case "GetCartNum": GetCartNum(context); break;
|
|||
|
|
case "addcart": addcart(context); break;
|
|||
|
|
case "addcart2": addcart2(context); break;
|
|||
|
|
case "addfavorite": addfavorite(context); break;
|
|||
|
|
case "addxihuan": addxihuan(context); break;
|
|||
|
|
case "GetUserName": GetUserName(context); break;
|
|||
|
|
case "GetUserName2": GetUserName2(context); break;
|
|||
|
|
case "Getcard": Getcard(context); break;
|
|||
|
|
case "GetLogin": GetLogin(context); break;
|
|||
|
|
case "Quit": Quit(context); break;
|
|||
|
|
case "IsLogin":IsLogin(context);break;
|
|||
|
|
case "ShowBank": ShowBank(context); break;
|
|||
|
|
case "updatecart": updatecart(context); break;
|
|||
|
|
case "qxorder": qxorder(context); break;
|
|||
|
|
case "sqtkorder": sqtkorder(context); break;
|
|||
|
|
case "sqthorder": sqthorder(context); break;
|
|||
|
|
case "qytytkorder": qytytkorder(context); break;
|
|||
|
|
case "qytythorder": qytythorder(context); break;
|
|||
|
|
case "qyfhorder": qyfhorder(context); break;
|
|||
|
|
case "qyshorder": qyshorder(context); break;
|
|||
|
|
case "deleteorder": deleteorder(context); break;
|
|||
|
|
case "setorder": setorder(context); break;
|
|||
|
|
case "GetProductTree": GetProductTree(context); break;
|
|||
|
|
case "UpdateTree": UpdateTree(context); break;
|
|||
|
|
case "GetbbsTree": GetbbsTree(context); break;
|
|||
|
|
case "ReBBS": ReBBS(context); break;
|
|||
|
|
case "SetBBS": SetBBS(context); break;
|
|||
|
|
case "SendYZM": SendYZM(context); break;
|
|||
|
|
case "SendYZM2": SendYZM2(context); break;
|
|||
|
|
case "SendYZM3": SendYZM3(context); break;
|
|||
|
|
case "DeletePic": DeletePic(context); break;
|
|||
|
|
case "SetPic": SetPic(context); break;
|
|||
|
|
case "SavePic": SavePic(context); break;
|
|||
|
|
case "saveaddress": saveaddress(context); break;
|
|||
|
|
case "deladdress": deladdress(context); break;
|
|||
|
|
case "setaddress": setaddress(context); break;
|
|||
|
|
case "UserQRGM": UserQRGM(context); break;
|
|||
|
|
case "addqjje": addqjje(context); break;
|
|||
|
|
case "savezjje": savezjje(context); break;
|
|||
|
|
case "savecj": savecj(context); break;
|
|||
|
|
case "qoujiang": qoujiang(context); break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region //判断验证码是否正确-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断验证码是否正确
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetCode(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Request.Form["Code"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Request.Cookies["code"] != null && context.Request.Form["Code"].ToString().ToLower() == context.Request.Cookies["code"].Value.ToLower())
|
|||
|
|
{
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("false");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("false");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //判断管理员用户名是否存在-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断管理员用户名是否存在
|
|||
|
|
/// </summary>
|
|||
|
|
protected void IsExists(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Request.Form["Keys"] != null)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.Admin Admin = new Mtxfw.DAL.Admin();
|
|||
|
|
context.Response.Write(Admin.IsExists(context.Request.Form["Keys"]).ToString().ToLower());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //获取城市-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取城市
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetCity(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
String PID = context.Request.Form["ProvinceID"];
|
|||
|
|
String CityID = context.Request.Form["cityIDs"];
|
|||
|
|
String Selected = string.Empty;
|
|||
|
|
Mtxfw.DAL.city daoCity = new Mtxfw.DAL.city();
|
|||
|
|
System.Data.DataSet Ds = daoCity.GetList("ProvinceID=" + PID + " Order by Id Asc");
|
|||
|
|
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
|||
|
|
sb.Append("<option value=''>--市--</option>");
|
|||
|
|
foreach (System.Data.DataRow Dr in Dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (Dr["CityID"].ToString() == CityID)
|
|||
|
|
Selected = "selected=selected";
|
|||
|
|
else
|
|||
|
|
Selected = String.Empty;
|
|||
|
|
sb.Append("<option " + Selected + " value='" + Dr["CityID"] + "'>" + Dr["CityName"] + "</option>\r\n");
|
|||
|
|
}
|
|||
|
|
context.Response.Write(sb.ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取城市
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetCity2(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
String PID = context.Request.Form["ProvinceID"];
|
|||
|
|
String CityID = context.Request.Form["cityIDs"];
|
|||
|
|
String Selected = string.Empty;
|
|||
|
|
Mtxfw.DAL.city daoCity = new Mtxfw.DAL.city();
|
|||
|
|
System.Data.DataSet Ds = daoCity.GetList("ProvinceID=" + PID + " Order by Id Asc");
|
|||
|
|
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
|||
|
|
foreach (System.Data.DataRow Dr in Dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (Dr["CityID"].ToString() == CityID)
|
|||
|
|
Selected = "class='selected'";
|
|||
|
|
else
|
|||
|
|
Selected = String.Empty;
|
|||
|
|
sb.Append("<li " + Selected + " id='C_" + Dr["CityID"] + "' onclick='oncity(\"" + Dr["CityID"] + "\",\"" + Dr["CityName"] + "\")'>" + Dr["CityName"] + "</li>\n");
|
|||
|
|
}
|
|||
|
|
context.Response.Write(sb.ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //获取区域-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取区域
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetCounty(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
String CID = context.Request.Form["CityID"];
|
|||
|
|
String CountyID = context.Request.Form["countyIDs"];
|
|||
|
|
String Selected = string.Empty;
|
|||
|
|
Mtxfw.DAL.county daoCounty = new Mtxfw.DAL.county();
|
|||
|
|
System.Data.DataSet Ds = daoCounty.GetList("CityID=" + CID + " Order by Id Asc");
|
|||
|
|
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
|||
|
|
sb.Append("<option value=''>--县区--</option>");
|
|||
|
|
foreach (System.Data.DataRow Dr in Dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (Dr["CountyID"].ToString() == CountyID)
|
|||
|
|
Selected = "selected=selected";
|
|||
|
|
else
|
|||
|
|
Selected = String.Empty;
|
|||
|
|
sb.Append("<option " + Selected + " value='" + Dr["CountyID"] + "'>" + Dr["CountyName"] + "</option>\r\n");
|
|||
|
|
}
|
|||
|
|
context.Response.Write(sb.ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取区域
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetCounty2(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
String CID = context.Request.Form["CityID"];
|
|||
|
|
String CountyID = context.Request.Form["countyIDs"];
|
|||
|
|
String Selected = string.Empty;
|
|||
|
|
Mtxfw.DAL.county daoCounty = new Mtxfw.DAL.county();
|
|||
|
|
System.Data.DataSet Ds = daoCounty.GetList("CityID=" + CID + " Order by Id Asc");
|
|||
|
|
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
|||
|
|
foreach (System.Data.DataRow Dr in Dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (Dr["CountyID"].ToString() == CountyID)
|
|||
|
|
Selected = "class='selected'";
|
|||
|
|
else
|
|||
|
|
Selected = String.Empty;
|
|||
|
|
sb.Append("<li " + Selected + " id='County_" + Dr["CountyID"] + "' onclick='oncounty(\"" + Dr["CountyID"] + "\",\"" + Dr["CountyName"] + "\")'>" + Dr["CountyName"] + "</li>\n");
|
|||
|
|
}
|
|||
|
|
context.Response.Write(sb.ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //获取商品分类-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取商品分类
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetProductLB(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
String ProductLB1 = context.Request.Form["ProductLB1"];
|
|||
|
|
String ProductLB2 = context.Request.Form["ProductLB2"];
|
|||
|
|
if (!String.IsNullOrEmpty(ProductLB1))
|
|||
|
|
{
|
|||
|
|
String Selected = string.Empty;
|
|||
|
|
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
|
|||
|
|
System.Data.DataSet Ds = daoCategory.GetCacheList("","ttype=0 And C_PARENTID=" + ProductLB1 + " Order By C_Layer asc,C_LinkID asc", "ProductLB2_" + ProductLB1 + "");
|
|||
|
|
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
|||
|
|
sb.Append("<option value=''>请选择分类二</option>");
|
|||
|
|
foreach (System.Data.DataRow Dr in Dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (Dr["C_ID"].ToString() == ProductLB2)
|
|||
|
|
Selected = "selected=selected";
|
|||
|
|
else
|
|||
|
|
Selected = String.Empty;
|
|||
|
|
sb.Append("<option " + Selected + " value='" + Dr["C_ID"] + "'>" + Dr["C_NAME"] + "</option>\r\n");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write(sb.ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取商品分类
|
|||
|
|
/// </summary>
|
|||
|
|
protected void GetProductLB2(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
String ProductLB2 = context.Request.Form["ProductLB2"];
|
|||
|
|
String ProductLB3 = context.Request.Form["ProductLB3"];
|
|||
|
|
if (!String.IsNullOrEmpty(ProductLB2))
|
|||
|
|
{
|
|||
|
|
String Selected = string.Empty;
|
|||
|
|
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
|
|||
|
|
System.Data.DataSet Ds = daoCategory.GetCacheList("", "ttype=0 And C_PARENTID=" + ProductLB2 + " Order By C_Layer asc,C_LinkID asc", "ProductLB3_" + ProductLB2 + "");
|
|||
|
|
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
|||
|
|
sb.Append("<option value=''>请选择分类三</option>");
|
|||
|
|
foreach (System.Data.DataRow Dr in Dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (Dr["C_ID"].ToString() == ProductLB3)
|
|||
|
|
Selected = "selected=selected";
|
|||
|
|
else
|
|||
|
|
Selected = String.Empty;
|
|||
|
|
sb.Append("<option " + Selected + " value='" + Dr["C_ID"] + "'>" + Dr["C_NAME"] + "</option>\r\n");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write(sb.ToString());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //添加留言-----------------------------------------------------------------------------------------
|
|||
|
|
//添加留言
|
|||
|
|
protected void AddGuest(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["GuestContact"]))
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
|
|||
|
|
Mtxfw.Model.Guest model = new Model.Guest();
|
|||
|
|
model.GuestName = HttpUtility.UrlDecode(context.Request.Form["GuestName"]);
|
|||
|
|
model.Message = HttpUtility.UrlDecode(context.Request.Form["Message"]);
|
|||
|
|
model.BusinessID = 0;
|
|||
|
|
model.GuestContact = HttpUtility.UrlDecode(context.Request.Form["GuestContact"]);
|
|||
|
|
model.starlevel = 0;
|
|||
|
|
model.IsShow = 0;
|
|||
|
|
model.CreateTime = DateTime.Now;
|
|||
|
|
model.ttype = 2;
|
|||
|
|
daoGuest.Add(model);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("false");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //添加评论-----------------------------------------------------------------------------------------
|
|||
|
|
//添加评论
|
|||
|
|
protected void Addpinglun(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["BusinessID"]) && !String.IsNullOrEmpty(context.Request.Form["star"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
|
|||
|
|
Mtxfw.Model.Guest model = new Model.Guest();
|
|||
|
|
Mtxfw.DAL.order_info daoorder = new DAL.order_info();
|
|||
|
|
model.GuestName = HttpUtility.UrlDecode(context.Request.Form["GuestName"]);
|
|||
|
|
model.Message = HttpUtility.UrlDecode(context.Request.Form["Message"]);
|
|||
|
|
model.BusinessID = int.Parse(context.Request.Form["BusinessID"]);
|
|||
|
|
model.userid = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
model.GuestContact = "";
|
|||
|
|
model.starlevel = int.Parse(context.Request.Form["star"]);
|
|||
|
|
model.IsShow = 0;
|
|||
|
|
model.CreateTime = DateTime.Now;
|
|||
|
|
model.ttype = 0;
|
|||
|
|
if (daoorder.GetCount("UserID=" + model.userid + " And pid=" + model.BusinessID + " And O_received='1'") > 0)
|
|||
|
|
{
|
|||
|
|
if (daoGuest.GetCount("userid=" + model.userid + " And businessid=" + model.BusinessID + "") == 0)
|
|||
|
|
{
|
|||
|
|
daoGuest.Add(model);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您已经评论过此商品,不能再评论");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您还没有购买过此商品,不能评论");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能评论");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //添加问答-----------------------------------------------------------------------------------------
|
|||
|
|
//添加问答
|
|||
|
|
protected void Addwenda(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["BusinessID"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
|
|||
|
|
Mtxfw.Model.Guest model = new Model.Guest();
|
|||
|
|
model.GuestName = HttpUtility.UrlDecode(context.Request.Form["GuestName"]);
|
|||
|
|
model.Message = HttpUtility.UrlDecode(context.Request.Form["Message"]);
|
|||
|
|
model.BusinessID = int.Parse(context.Request.Form["BusinessID"]);
|
|||
|
|
model.userid = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
model.GuestContact = "";
|
|||
|
|
model.starlevel = 0;
|
|||
|
|
model.IsShow = 0;
|
|||
|
|
model.CreateTime = DateTime.Now;
|
|||
|
|
model.ttype = 1;
|
|||
|
|
daoGuest.Add(model);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能问答");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //回答问题-----------------------------------------------------------------------------------------
|
|||
|
|
//回答问题
|
|||
|
|
protected void savewenda(HttpContext context)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["wdid"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
|
|||
|
|
Mtxfw.Model.Guest model = daoGuest.GetModel(int.Parse(context.Request.Form["wdid"].ToString()));
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
if (model.Message2 == "")
|
|||
|
|
{
|
|||
|
|
model.Message2 = HttpUtility.UrlDecode(context.Request.Form["Message"]);
|
|||
|
|
model.userid2 = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
model.ID = int.Parse(context.Request.Form["wdid"].ToString());
|
|||
|
|
daoGuest.Update(model);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("已有回答,不能再回答");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能问答");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write("操作错误" + ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //点赞评论-----------------------------------------------------------------------------------------
|
|||
|
|
//点赞评论
|
|||
|
|
protected void zanpinglun(HttpContext context)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string strID = "";
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
|
|||
|
|
{
|
|||
|
|
strID = HttpUtility.UrlDecode(context.Request.Form["id"]).ToString();
|
|||
|
|
|
|||
|
|
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
|
|||
|
|
if (daoGuest.Updatazannum(int.Parse(strID)))
|
|||
|
|
{
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("操作失败2");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write("操作错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //获取评论分页内容-----------------------------------------------------------------------------------------
|
|||
|
|
//获取评论分页内容
|
|||
|
|
protected void GetPages(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string data = "{\"success\":false}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
int ttype = 0;
|
|||
|
|
int intPage = 1;
|
|||
|
|
int ID = 0;
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["ttype"]) && !String.IsNullOrEmpty(context.Request["intPage"]) && !String.IsNullOrEmpty(context.Request["ID"]))
|
|||
|
|
{
|
|||
|
|
ttype = Convert.ToInt32(context.Request["ttype"].ToString());
|
|||
|
|
intPage = Convert.ToInt32(context.Request["intPage"].ToString());
|
|||
|
|
ID = Convert.ToInt32(context.Request["ID"].ToString());
|
|||
|
|
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
|
|||
|
|
int Recount = 0;
|
|||
|
|
int Start = 0;
|
|||
|
|
int Limit = 10;
|
|||
|
|
Start = Limit * (intPage - 1);
|
|||
|
|
string pinglun_content = "", pinglun_pages="";
|
|||
|
|
DataSet pds = daoGuest.GetDataSet("createtime Desc", "ID,GuestName,GuestContact,Message,Message2,CreateTime,BusinessID,IsShow2,starlevel,zannum", "ttype=" + ttype + " And IsShow=1 And businessid=" + ID, Start, Limit, out Recount);
|
|||
|
|
if (pds.Tables[1].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow pdrv in pds.Tables[1].Rows)
|
|||
|
|
{
|
|||
|
|
pinglun_content += "<ul class='detail_pinglun_listbox'>";
|
|||
|
|
pinglun_content += " <li class='pinglun_listbox_top'><span class='name'><img src='/images/peopleicon_05.gif' width='20'/> " + pdrv["GuestName"].ToString() + "</span><span class='time'>" + pdrv["createtime"].ToString() + "</span></li>";
|
|||
|
|
pinglun_content += "<li class='pinglun_listbox_content'>";
|
|||
|
|
if (ttype == 0)
|
|||
|
|
{
|
|||
|
|
pinglun_content += "<span class='pingfen'><label>评分:</label>" + Mtxfw.Utility.Common.cstarlevel(pdrv["starlevel"].ToString()) + "</span>";
|
|||
|
|
}
|
|||
|
|
pinglun_content += "<span class='content'>" + (ttype == 0 ? "内容" : "问题") + ":<font color='#333'>" + pdrv["message"].ToString() + "</font></span>";
|
|||
|
|
if (ttype == 1)
|
|||
|
|
{
|
|||
|
|
pinglun_content += "<span class='content'>回答:<font color='#333'>" + (pdrv["message2"].ToString() == "" ? "<span id=\"wyhd" + pdrv["id"].ToString() + "\" class=\"wyhd\" onclick=\"wyhd(" + pdrv["id"].ToString() + ",'@" + pdrv["GuestName"].ToString() + ":')\">我要回答</span>" : (pdrv["IsShow2"].ToString() == "0" ? "等待审核中..." : pdrv["message2"].ToString())) + "</font></span>";
|
|||
|
|
}
|
|||
|
|
pinglun_content += "<span class='zan' id='zan" + pdrv["id"].ToString() + "' onclick='zanpinglun(" + pdrv["id"].ToString() + ")'>赞(<label>" + pdrv["zannum"].ToString() + "</label>)</span>";
|
|||
|
|
|
|||
|
|
pinglun_content += "</li>";
|
|||
|
|
pinglun_content += "</ul><div class='clear'></div>";
|
|||
|
|
}
|
|||
|
|
pinglun_pages = Mtxfw.Utility.PageStatic.GetPages2(Recount, Limit, intPage, ttype, ID);
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
StringWriter sw = new StringWriter(sb);
|
|||
|
|
|
|||
|
|
using (JsonWriter jw = new JsonTextWriter(sw))
|
|||
|
|
{
|
|||
|
|
jw.WriteStartObject();
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("success");
|
|||
|
|
jw.WriteValue(true);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("content");//所有记录总数
|
|||
|
|
jw.WriteValue(pinglun_content);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("pages");
|
|||
|
|
jw.WriteValue(pinglun_pages);
|
|||
|
|
jw.WriteEndObject();
|
|||
|
|
}
|
|||
|
|
data = sw.ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":'找不到数据'}";
|
|||
|
|
}
|
|||
|
|
pds.Tables.Clear();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region //获取购物车总数和总金额-----------------------------------------------------------------------------------------
|
|||
|
|
//获取购物车总数和总金额
|
|||
|
|
protected void GetCartNum(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string data = "{\"success\":false}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
StringWriter sw = new StringWriter(sb);
|
|||
|
|
|
|||
|
|
using (JsonWriter jw = new JsonTextWriter(sw))
|
|||
|
|
{
|
|||
|
|
jw.WriteStartObject();
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("success");
|
|||
|
|
jw.WriteValue(true);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("TotalNum");
|
|||
|
|
jw.WriteValue(Mtxfw.DAL.ShoppingCart.TotalNum());
|
|||
|
|
jw.WritePropertyName("TotalMoney");
|
|||
|
|
jw.WriteValue(Mtxfw.DAL.ShoppingCart.TotalMoney().ToString("f2"));
|
|||
|
|
jw.WriteEndObject();
|
|||
|
|
}
|
|||
|
|
data = sw.ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //添加商品到购物车-----------------------------------------------------------------------------------------
|
|||
|
|
//添加商品到购物车
|
|||
|
|
protected void addcart(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string data = "{\"success\":false}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["id"]))
|
|||
|
|
{
|
|||
|
|
string selcolor = "";
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["selcolor"]))
|
|||
|
|
{
|
|||
|
|
selcolor = context.Request["selcolor"].ToString().Trim();
|
|||
|
|
}
|
|||
|
|
string id = HttpUtility.UrlDecode(context.Request["id"].ToString());
|
|||
|
|
DataSet ds = new Mtxfw.DAL.P_Product().GetList1("utype,P_Inventory,P_yanse", "(utype='0' or utype='3') and P_State='已处理' And P_ID=" + id);
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string utype = ds.Tables[0].Rows[0]["utype"].ToString();
|
|||
|
|
string P_Inventory = ds.Tables[0].Rows[0]["P_Inventory"].ToString();
|
|||
|
|
string P_yanse = ds.Tables[0].Rows[0]["P_yanse"].ToString();
|
|||
|
|
int kcun = 0, color = 0;
|
|||
|
|
if (selcolor.Trim() != "")
|
|||
|
|
{
|
|||
|
|
string strcolor = P_yanse;
|
|||
|
|
if (strcolor.Trim() != "")
|
|||
|
|
{
|
|||
|
|
if (strcolor.IndexOf(HttpUtility.UrlDecode(selcolor))==-1)
|
|||
|
|
{
|
|||
|
|
color = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (P_Inventory != "")
|
|||
|
|
{
|
|||
|
|
kcun = Convert.ToInt32(P_Inventory);
|
|||
|
|
}
|
|||
|
|
if (color == 0)
|
|||
|
|
{
|
|||
|
|
if (kcun > 0)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.ShoppingCart.Addprod(id, 1, selcolor);
|
|||
|
|
data = "{\"success\":true,\"msg\":\"添加成功\"}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"库存不足,无法添加\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误3\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误2\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"" + ex.Message + "\"}";
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //兑换商品-----------------------------------------------------------------------------------------
|
|||
|
|
//兑换商品
|
|||
|
|
protected void addcart2(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string data = "{\"success\":false}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["id"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
|
|||
|
|
int MemberIFStores = Convert.ToInt32(context.Session["MemberIFStores"].ToString());
|
|||
|
|
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
MemberIFStores = model.IFStores;
|
|||
|
|
string selcolor = "";
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["selcolor"]))
|
|||
|
|
{
|
|||
|
|
selcolor = context.Request["selcolor"].ToString().Trim();
|
|||
|
|
}
|
|||
|
|
int id = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["id"].ToString()));
|
|||
|
|
DataSet ds = new Mtxfw.DAL.P_Product().GetList1("utype,P_Inventory,P_yanse,P_VIP_P,P_VIP_P1,P_VIP_P2", "utype='1' and P_State='已处理' And P_ID=" + id);
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
string utype = ds.Tables[0].Rows[0]["utype"].ToString();
|
|||
|
|
string P_Inventory = ds.Tables[0].Rows[0]["P_Inventory"].ToString();
|
|||
|
|
string P_yanse = ds.Tables[0].Rows[0]["P_yanse"].ToString();
|
|||
|
|
Double P_VIP_P = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P"].ToString());
|
|||
|
|
/*Double P_VIP_P1 = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P1"].ToString());
|
|||
|
|
Double P_VIP_P2 = Convert.ToDouble(ds.Tables[0].Rows[0]["P_VIP_P2"].ToString());
|
|||
|
|
if (MemberIFStores == 1)
|
|||
|
|
{
|
|||
|
|
P_VIP_P = P_VIP_P1;
|
|||
|
|
}
|
|||
|
|
if (MemberIFStores == 1)
|
|||
|
|
{
|
|||
|
|
P_VIP_P = P_VIP_P2;
|
|||
|
|
}*/
|
|||
|
|
string Contactname = "", Contacttel = "", Address = "", Zipcode = "", strProvince = "", strCity = "", strCounty = "", OrdersID = "";
|
|||
|
|
DataSet dss = new DAL.user_address().GetList("top 1 ", "UserID=" + model.Id + " Order By IFIndex Desc");
|
|||
|
|
if (dss.Tables[0].Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"您还没有配送地址,请先添加您的配送地址!\"}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Contactname = dss.Tables[0].Rows[0]["Contactname"].ToString();
|
|||
|
|
Contacttel = dss.Tables[0].Rows[0]["Contacttel"].ToString();
|
|||
|
|
Address = dss.Tables[0].Rows[0]["Address"].ToString();
|
|||
|
|
Zipcode = dss.Tables[0].Rows[0]["Zipcode"].ToString();
|
|||
|
|
strProvince = dss.Tables[0].Rows[0]["Province"].ToString();
|
|||
|
|
strCity = dss.Tables[0].Rows[0]["City"].ToString();
|
|||
|
|
strCounty = dss.Tables[0].Rows[0]["County"].ToString();
|
|||
|
|
int kcun = 0, color = 0;
|
|||
|
|
if (selcolor.Trim() != "")
|
|||
|
|
{
|
|||
|
|
string strcolor = P_yanse;
|
|||
|
|
if (strcolor.Trim() != "")
|
|||
|
|
{
|
|||
|
|
if (strcolor.IndexOf(HttpUtility.UrlDecode(selcolor)) == -1)
|
|||
|
|
{
|
|||
|
|
color = 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (P_Inventory != "")
|
|||
|
|
{
|
|||
|
|
kcun = Convert.ToInt32(P_Inventory);
|
|||
|
|
}
|
|||
|
|
if (color == 0)
|
|||
|
|
{
|
|||
|
|
if (kcun > 0)
|
|||
|
|
{
|
|||
|
|
string prodNum = "1";
|
|||
|
|
Double SubTotal = P_VIP_P;
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
string OID = dt.ToString("yyyMMddhhmmssffff", DateTimeFormatInfo.InvariantInfo);
|
|||
|
|
if (Convert.ToDouble(SubTotal.ToString("f2")) <= Convert.ToDouble((model.umoney30 - model.umoney31).ToString("f2")))
|
|||
|
|
{
|
|||
|
|
Mtxfw.Model.order_info Modelorder = new Mtxfw.Model.order_info();
|
|||
|
|
Modelorder.pid = id;
|
|||
|
|
Modelorder.orderid = OID;
|
|||
|
|
Modelorder.Contactname = Contactname;
|
|||
|
|
Modelorder.Contacttel = Contacttel;
|
|||
|
|
Modelorder.Province = strProvince;
|
|||
|
|
Modelorder.City = strCity;
|
|||
|
|
Modelorder.County = strCounty;
|
|||
|
|
Modelorder.Address = Address;
|
|||
|
|
Modelorder.Zipcode = Zipcode;
|
|||
|
|
Modelorder.Guests = "";
|
|||
|
|
Modelorder.Totalprice = SubTotal;
|
|||
|
|
Modelorder.Totalnum = int.Parse(prodNum);
|
|||
|
|
Modelorder.O_Submit = "1";
|
|||
|
|
Modelorder.O_yhj = "";
|
|||
|
|
Modelorder.UserID = MemberId;
|
|||
|
|
Modelorder.selcolor = selcolor;
|
|||
|
|
Modelorder.utype = "2";
|
|||
|
|
int OrderID = new Mtxfw.DAL.order_info().Add(Modelorder);
|
|||
|
|
Mtxfw.Model.P_Product ModelProduct = new Mtxfw.DAL.P_Product().GetModel(id);
|
|||
|
|
if (ModelProduct != null)
|
|||
|
|
{
|
|||
|
|
Model.order_product_info opmodel = new Model.order_product_info();
|
|||
|
|
opmodel.pid = id;
|
|||
|
|
opmodel.orderid = OrderID;
|
|||
|
|
opmodel.selcolor = HttpUtility.UrlDecode(selcolor);
|
|||
|
|
opmodel.DJprice = ModelProduct.P_VIP_P;
|
|||
|
|
opmodel.Totalnum = int.Parse(prodNum);
|
|||
|
|
opmodel.UserID = MemberId;
|
|||
|
|
opmodel.SubmitTime = DateTime.Now;
|
|||
|
|
opmodel.Totalprice = SubTotal;
|
|||
|
|
opmodel.utype = "2";
|
|||
|
|
new DAL.order_product_info().Add(opmodel);
|
|||
|
|
}
|
|||
|
|
new Mtxfw.DAL.P_Product().UpdateInventory(id, -1);
|
|||
|
|
//更新订单为已付款状态
|
|||
|
|
new Mtxfw.DAL.order_info().UpdateqyState(0, "1", DateTime.Now, OrderID);
|
|||
|
|
//减少买家余额
|
|||
|
|
new Mtxfw.DAL.user_info().UpdateMoney("umoney31", SubTotal, MemberId);
|
|||
|
|
data = "{\"success\":true,\"msg\":\"兑换成功\"}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"余额不足,无法兑换\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"库存不足,无法添加\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误3\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
dss.Clear();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误4\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误3\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"您未登录\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"" + ex.Message + "\"}";
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //添加商品到收藏-----------------------------------------------------------------------------------------
|
|||
|
|
//添加商品到收藏
|
|||
|
|
protected void addfavorite(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["id"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
|
|||
|
|
int ProductID = Convert.ToInt32(context.Request["id"].ToString());
|
|||
|
|
if (new Mtxfw.DAL.P_Product().GetCount("P_State='已处理' And P_ID=" + ProductID) > 0)
|
|||
|
|
{
|
|||
|
|
if (new Mtxfw.DAL.user_favorite().GetCount("ttype=0 and ProductID=" + ProductID + " And MemberId=" + MemberId) == 0)
|
|||
|
|
{
|
|||
|
|
Mtxfw.Model.user_favorite model = new Model.user_favorite();
|
|||
|
|
model.ProductID = ProductID;
|
|||
|
|
model.MemberId = MemberId;
|
|||
|
|
model.ttype = 0;
|
|||
|
|
new Mtxfw.DAL.user_favorite().Add(model);
|
|||
|
|
new Mtxfw.DAL.P_Product().Update(ProductID, "P_SCOrders", "1");
|
|||
|
|
data = "{\"success\":true,\"msg\":\"添加成功\"}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"已经添加过,不用再添加\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误2\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"您未登录\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //添加商品到喜欢-----------------------------------------------------------------------------------------
|
|||
|
|
//添加商品到喜欢
|
|||
|
|
protected void addxihuan(HttpContext context)
|
|||
|
|
{
|
|||
|
|
string data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request["id"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
|
|||
|
|
int ProductID = Convert.ToInt32(context.Request["id"].ToString());
|
|||
|
|
if (context.Session["addxihuan" + ProductID] == null)
|
|||
|
|
{
|
|||
|
|
if (new Mtxfw.DAL.P_Product().GetCount("P_State='已处理' And P_ID=" + ProductID) > 0)
|
|||
|
|
{
|
|||
|
|
new Mtxfw.DAL.P_Product().Update(ProductID, "P_Orders1", "1");
|
|||
|
|
context.Session["addxihuan" + ProductID] = "0";
|
|||
|
|
data = "{\"success\":true,\"msg\":\"添加成功\"}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误2\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"已经添加过,不用再添加\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"您未登录\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"参数错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //判断用户名是否存在(前台注册)-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断用户名是否存在(前台注册)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="context"></param>
|
|||
|
|
protected void GetUserName(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
String UserName = HttpUtility.UrlDecode(context.Request.Form["name"]);
|
|||
|
|
UserName = UserName.Trim();
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
context.Response.Write(daoUser.IsExists(UserName).ToString().ToLower());
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断邀请人用户名是否存在(前台注册)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="context"></param>
|
|||
|
|
protected void GetUserName2(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
String UserName = HttpUtility.UrlDecode(context.Request.Form["name"]);
|
|||
|
|
int t=0;
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["name"]))
|
|||
|
|
{
|
|||
|
|
t =Convert.ToInt32(context.Request.Form["t"]);
|
|||
|
|
}
|
|||
|
|
UserName = UserName.Trim();
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
if (t == 2)
|
|||
|
|
{
|
|||
|
|
if (daoUser.IsExists2(UserName, 0))
|
|||
|
|
{
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write(daoUser.IsExists2(UserName, t).ToString().ToLower());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //判断卡号是否存在-----------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断卡号是否存在
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="context"></param>
|
|||
|
|
protected void Getcard(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
String card = HttpUtility.UrlDecode(context.Request.Form["card"]);
|
|||
|
|
card = card.Trim();
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
|
|||
|
|
if (daoUser.IsExistsCar(card))
|
|||
|
|
{
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //前台登陆-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 前台登陆
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="context"></param>
|
|||
|
|
protected void GetLogin(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["name"]) && !String.IsNullOrEmpty(context.Request.Form["pwd"]))
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["code"]))
|
|||
|
|
{
|
|||
|
|
String name = HttpUtility.UrlDecode(context.Request.Form["name"]);
|
|||
|
|
String pwd = HttpUtility.UrlDecode(context.Request.Form["pwd"]);
|
|||
|
|
String code = HttpUtility.UrlDecode(context.Request.Form["code"]);
|
|||
|
|
name = name.Trim();
|
|||
|
|
pwd = pwd.Trim();
|
|||
|
|
code = code.Trim();
|
|||
|
|
if (context.Request.Cookies["code"] != null && code.ToLower() == context.Request.Cookies["code"].Value.ToLower())
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
int MemberId = 0;
|
|||
|
|
int IFStores = 0;
|
|||
|
|
int IFUpUserName = 0;
|
|||
|
|
int uutype = 0;
|
|||
|
|
string MemberJS = "";
|
|||
|
|
string NCName = "";
|
|||
|
|
string avatar = "";
|
|||
|
|
string gender = "";
|
|||
|
|
string birthday = "";
|
|||
|
|
int ContactID = 0;
|
|||
|
|
int IFBecomeBusiness = 0;
|
|||
|
|
int MemberuLevel = 0;
|
|||
|
|
int MemberuLevel2 = 0;
|
|||
|
|
if (daoUser.IsLoginWeb(name, Mtxfw.Utility.Security.EncryptString(pwd), ref MemberId, ref ContactID, ref IFStores, ref NCName, ref avatar, ref gender, ref birthday, ref IFUpUserName, ref IFBecomeBusiness, ref uutype, ref MemberJS, ref MemberuLevel, ref MemberuLevel2))
|
|||
|
|
{
|
|||
|
|
if (IFBecomeBusiness == 0)
|
|||
|
|
{
|
|||
|
|
if (MemberuLevel2 == 2)
|
|||
|
|
{
|
|||
|
|
if (uutype == 0)
|
|||
|
|
{
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
Model.User_OnLine model = new Model.User_OnLine();
|
|||
|
|
model.SessionId = context.Session.SessionID;
|
|||
|
|
model.MemberId = MemberId;
|
|||
|
|
model.DLID = 1;
|
|||
|
|
model.ZDLID = 0;
|
|||
|
|
model.GDID = 0;
|
|||
|
|
model.FGSID = 0;
|
|||
|
|
model.InTime = dt;
|
|||
|
|
model.IsOnline = 1;
|
|||
|
|
model.IP = Mtxfw.Utility.Common.GetIP;
|
|||
|
|
model.MAC = "";
|
|||
|
|
model.UserType = 0;
|
|||
|
|
new DAL.User_OnLine().Add(model);
|
|||
|
|
daoUser.UpdateuLevel("opentype2", 0, MemberId);
|
|||
|
|
string LoginId = new Guid().ToString();
|
|||
|
|
daoUser.UpdateLogins(model.IP, LoginId, MemberId);
|
|||
|
|
context.Session["MemberId"] = MemberId;
|
|||
|
|
context.Session["MemberName"] = name;
|
|||
|
|
context.Session["MemberNCName"] = NCName;
|
|||
|
|
context.Session["MemberIFStores"] = IFStores;
|
|||
|
|
|
|||
|
|
if (context.Session["returnurl"] != null)
|
|||
|
|
{
|
|||
|
|
string strurl = context.Session["returnurl"].ToString();
|
|||
|
|
context.Session.Remove("returnurl");
|
|||
|
|
context.Response.Write("returnurl=" + strurl);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("7");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("已锁定");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("4");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //退出登录-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 退出登录
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="context"></param>
|
|||
|
|
protected void Quit(HttpContext context)
|
|||
|
|
{
|
|||
|
|
context.Session.Remove("MemberId");
|
|||
|
|
context.Session.Remove("MemberName");
|
|||
|
|
context.Session.Remove("IFPassword");
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //判断是否登陆-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断是否登陆
|
|||
|
|
/// </summary>
|
|||
|
|
protected void IsLogin(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
string MemberName = context.Session["MemberName"].ToString();
|
|||
|
|
context.Response.Write(MemberName);
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("false");
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //显示银行信息-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 显示银行信息
|
|||
|
|
/// </summary>
|
|||
|
|
protected void ShowBank(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
int Id = int.Parse(context.Request.Form["Id"].ToString());
|
|||
|
|
Mtxfw.DAL.user_bank daoBank = new DAL.user_bank();
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new DAL.user_info();
|
|||
|
|
Mtxfw.Model.user_bank model = daoBank.GetModel(Id);
|
|||
|
|
Mtxfw.Model.user_info modelInfo = daoUser.GetModel(Id);
|
|||
|
|
Mtxfw.DAL.province daoPro = new DAL.province();
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
String result = "{Name:'"
|
|||
|
|
+ model.PayeeName + "',BankCard:'"
|
|||
|
|
+ model.BankCard + "',Bank:'"
|
|||
|
|
+ model.BankName + "',Province:'"
|
|||
|
|
+ daoPro.GetProvince(model.Province) + "',Mobole:'"
|
|||
|
|
+ modelInfo.Mobile + "',Phone:'"
|
|||
|
|
+ modelInfo.Phone + "'}";
|
|||
|
|
context.Response.Write(result);
|
|||
|
|
}
|
|||
|
|
else { context.Response.Write("{Name:'',BankCard:'',Bank:'',Province:'',Mobole:'',Phone:''}"); }
|
|||
|
|
}
|
|||
|
|
catch { context.Response.Write("{Name:'',BankCard:'',Bank:'',Province:'',Mobole:'',Phone:''}"); }
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //更新购物车-----------------------------------------------------------------------------------------
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新购物车
|
|||
|
|
/// </summary>
|
|||
|
|
protected void updatecart(HttpContext context)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string ProductID = "";
|
|||
|
|
string Num = "";
|
|||
|
|
string selcolor = "";
|
|||
|
|
if (context.Request.Form["ProductID"] != null)
|
|||
|
|
{
|
|||
|
|
ProductID = context.Request.Form["ProductID"].ToString();
|
|||
|
|
}
|
|||
|
|
if (context.Request.Form["Num"] != null)
|
|||
|
|
{
|
|||
|
|
Num = context.Request.Form["Num"].ToString();
|
|||
|
|
}
|
|||
|
|
if (context.Request.Form["selcolor"] != null)
|
|||
|
|
{
|
|||
|
|
selcolor = context.Request.Form["selcolor"].ToString();
|
|||
|
|
}
|
|||
|
|
if (ProductID == "" || Num == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
if (Num == "0")
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.ShoppingCart.RemoveProd(ProductID, selcolor);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.ShoppingCart.UpdateProd(ProductID, Num, selcolor);
|
|||
|
|
}
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //确认购买-----------------------------------------------------------------------------------------
|
|||
|
|
//确认购买
|
|||
|
|
protected void UserQRGM(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_address daoaddress = new Mtxfw.DAL.user_address();
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
if (MemberId > 0)
|
|||
|
|
{
|
|||
|
|
string OrdersIDs = "";
|
|||
|
|
int addressid = 0, IFUseJF = 0;
|
|||
|
|
Double UseJF = 0.00;
|
|||
|
|
bool b = true;
|
|||
|
|
if (context.Request.Form["addressid"] != null && context.Request.Form["IFUseJF"] != null && context.Request.Form["UseJF"] != null && context.Request.Form["OrdersIDs"] != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
OrdersIDs = HttpUtility.UrlDecode(context.Request.Form["OrdersIDs"].ToString());
|
|||
|
|
addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()));
|
|||
|
|
|
|||
|
|
IFUseJF = int.Parse(HttpUtility.UrlDecode(context.Request.Form["IFUseJF"].ToString()));
|
|||
|
|
if (IFUseJF > 0)
|
|||
|
|
{
|
|||
|
|
if (context.Request.Form["UseJF"].ToString().Trim() != "")
|
|||
|
|
{
|
|||
|
|
UseJF = Convert.ToDouble(Convert.ToDouble(HttpUtility.UrlDecode(context.Request.Form["UseJF"].ToString())).ToString("f2"));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string Contactname = "", Contacttel = "", Address = "", Zipcode = "";
|
|||
|
|
string strProvince = "", strCity = "", strCounty = "";
|
|||
|
|
string stryhj = "";
|
|||
|
|
Model.user_address amodel = new DAL.user_address().GetModel(addressid);
|
|||
|
|
if (amodel != null)
|
|||
|
|
{
|
|||
|
|
if (amodel.UserID != MemberId)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("地址错误2!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (!System.Text.RegularExpressions.Regex.IsMatch(amodel.Contactname, @"[\u4e00-\u9fa5]"))
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("配送地址错误:联系人姓名填写不正确,只能输入中文!");
|
|||
|
|
}
|
|||
|
|
Contactname = amodel.Contactname;
|
|||
|
|
Contacttel = amodel.Contacttel;
|
|||
|
|
Address = amodel.Address;
|
|||
|
|
Zipcode = amodel.Contacttel;
|
|||
|
|
strProvince = amodel.Province;
|
|||
|
|
strCity = amodel.City;
|
|||
|
|
strCounty = amodel.County;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("地址错误!");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
if (OrdersIDs == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("ID不能为空!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int ZprodNum = 0;
|
|||
|
|
int IFStores = 0;
|
|||
|
|
Double ZSubTotal = 0.00, ZZSubTotal = 0.00, ZSubTotal1 = 0.00;
|
|||
|
|
int ZprodPrice0 = 0;
|
|||
|
|
Double UserMoney = 0.00, UserMoney2 = 0.00;
|
|||
|
|
string CFOIDs = "";
|
|||
|
|
string[] ACFOIDs = new string[5];
|
|||
|
|
DataView dv = new DataView();
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
bool IFTotalNum = true;
|
|||
|
|
Mtxfw.Model.user_info ModelUser = daoUser.GetModel(MemberId);
|
|||
|
|
if (ModelUser != null)
|
|||
|
|
{
|
|||
|
|
IFStores = ModelUser.IFStores;
|
|||
|
|
UserMoney = Convert.ToDouble((ModelUser.umoney15 - ModelUser.umoney16).ToString("f2"));
|
|||
|
|
UserMoney2 = Convert.ToDouble((ModelUser.umoney30 - ModelUser.umoney31).ToString("f2"));
|
|||
|
|
}
|
|||
|
|
dv = Mtxfw.DAL.ShoppingCart.Getprod(IFStores);
|
|||
|
|
if (dv.Count > 0)
|
|||
|
|
{
|
|||
|
|
int i = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (int j = 0; j <= dv.Count - 1; j++)
|
|||
|
|
{
|
|||
|
|
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
|||
|
|
if (OrdersIDs.IndexOf("," + prodid + ",") != -1)
|
|||
|
|
{
|
|||
|
|
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
|
|||
|
|
if (CFOIDs == "")
|
|||
|
|
{
|
|||
|
|
CFOIDs = "," + SUserID + ",";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (CFOIDs.IndexOf("," + SUserID + ",") == -1)
|
|||
|
|
{
|
|||
|
|
CFOIDs += SUserID + ",";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
ACFOIDs = CFOIDs.Split(',');
|
|||
|
|
|
|||
|
|
int iusrcount = 0;
|
|||
|
|
foreach (string stra in ACFOIDs)
|
|||
|
|
{
|
|||
|
|
if (stra != "")
|
|||
|
|
{
|
|||
|
|
iusrcount += 1;
|
|||
|
|
Double YFmoney = 0.00;
|
|||
|
|
for (int j = 0; j <= dv.Count - 1; j++)
|
|||
|
|
{
|
|||
|
|
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
|||
|
|
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
|
|||
|
|
if (OrdersIDs.IndexOf("," + prodid + ",") != -1 && stra == SUserID)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
int prodNum = int.Parse(dv.Table.Rows[j]["prodNum"].ToString());
|
|||
|
|
int TotalNum = Convert.ToInt32(dv.Table.Rows[j]["TotalNum"].ToString());
|
|||
|
|
Double SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString());
|
|||
|
|
Double TotalCB = Convert.ToDouble(dv.Table.Rows[j]["TotalCB"].ToString());
|
|||
|
|
Double SPYH = Convert.ToDouble(dv.Table.Rows[j]["SPYH1"].ToString());
|
|||
|
|
int prodPrice0 = Convert.ToInt32(dv.Table.Rows[j]["prodPrice0"].ToString());
|
|||
|
|
ZSubTotal = ZSubTotal + SubTotal;
|
|||
|
|
ZprodPrice0 += prodPrice0;
|
|||
|
|
ZSubTotal1 += TotalCB;
|
|||
|
|
ZprodNum += prodNum;
|
|||
|
|
if (TotalNum - prodNum < 0)
|
|||
|
|
{
|
|||
|
|
IFTotalNum = false;
|
|||
|
|
}
|
|||
|
|
if (Convert.ToDouble(YFmoney.ToString("f2")) == 0.00 && Convert.ToDouble(SPYH.ToString("f2")) > 0.00)
|
|||
|
|
{
|
|||
|
|
YFmoney = SPYH;
|
|||
|
|
}
|
|||
|
|
i += 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
ZSubTotal += YFmoney;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (!IFTotalNum)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("您选择的商品已售完!");
|
|||
|
|
}
|
|||
|
|
ZZSubTotal = ZSubTotal;
|
|||
|
|
|
|||
|
|
if (IFUseJF > 0)
|
|||
|
|
{
|
|||
|
|
ZZSubTotal = ZSubTotal - UseJF;
|
|||
|
|
if (Convert.ToDouble(ZZSubTotal.ToString("f2")) < 0.00)
|
|||
|
|
{
|
|||
|
|
UseJF = 0;
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("积分填写错误!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
if (UseJF > UserMoney2)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("积分余额不足!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
|||
|
|
|
|||
|
|
if (Convert.ToDouble(UseJF.ToString("f2")) > 0.00)
|
|||
|
|
{
|
|||
|
|
Double money = UseJF;
|
|||
|
|
Double umoney30 = UserMoney2;
|
|||
|
|
mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = MemberId;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = 0;
|
|||
|
|
mjl2.Cutmoney = -money;
|
|||
|
|
mjl2.Totalmoney = umoney30 - money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "购买商品使用积分";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 1;
|
|||
|
|
mjl2.utype2 = 0;
|
|||
|
|
mjl2.Seef = -1;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
//减少买家余额
|
|||
|
|
daoUser.UpdateMoney("umoney31", money, MemberId);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
string strorders = xorder(OrdersIDs, dv, addressid, Contactname, Contacttel, strProvince, strCity, strCounty, Address, Zipcode, stryhj, 3, ZZSubTotal, ZprodPrice0, ZSubTotal1, 0, UseJF, ZprodNum, ACFOIDs, MemberId);
|
|||
|
|
|
|||
|
|
if (Convert.ToDouble(ZZSubTotal.ToString("f2")) <= UserMoney)
|
|||
|
|
{
|
|||
|
|
if (Convert.ToDouble(ZZSubTotal.ToString("f2")) >= 0.00)
|
|||
|
|
{
|
|||
|
|
Double money = ZZSubTotal;
|
|||
|
|
Double umoney12 = UserMoney;
|
|||
|
|
mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = MemberId;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = 0;
|
|||
|
|
mjl2.Cutmoney = -money;
|
|||
|
|
mjl2.Totalmoney = umoney12 - money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "购买商品付款";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 2;
|
|||
|
|
mjl2.utype2 = 0;
|
|||
|
|
mjl2.Seef = 1;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
//减少买家余额
|
|||
|
|
daoUser.UpdateMoney("umoney16", money, MemberId);
|
|||
|
|
|
|||
|
|
string[] AOrders = strorders.Split(',');
|
|||
|
|
foreach (string stra in AOrders)
|
|||
|
|
{
|
|||
|
|
if (stra != "")
|
|||
|
|
{
|
|||
|
|
Model.order_info Modelorder = new Mtxfw.DAL.order_info().GetModel(int.Parse(stra));
|
|||
|
|
if (Modelorder != null)
|
|||
|
|
{
|
|||
|
|
new DAL.order_info().UpdateqyState(0, "1", DateTime.Now, int.Parse(stra));
|
|||
|
|
Mtxfw.DAL.MemberStatistics.JiangLiFP(Modelorder.Id, Modelorder.orderid, Modelorder.pid.ToString(), Modelorder.UserID, Modelorder.Totalprice, Modelorder.Totalprice0, Modelorder.Totalprice1, Modelorder.Totalprice2, Modelorder.utype.ToString());
|
|||
|
|
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + int.Parse(stra) + " Order By SubmitTime asc");
|
|||
|
|
if (Ds_op.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
|||
|
|
{
|
|||
|
|
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
|
|||
|
|
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
|
|||
|
|
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Ds_op.Clear();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write("支付成功|/Member_Orders_List.aspx");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("付款金额为0");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("支付币余额不足");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected string xorder(string OrdersID, DataView dv, int addressid, string Contactname, string Contacttel, string strProvince, string strCity, string strCounty, string Address, string Zipcode, string stryhj, int checkIFJF, Double Totalprice, Double Totalprice0, Double Totalprice1, Double Totalprice2, Double Totalprice3, int Totalnum, string[] ACFOIDs, int UserID)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string strOrders = "";
|
|||
|
|
foreach (string stra in ACFOIDs)
|
|||
|
|
{
|
|||
|
|
if (stra != "")
|
|||
|
|
{
|
|||
|
|
int MemberId = int.Parse(stra);
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
string OID = dt.ToString("yyMMddhhmmssffff", DateTimeFormatInfo.InvariantInfo);
|
|||
|
|
Model.order_info Modelorder = new Model.order_info();
|
|||
|
|
Modelorder.pid = 0;
|
|||
|
|
Modelorder.addressid = addressid;
|
|||
|
|
Modelorder.orderid = OID;
|
|||
|
|
Modelorder.Contactname = Contactname;
|
|||
|
|
Modelorder.Contacttel = Contacttel;
|
|||
|
|
Modelorder.Province = strProvince;
|
|||
|
|
Modelorder.City = strCity;
|
|||
|
|
Modelorder.County = strCounty;
|
|||
|
|
Modelorder.Address = Address;
|
|||
|
|
Modelorder.Zipcode = Zipcode;
|
|||
|
|
Modelorder.Guests = "";
|
|||
|
|
Modelorder.Totalprice = Totalprice;
|
|||
|
|
Modelorder.Totalprice0 = Totalprice0;
|
|||
|
|
Modelorder.Totalprice1 = Totalprice1;
|
|||
|
|
Modelorder.Totalprice2 = Totalprice2;
|
|||
|
|
Modelorder.Totalprice3 = Totalprice3;
|
|||
|
|
Modelorder.Totalnum = Totalnum;
|
|||
|
|
Modelorder.O_Submit = "1";
|
|||
|
|
Modelorder.O_yhj = stryhj;
|
|||
|
|
Modelorder.UserID = UserID;
|
|||
|
|
Modelorder.MemberId = MemberId;
|
|||
|
|
Modelorder.selcolor = "";
|
|||
|
|
Modelorder.utype = checkIFJF.ToString();
|
|||
|
|
int OrderID = new Mtxfw.DAL.order_info().Add(Modelorder);
|
|||
|
|
if (strOrders == "")
|
|||
|
|
{
|
|||
|
|
strOrders += OrderID.ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
strOrders += "," + OrderID.ToString();
|
|||
|
|
}
|
|||
|
|
for (int j = 0; j <= dv.Count - 1; j++)
|
|||
|
|
{
|
|||
|
|
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
|||
|
|
string selcolor = dv.Table.Rows[j]["selcolor"].ToString();
|
|||
|
|
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
|
|||
|
|
if (OrdersID.IndexOf("," + prodid + ",") != -1 && stra == SUserID)
|
|||
|
|
{
|
|||
|
|
string prodNum = dv.Table.Rows[j]["prodNum"].ToString();
|
|||
|
|
Double prodPrice = Convert.ToDouble(dv.Table.Rows[j]["prodPrice"].ToString());
|
|||
|
|
Double SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString());
|
|||
|
|
Model.order_product_info opmodel = new Model.order_product_info();
|
|||
|
|
opmodel.pid = Convert.ToInt32(prodid);
|
|||
|
|
opmodel.orderid = OrderID;
|
|||
|
|
opmodel.selcolor = HttpUtility.UrlDecode(selcolor);
|
|||
|
|
opmodel.DJprice = prodPrice;
|
|||
|
|
opmodel.Totalprice = SubTotal;
|
|||
|
|
opmodel.Totalnum = int.Parse(prodNum);
|
|||
|
|
opmodel.UserID = UserID;
|
|||
|
|
opmodel.SubmitTime = DateTime.Now;
|
|||
|
|
opmodel.Totalprice = SubTotal;
|
|||
|
|
opmodel.utype = "0";
|
|||
|
|
new DAL.order_product_info().Add(opmodel);
|
|||
|
|
|
|||
|
|
Mtxfw.DAL.ShoppingCart.UpdateProd(prodid, "0", selcolor);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return strOrders;
|
|||
|
|
}
|
|||
|
|
protected string xorder0(string OrdersID, DataView dv, int addressid, string Contactname, string Contacttel, string strProvince, string strCity, string strCounty, string Address, string Zipcode, string stryhj, int checkIFJF, Double Totalprice, Double Totalprice0, Double Totalprice1, Double Totalprice2, Double Totalprice3, int Totalnum, string[] ACFOIDs, int UserID)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
|||
|
|
string strOrders = "";
|
|||
|
|
int MemberId = 0;
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
string OID = dt.ToString("yyMMddhhmmssffff", DateTimeFormatInfo.InvariantInfo);
|
|||
|
|
Model.order_info Modelorder = new Model.order_info();
|
|||
|
|
Modelorder.pid = int.Parse(OrdersID);
|
|||
|
|
Modelorder.addressid = addressid;
|
|||
|
|
Modelorder.orderid = OID;
|
|||
|
|
Modelorder.Contactname = Contactname;
|
|||
|
|
Modelorder.Contacttel = Contacttel;
|
|||
|
|
Modelorder.Province = strProvince;
|
|||
|
|
Modelorder.City = strCity;
|
|||
|
|
Modelorder.County = strCounty;
|
|||
|
|
Modelorder.Address = Address;
|
|||
|
|
Modelorder.Zipcode = Zipcode;
|
|||
|
|
Modelorder.Guests = "";
|
|||
|
|
Modelorder.Totalprice = Totalprice;
|
|||
|
|
Modelorder.Totalprice0 = Totalprice0;
|
|||
|
|
Modelorder.Totalprice1 = Totalprice1;
|
|||
|
|
Modelorder.Totalprice2 = Totalprice2;
|
|||
|
|
Modelorder.Totalprice3 = Totalprice3;
|
|||
|
|
Modelorder.Totalnum = Totalnum;
|
|||
|
|
Modelorder.O_Submit = "1";
|
|||
|
|
Modelorder.O_yhj = stryhj;
|
|||
|
|
Modelorder.UserID = UserID;
|
|||
|
|
Modelorder.MemberId = MemberId;
|
|||
|
|
Modelorder.selcolor = "";
|
|||
|
|
Modelorder.utype = checkIFJF.ToString();
|
|||
|
|
int OrderID = new Mtxfw.DAL.order_info().Add(Modelorder);
|
|||
|
|
if (strOrders == "")
|
|||
|
|
{
|
|||
|
|
strOrders += OrderID.ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
strOrders += "," + OrderID.ToString();
|
|||
|
|
}
|
|||
|
|
Mtxfw.Model.P_Product pmodel = daoProduct.GetModel(int.Parse(OrdersID));
|
|||
|
|
if (pmodel != null)
|
|||
|
|
{
|
|||
|
|
Model.order_product_info opmodel = new Model.order_product_info();
|
|||
|
|
opmodel.pid = pmodel.P_ID;
|
|||
|
|
opmodel.orderid = OrderID;
|
|||
|
|
opmodel.selcolor = "";
|
|||
|
|
opmodel.DJprice = pmodel.P_VIP_P;
|
|||
|
|
opmodel.Totalprice = pmodel.P_VIP_P;
|
|||
|
|
opmodel.Totalnum = 1;
|
|||
|
|
opmodel.UserID = UserID;
|
|||
|
|
opmodel.SubmitTime = DateTime.Now;
|
|||
|
|
opmodel.utype = "0";
|
|||
|
|
new DAL.order_product_info().Add(opmodel);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return strOrders;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //取消订单-----------------------------------------------------------------------------------------
|
|||
|
|
protected void qxorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "" || O_Payed == "0")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "-1", DateTime.Now, int.Parse(orderid));
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //申请退款-----------------------------------------------------------------------------------------
|
|||
|
|
protected void sqtkorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "1")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "-2", DateTime.Now, int.Parse(orderid));
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //申请退货-----------------------------------------------------------------------------------------
|
|||
|
|
protected void sqthorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "2")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "-3", DateTime.Now, int.Parse(orderid));
|
|||
|
|
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //同意退款-----------------------------------------------------------------------------------------
|
|||
|
|
protected void qytytkorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
int t = 0;
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
|
|||
|
|
{
|
|||
|
|
t = Convert.ToInt32(context.Request.Form["t"]);
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "-2")
|
|||
|
|
{
|
|||
|
|
if (t == 1)
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "1", DateTime.Now, int.Parse(orderid));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "-5", DateTime.Now, int.Parse(orderid));
|
|||
|
|
Double money = ModelOrder.Totalprice;
|
|||
|
|
if (ModelOrder.utype == "3")
|
|||
|
|
{
|
|||
|
|
Mtxfw.Model.user_info umodel = daouser.GetModel(ModelOrder.UserID);
|
|||
|
|
if (umodel != null)
|
|||
|
|
{
|
|||
|
|
Double umoney15 = (umodel.umoney15 - umodel.umoney16);
|
|||
|
|
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = umodel.Id;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = 0;
|
|||
|
|
mjl2.Cutmoney = -money;
|
|||
|
|
mjl2.Totalmoney = umoney15 - money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "订单" + ModelOrder.orderid + "退款";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 0;
|
|||
|
|
mjl2.utype2 = 2;
|
|||
|
|
mjl2.Seef = 0;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
daouser.UpdateMoney("umoney16", -money, umodel.Id);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //同意退货-----------------------------------------------------------------------------------------
|
|||
|
|
protected void qytythorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
int t = 0;
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
|
|||
|
|
{
|
|||
|
|
t = Convert.ToInt32(context.Request.Form["t"]);
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "-3")
|
|||
|
|
{
|
|||
|
|
if (t == 1)
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "2", DateTime.Now, int.Parse(orderid));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "-4", DateTime.Now, int.Parse(orderid));
|
|||
|
|
Double money = ModelOrder.Totalprice;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //确认收到退货-----------------------------------------------------------------------------------------
|
|||
|
|
protected void qysdthorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
int t = 0;
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
|
|||
|
|
{
|
|||
|
|
t = Convert.ToInt32(context.Request.Form["t"]);
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "-4")
|
|||
|
|
{
|
|||
|
|
if (t == 1)
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "2", DateTime.Now, int.Parse(orderid));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "-6", DateTime.Now, int.Parse(orderid));
|
|||
|
|
Double money = ModelOrder.Totalprice;
|
|||
|
|
if (ModelOrder.utype == "3")
|
|||
|
|
{
|
|||
|
|
Mtxfw.Model.user_info umodel = daouser.GetModel(ModelOrder.UserID);
|
|||
|
|
if (umodel != null)
|
|||
|
|
{
|
|||
|
|
Double umoney15 = (umodel.umoney15 - umodel.umoney16);
|
|||
|
|
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = umodel.Id;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = 0;
|
|||
|
|
mjl2.Cutmoney = -money;
|
|||
|
|
mjl2.Totalmoney = umoney15 - money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "订单" + ModelOrder.orderid + "退货退回货款";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 0;
|
|||
|
|
mjl2.utype2 = 2;
|
|||
|
|
mjl2.Seef = 0;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
daouser.UpdateMoney("umoney16", -money, umodel.Id);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //确认发货-----------------------------------------------------------------------------------------
|
|||
|
|
protected void qyfhorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "1")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "2", DateTime.Now, int.Parse(orderid));
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //设为已付款-----------------------------------------------------------------------------------------
|
|||
|
|
protected void setorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "" || O_Payed == "0")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "1", DateTime.Now, int.Parse(orderid));
|
|||
|
|
Mtxfw.DAL.MemberStatistics.JiangLiFP(ModelOrder.Id, ModelOrder.orderid, ModelOrder.pid.ToString(), ModelOrder.UserID, ModelOrder.Totalprice, ModelOrder.Totalprice0, ModelOrder.Totalprice1, ModelOrder.Totalprice2, ModelOrder.utype.ToString());
|
|||
|
|
|
|||
|
|
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + ModelOrder.Id + " Order By SubmitTime asc");
|
|||
|
|
if (Ds_op.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
|||
|
|
{
|
|||
|
|
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
|
|||
|
|
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
|
|||
|
|
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Ds_op.Clear();
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //确认收货-----------------------------------------------------------------------------------------
|
|||
|
|
protected void qyshorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "2")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateqyState(0, "3", DateTime.Now, int.Parse(orderid));
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //删除订单-----------------------------------------------------------------------------------------
|
|||
|
|
protected void deleteorder(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
string orderid = "0";
|
|||
|
|
if (context.Request.Form["orderid"] != null)
|
|||
|
|
{
|
|||
|
|
orderid = context.Request.Form["orderid"].ToString();
|
|||
|
|
}
|
|||
|
|
if (orderid == "")
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("1");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string O_Payed = "";
|
|||
|
|
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
|
|||
|
|
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
|||
|
|
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
|
|||
|
|
if (ModelOrder != null)
|
|||
|
|
{
|
|||
|
|
O_Payed = ModelOrder.O_Payed;
|
|||
|
|
if (O_Payed == "0" || O_Payed == "" || O_Payed == "5" || O_Payed == "6")
|
|||
|
|
{
|
|||
|
|
baoorder.UpdateIFDelete(1, DateTime.Now.ToString(), int.Parse(orderid));
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (ModelOrder.utype == "3")
|
|||
|
|
{
|
|||
|
|
Double money = ModelOrder.Totalprice;
|
|||
|
|
Mtxfw.Model.user_info umodel = daouser.GetModel(ModelOrder.UserID);
|
|||
|
|
if (umodel != null)
|
|||
|
|
{
|
|||
|
|
Double umoney15 = (umodel.umoney15 - umodel.umoney16);
|
|||
|
|
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = umodel.Id;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = 0;
|
|||
|
|
mjl2.Cutmoney = -money;
|
|||
|
|
mjl2.Totalmoney = umoney15 - money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "删除订单" + ModelOrder.orderid + "退回货款";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 0;
|
|||
|
|
mjl2.utype2 = 2;
|
|||
|
|
mjl2.Seef = 0;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
daouser.UpdateMoney("umoney16", -money, umodel.Id);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
baoorder.UpdateIFDelete(1, DateTime.Now.ToString(), int.Parse(orderid));
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("3");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //获取商品分类-----------------------------------------------------------------------------------------
|
|||
|
|
protected void GetProductTree(HttpContext context)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
int pid = 0, ttype = 0;
|
|||
|
|
string data = "{\"success\":false}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Request["pid"] != null)
|
|||
|
|
{
|
|||
|
|
pid = int.Parse(context.Request["pid"].ToString());
|
|||
|
|
}
|
|||
|
|
if (context.Request["ttype"] != null)
|
|||
|
|
{
|
|||
|
|
ttype = int.Parse(context.Request["ttype"].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
data = "{\"success\":false,\"msg\":'参数不对'}";
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
|
|||
|
|
DataSet ds = daoCategory.GetList("(select count(b.C_ID) From P_Category b where b.C_PARENTID=a.C_ID) as IsChild,", "a.ttype=" + ttype + " And a.C_PARENTID=" + pid + " Order By a.C_LinkID asc");
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
StringWriter sw = new StringWriter(sb);
|
|||
|
|
|
|||
|
|
using (JsonWriter jw = new JsonTextWriter(sw))
|
|||
|
|
{
|
|||
|
|
jw.WriteStartObject();
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("success");
|
|||
|
|
jw.WriteValue(true);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("total");//所有记录总数
|
|||
|
|
jw.WriteValue(ds.Tables[0].Rows.Count);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("items");
|
|||
|
|
jw.WriteStartArray();
|
|||
|
|
|
|||
|
|
foreach (System.Data.DataRowView Dr in ds.Tables[0].DefaultView)
|
|||
|
|
{
|
|||
|
|
jw.WriteStartObject();
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("C_ID");
|
|||
|
|
jw.WriteValue(Dr["C_ID"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("C_NAME");
|
|||
|
|
jw.WriteValue(Dr["C_NAME"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("C_LinkID");
|
|||
|
|
jw.WriteValue(Dr["C_LinkID"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("C_Layer");
|
|||
|
|
jw.WriteValue(Dr["C_Layer"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("IfShow");
|
|||
|
|
jw.WriteValue(Dr["IfShow"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("IsChild");
|
|||
|
|
jw.WriteValue(Dr["IsChild"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("C_ProductCount");
|
|||
|
|
jw.WriteValue(Dr["C_ProductCount"].ToString());
|
|||
|
|
jw.WriteEndObject();
|
|||
|
|
}
|
|||
|
|
jw.WriteEndArray();
|
|||
|
|
jw.WriteEndObject();
|
|||
|
|
}
|
|||
|
|
data = sw.ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":'找不到数据'}";
|
|||
|
|
}
|
|||
|
|
ds.Clear();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //更新或删除分类-----------------------------------------------------------------------------------------
|
|||
|
|
//更新或删除分类
|
|||
|
|
protected void UpdateTree(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["ids"]) && !String.IsNullOrEmpty(context.Request.Form["t"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
|
|||
|
|
string[] ids = context.Request.Form["ids"].ToString().Split(',');
|
|||
|
|
int t = Convert.ToInt32(context.Request.Form["t"].ToString());
|
|||
|
|
|
|||
|
|
if (t == 0)
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["linkids"]))
|
|||
|
|
{
|
|||
|
|
string[] LinkIDs = context.Request.Form["linkids"].ToString().Split(',');
|
|||
|
|
for (int i = 0; i < ids.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (ids[i] != "")
|
|||
|
|
{
|
|||
|
|
daoCategory.Update(int.Parse(ids[i]), "C_LinkID", int.Parse(LinkIDs[i]));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (t == 1)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < ids.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (ids[i] != "")
|
|||
|
|
{
|
|||
|
|
daoCategory.Update(int.Parse(ids[i]), "IfShow", 1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (t == 2)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < ids.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (ids[i] != "")
|
|||
|
|
{
|
|||
|
|
daoCategory.Update(int.Parse(ids[i]), "IfShow", 0);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (t == 3)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < ids.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (ids[i] != "")
|
|||
|
|
{
|
|||
|
|
daoCategory.Delete2(int.Parse(ids[i]));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
new Mtxfw.shop._Admin.admin_Product_list().Createtopproduct();
|
|||
|
|
context.Response.Write("操作成功");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能删除");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //获取论坛分类-----------------------------------------------------------------------------------------
|
|||
|
|
protected void GetbbsTree(HttpContext context)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
int pid = 0;
|
|||
|
|
string data = "{\"success\":false}";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Request["pid"] != null)
|
|||
|
|
{
|
|||
|
|
pid = int.Parse(context.Request["pid"].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
data = "{\"success\":false,\"msg\":'参数不对'}";
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.forum daoforum = new Mtxfw.DAL.forum();
|
|||
|
|
DataSet ds = daoforum.GetList("(select count(b.B_Id) From forum b where b.B_pid=a.B_Id) as IsChild,", "a.B_seef=1 And a.B_pid=" + pid + " Order By a.B_linkid asc");
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
StringBuilder sb = new StringBuilder();
|
|||
|
|
StringWriter sw = new StringWriter(sb);
|
|||
|
|
|
|||
|
|
using (JsonWriter jw = new JsonTextWriter(sw))
|
|||
|
|
{
|
|||
|
|
jw.WriteStartObject();
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("success");
|
|||
|
|
jw.WriteValue(true);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("total");//所有记录总数
|
|||
|
|
jw.WriteValue(ds.Tables[0].Rows.Count);
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("items");
|
|||
|
|
jw.WriteStartArray();
|
|||
|
|
|
|||
|
|
foreach (System.Data.DataRowView Dr in ds.Tables[0].DefaultView)
|
|||
|
|
{
|
|||
|
|
jw.WriteStartObject();
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_Id");
|
|||
|
|
jw.WriteValue(Dr["B_Id"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_ForumName");
|
|||
|
|
jw.WriteValue(Dr["B_ForumName"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_linkid");
|
|||
|
|
jw.WriteValue(Dr["B_linkid"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_Layer");
|
|||
|
|
jw.WriteValue(Dr["B_Layer"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("IsChild");
|
|||
|
|
jw.WriteValue(Dr["IsChild"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_ForumManager");
|
|||
|
|
jw.WriteValue(Dr["B_ForumManager"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_ForumPicture");
|
|||
|
|
jw.WriteValue(Dr["B_ForumPicture"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_FUrl");
|
|||
|
|
jw.WriteValue(Dr["B_FUrl"].ToString());
|
|||
|
|
|
|||
|
|
jw.WritePropertyName("B_Intro");
|
|||
|
|
jw.WriteValue(Dr["B_Intro"].ToString());
|
|||
|
|
jw.WriteEndObject();
|
|||
|
|
}
|
|||
|
|
jw.WriteEndArray();
|
|||
|
|
jw.WriteEndObject();
|
|||
|
|
}
|
|||
|
|
data = sw.ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":'找不到数据'}";
|
|||
|
|
}
|
|||
|
|
ds.Clear();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
data = "{\"success\":false,\"msg\":\"发生错误\"}";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Utility.Common.WriteJson(context, data);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //回复贴子-----------------------------------------------------------------------------------------
|
|||
|
|
//回复贴子
|
|||
|
|
protected void ReBBS(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["body"]) && !String.IsNullOrEmpty(context.Request.Form["ID"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.bbs daobbs = new Mtxfw.DAL.bbs();
|
|||
|
|
Mtxfw.DAL.forum daoforum = new Mtxfw.DAL.forum();
|
|||
|
|
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
|
|||
|
|
if (umodel != null)
|
|||
|
|
{
|
|||
|
|
if (Mtxfw.Utility.Common.DateDiff(DateTime.Now, umodel.RegTime) > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
string strBody = HttpUtility.UrlDecode(context.Request.Form["body"]);
|
|||
|
|
Int64 ID = Convert.ToInt64(context.Request.Form["ID"].ToString());
|
|||
|
|
|
|||
|
|
Mtxfw.Model.bbs mbbs = daobbs.GetModel(ID);
|
|||
|
|
if (mbbs != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
if (mbbs.B_seef == 0)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴未审核");
|
|||
|
|
}
|
|||
|
|
if (mbbs.B_Lock == 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴已被锁定");
|
|||
|
|
}
|
|||
|
|
if (mbbs.B_IFDelete == 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴已被删除");
|
|||
|
|
}
|
|||
|
|
if (mbbs.B_IFReBack == 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴不允许回复");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
mbbs.B_Title = "Re:" + mbbs.B_Title;
|
|||
|
|
if (mbbs.B_Layer == 1)
|
|||
|
|
{
|
|||
|
|
string str = "<fieldset><legend><font size=\"2\">回复:" + daoUser.Getzd("NCName", "ID=" + mbbs.B_MemberId).ToString() + "</font></legend><div class=\"ReBody\">\n";
|
|||
|
|
str += mbbs.B_Body + "\n";
|
|||
|
|
str += "<div></fieldset>\n";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
mbbs.B_Layer = 1;
|
|||
|
|
mbbs.B_FatherId = ID;
|
|||
|
|
mbbs.B_MemberId = MemberId;
|
|||
|
|
mbbs.B_IP = Mtxfw.Utility.Common.GetIP;
|
|||
|
|
mbbs.B_LastMemberId = MemberId;
|
|||
|
|
mbbs.B_TPDA_LinkID = 0;
|
|||
|
|
mbbs.B_TP_StarDate = DateTime.Now;
|
|||
|
|
mbbs.B_TP_EndDate = DateTime.Now;
|
|||
|
|
mbbs.B_Url = "";
|
|||
|
|
mbbs.B_Pic = "";
|
|||
|
|
mbbs.B_Body = strBody;
|
|||
|
|
mbbs.B_seef = 1;
|
|||
|
|
mbbs.B_IFReBack = 0;
|
|||
|
|
mbbs.B_IFLogin = 0;
|
|||
|
|
mbbs.B_IFShow = 0;
|
|||
|
|
|
|||
|
|
daobbs.Add(mbbs);
|
|||
|
|
daobbs.Update0(MemberId, ID);
|
|||
|
|
|
|||
|
|
daoUser.UpdateuLevel0("ReArticleNum", 1, mbbs.B_MemberId);
|
|||
|
|
daoUser.UpdateuLevel0("ArticleJF", 2, mbbs.B_MemberId);
|
|||
|
|
daoUser.UpdateuLevel0("ArticleMoney", 1, mbbs.B_MemberId);
|
|||
|
|
|
|||
|
|
if (context.Session["UploadFileIng"] != null)
|
|||
|
|
{
|
|||
|
|
string[] stra = context.Session["UploadFileIng"].ToString().Split(',');
|
|||
|
|
foreach (string str in stra)
|
|||
|
|
{
|
|||
|
|
if (str.Trim() != "")
|
|||
|
|
{
|
|||
|
|
if (mbbs.B_Body.IndexOf(str.Trim()) == -1)
|
|||
|
|
{
|
|||
|
|
if (System.IO.File.Exists(context.Server.MapPath(str.Trim())))
|
|||
|
|
{
|
|||
|
|
System.IO.File.Delete(context.Server.MapPath(str.Trim()));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Session.Remove("UploadFileIng");
|
|||
|
|
System.Collections.IDictionaryEnumerator CacheEnum = context.Cache.GetEnumerator();
|
|||
|
|
while (CacheEnum.MoveNext())
|
|||
|
|
{
|
|||
|
|
context.Cache.Remove(CacheEnum.Key.ToString());
|
|||
|
|
}
|
|||
|
|
context.Response.Write("回复成功");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("新注册用户注册时间在24小时内不允许发贴");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能回复");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //设置贴子-----------------------------------------------------------------------------------------
|
|||
|
|
//设置贴子
|
|||
|
|
protected void SetBBS(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["t"]) && !String.IsNullOrEmpty(context.Request.Form["v"]) && !String.IsNullOrEmpty(context.Request.Form["ID"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"].ToString() != "")
|
|||
|
|
{
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
Mtxfw.DAL.bbs daobbs = new Mtxfw.DAL.bbs();
|
|||
|
|
Mtxfw.DAL.forum daoforum = new Mtxfw.DAL.forum();
|
|||
|
|
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
|
|||
|
|
if (umodel != null)
|
|||
|
|
{
|
|||
|
|
if (Mtxfw.Utility.Common.DateDiff(DateTime.Now, umodel.RegTime) > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Int32 t = Convert.ToInt32(context.Request.Form["t"].ToString());
|
|||
|
|
Int32 v = Convert.ToInt32(context.Request.Form["v"].ToString());
|
|||
|
|
Int64 ID = Convert.ToInt64(context.Request.Form["ID"].ToString());
|
|||
|
|
Mtxfw.Model.bbs mbbs = daobbs.GetModel(ID);
|
|||
|
|
if (mbbs != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
if (mbbs.B_seef == 0)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴未审核");
|
|||
|
|
}
|
|||
|
|
if (t != 3 && mbbs.B_Lock == 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴已被锁定");
|
|||
|
|
}
|
|||
|
|
if (mbbs.B_IFDelete == 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴已被删除");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!daoforum.IsForumManager(mbbs.B_MemberId, umodel.UserName))
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("您的权限不足");
|
|||
|
|
}
|
|||
|
|
if (t < 0 || t > 4)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("参数错误3");
|
|||
|
|
}
|
|||
|
|
if (v < 0 || v > 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("参数错误4");
|
|||
|
|
}
|
|||
|
|
if (mbbs.B_Layer == 1 && t != 3 && t != 4)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("此贴不允许设置");
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
string Sel = "";
|
|||
|
|
int SelValue = 0;
|
|||
|
|
if (v == 0)
|
|||
|
|
{
|
|||
|
|
SelValue = 1;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SelValue = 0;
|
|||
|
|
}
|
|||
|
|
if (t == 0)
|
|||
|
|
{
|
|||
|
|
Sel = "B_SetTop";
|
|||
|
|
}
|
|||
|
|
if (t == 1)
|
|||
|
|
{
|
|||
|
|
Sel = "B_IFTJ";
|
|||
|
|
}
|
|||
|
|
if (t == 2)
|
|||
|
|
{
|
|||
|
|
Sel = "B_IFHot";
|
|||
|
|
}
|
|||
|
|
if (t == 3)
|
|||
|
|
{
|
|||
|
|
Sel = "B_Lock";
|
|||
|
|
}
|
|||
|
|
if (t == 4)
|
|||
|
|
{
|
|||
|
|
Sel = "B_IFDelete";
|
|||
|
|
}
|
|||
|
|
daobbs.Update(Sel, SelValue, ID);
|
|||
|
|
|
|||
|
|
System.Collections.IDictionaryEnumerator CacheEnum = context.Cache.GetEnumerator();
|
|||
|
|
while (CacheEnum.MoveNext())
|
|||
|
|
{
|
|||
|
|
context.Cache.Remove(CacheEnum.Key.ToString());
|
|||
|
|
}
|
|||
|
|
if (t == 4)
|
|||
|
|
{
|
|||
|
|
context.Response.Write("删除成功");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("设置成功");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("新注册用户注册时间在24小时内不允许发贴");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能回复");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //发送验证码-----------------------------------------------------------------------------------------
|
|||
|
|
protected void SendYZM(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
|
|||
|
|
Mtxfw.Model.user_info model = new DAL.user_info().GetModel(MemberId);
|
|||
|
|
if (System.Text.RegularExpressions.Regex.IsMatch(model.Phone, @"^[1]+[3,4,5,8]+\d{9}"))
|
|||
|
|
{
|
|||
|
|
DateTime dt1 = DateTime.Now;
|
|||
|
|
DateTime dt2 = model.PhoneTime.AddMinutes(2);
|
|||
|
|
if (DateTime.Compare(dt2, dt1) <= 0)
|
|||
|
|
{
|
|||
|
|
bool bt = false;
|
|||
|
|
if (model.PhoneTime.ToString() != "")
|
|||
|
|
{
|
|||
|
|
dt2 = model.PhoneTime.AddDays(1);
|
|||
|
|
if (DateTime.Compare(dt2, dt1) > 0)
|
|||
|
|
{
|
|||
|
|
bt = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (model.PhoneCount < 5 || (model.PhoneCount >= 5 && !bt))
|
|||
|
|
{
|
|||
|
|
string strYZM = RandNum(4);
|
|||
|
|
new DAL.user_info().UpdatePhoneTime(strYZM, DateTime.Now, MemberId);
|
|||
|
|
string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码24小时内有效,请及时验证!";
|
|||
|
|
strconent += "【一心科技网】";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.Utility.Common.sendsms(model.Phone, strconent);
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
context.Response.Write("发送验证码出现错误!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("您已经发送超过5次了,请明天再试吧!");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("请您在2分钟后再操作!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("手机号码格式填写不正确!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void SendYZM2(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
|
|||
|
|
Mtxfw.Model.user_info model = new DAL.user_info().GetModel(MemberId);
|
|||
|
|
if (model.IFPhone == 1)
|
|||
|
|
{
|
|||
|
|
if (System.Text.RegularExpressions.Regex.IsMatch(model.EditPhone, @"^[1]+[3,4,5,8]+\d{9}"))
|
|||
|
|
{
|
|||
|
|
DateTime dt1 = DateTime.Now;
|
|||
|
|
DateTime dt2 = model.PhoneTime.AddMinutes(2);
|
|||
|
|
if (DateTime.Compare(dt2, dt1) <= 0)
|
|||
|
|
{
|
|||
|
|
bool bt = false;
|
|||
|
|
if (model.PhoneTime.ToString() != "")
|
|||
|
|
{
|
|||
|
|
dt2 = model.PhoneTime.AddDays(1);
|
|||
|
|
if (DateTime.Compare(dt2, dt1) > 0)
|
|||
|
|
{
|
|||
|
|
bt = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (model.PhoneCount < 5 || (model.PhoneCount >= 5 && !bt))
|
|||
|
|
{
|
|||
|
|
string strYZM = RandNum(4);
|
|||
|
|
new DAL.user_info().UpdatePhoneTime0(strYZM, DateTime.Now, MemberId);
|
|||
|
|
string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码24小时内有效,请及时验证!";
|
|||
|
|
strconent += "【一心科技网】";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.Utility.Common.sendsms(model.EditPhone, strconent);
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
context.Response.Write("发送验证码出现错误!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("您已经发送超过5次了,请明天再试吧!");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("请您在2分钟后再操作!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("手机号码格式填写不正确!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("请先验证您的旧手机号码!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
protected void SendYZM3(HttpContext context)
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["UserName"]) && !String.IsNullOrEmpty(context.Request.Form["Phone"]))
|
|||
|
|
{
|
|||
|
|
string UserName = HttpUtility.UrlDecode(context.Request.Form["UserName"]).ToString();
|
|||
|
|
string Phone = HttpUtility.UrlDecode(context.Request.Form["Phone"]).ToString();
|
|||
|
|
Mtxfw.Model.user_info model = new DAL.user_info().GetModel(UserName, Phone);
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
if (System.Text.RegularExpressions.Regex.IsMatch(Phone, @"^[1]+[3,4,5,8]+\d{9}"))
|
|||
|
|
{
|
|||
|
|
DateTime dt1 = DateTime.Now;
|
|||
|
|
DateTime dt2 = model.PhoneTime.AddMinutes(2);
|
|||
|
|
if (DateTime.Compare(dt2, dt1) <= 0)
|
|||
|
|
{
|
|||
|
|
bool bt = false;
|
|||
|
|
if (model.PhoneTime.ToString() != "")
|
|||
|
|
{
|
|||
|
|
dt2 = model.PhoneTime.AddDays(1);
|
|||
|
|
if (DateTime.Compare(dt2, dt1) > 0)
|
|||
|
|
{
|
|||
|
|
bt = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (model.PhoneCount < 5 || (model.PhoneCount >= 5 && !bt))
|
|||
|
|
{
|
|||
|
|
string strYZM = RandNum(4);
|
|||
|
|
new DAL.user_info().UpdatePhoneTime0(strYZM, DateTime.Now, model.Id);
|
|||
|
|
string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码24小时内有效,请及时验证!";
|
|||
|
|
strconent += "【一心科技网】";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.Utility.Common.sendsms(model.Phone, strconent);
|
|||
|
|
context.Response.Write("0");
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
context.Response.Write("发送验证码出现错误!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("您已经发送超过5次了,请明天再试吧!");
|
|||
|
|
}
|
|||
|
|
else context.Response.Write("请您在2分钟后再操作!");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("手机号码格式填写不正确!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误2!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 生成指定位数的随机数
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="VcodeNum">参数是随机数的位数</param>
|
|||
|
|
/// <returns>返回一个随机数字符串</returns>
|
|||
|
|
private string RandNum(int VcodeNum)
|
|||
|
|
{
|
|||
|
|
string Vchar = "2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
|
|||
|
|
string[] VcArray = Vchar.Split(','); //拆分成数组
|
|||
|
|
string VNum = "";
|
|||
|
|
int temp = -1; //记录上次随机数值,尽量避避免生产几个一样的随机数
|
|||
|
|
|
|||
|
|
Random rand = new Random();
|
|||
|
|
//采用一个简单的算法以保证生成随机数的不同
|
|||
|
|
for (int i = 0; i < VcodeNum; i++)
|
|||
|
|
{
|
|||
|
|
if (temp != -1)
|
|||
|
|
{
|
|||
|
|
rand = new Random(i * temp * unchecked((int)DateTime.Now.Ticks));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int t = rand.Next(VcArray.Length - 1);
|
|||
|
|
if (temp != -1 && temp == t)
|
|||
|
|
{
|
|||
|
|
return RandNum(VcodeNum);
|
|||
|
|
}
|
|||
|
|
temp = t;
|
|||
|
|
VNum += VcArray[t];
|
|||
|
|
}
|
|||
|
|
return VNum;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //删除图片-----------------------------------------------------------------------------------------
|
|||
|
|
//删除图片
|
|||
|
|
protected void DeletePic(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["pic"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null || context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["jiaoyouPhoto"] != null)
|
|||
|
|
{
|
|||
|
|
string pic = HttpUtility.UrlDecode(context.Request.Form["pic"].ToString());
|
|||
|
|
context.Session["jiaoyouPhoto"] = context.Session["jiaoyouPhoto"].ToString().Replace(pic + "|", "");
|
|||
|
|
if (File.Exists(context.Server.MapPath("/image/" + pic.Split(',')[0])))
|
|||
|
|
{
|
|||
|
|
File.Delete(context.Server.MapPath("/image/" + pic.Split(',')[0]));
|
|||
|
|
}
|
|||
|
|
context.Response.Write("删除成功");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("超时退出,不能删除");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录,不能删除");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //设置图片为封面-----------------------------------------------------------------------------------------
|
|||
|
|
//设置图片为封面
|
|||
|
|
protected void SetPic(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["pic"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null || context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["jiaoyouPhoto"] != null)
|
|||
|
|
{
|
|||
|
|
string pic = HttpUtility.UrlDecode(context.Request.Form["pic"].ToString());
|
|||
|
|
context.Session["jiaoyouPhoto"] = pic + "|" + context.Session["jiaoyouPhoto"].ToString().Replace(pic + "|", "");
|
|||
|
|
string imgurl = "";
|
|||
|
|
string[] strjiaoyouPhotoA = context.Session["jiaoyouPhoto"].ToString().Split('|');
|
|||
|
|
string stryanseoption = "";
|
|||
|
|
if (context.Request.Form["yanse"] != "")
|
|||
|
|
{
|
|||
|
|
string stryanse = HttpUtility.UrlDecode(context.Request.Form["yanse"].ToString());
|
|||
|
|
string[] Ayanse = stryanse.Split('|');
|
|||
|
|
|
|||
|
|
for (int i = 0; i < Ayanse.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (Ayanse[i] != "")
|
|||
|
|
{
|
|||
|
|
string[] stra = Ayanse[i].Split('#');
|
|||
|
|
stryanseoption += "<option value='" + Ayanse[i] + "'>" + stra[0] + "</option>";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
for (int i = 0; i < strjiaoyouPhotoA.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (strjiaoyouPhotoA[i] != "")
|
|||
|
|
{
|
|||
|
|
string[] strPhoto = strjiaoyouPhotoA[i].Split(',');
|
|||
|
|
imgurl += "<li id='picli" + i + "'><img src='" + Mtxfw.Utility.Common.GetCoverPic(strPhoto[0], "100x100", "cut") + "' width='100' class='pic'/><a href=javascript:DeletePic('" + strjiaoyouPhotoA[i] + "'," + i + ")>删除</a>";
|
|||
|
|
if (i == 0)
|
|||
|
|
{
|
|||
|
|
imgurl += " 已设为封面";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
imgurl += " <a href=javascript:SetPic('" + strjiaoyouPhotoA[i] + "'," + i + ")>设为封面</a>";
|
|||
|
|
}
|
|||
|
|
if (stryanseoption != "")
|
|||
|
|
{
|
|||
|
|
string stryanseoption2 = stryanseoption;
|
|||
|
|
if (strPhoto.Length == 2)
|
|||
|
|
{
|
|||
|
|
if (strPhoto[1] != "")
|
|||
|
|
{
|
|||
|
|
stryanseoption2 = stryanseoption.Replace("value='" + strPhoto[1] + "'", "value='" + strPhoto[1] + "' selected");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
imgurl += "<br><select id='select_yanse_" + i + "'>" + stryanseoption2 + "</select>";
|
|||
|
|
}
|
|||
|
|
imgurl += "</li>";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write(imgurl);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("发生错误1");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //保存图片-----------------------------------------------------------------------------------------
|
|||
|
|
//保存图片
|
|||
|
|
protected void SavePic(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (context.Request.Form["sels"] !=null && !String.IsNullOrEmpty(context.Request.Form["ID"]))
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null || context.Session["MemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (context.Session["jiaoyouPhoto"] != null)
|
|||
|
|
{
|
|||
|
|
string sels = HttpUtility.UrlDecode(context.Request.Form["sels"].ToString());
|
|||
|
|
string[] asels = sels.Split('|');
|
|||
|
|
string[] strjiaoyouPhotoA = context.Session["jiaoyouPhoto"].ToString().Split('|');
|
|||
|
|
int UpdateID = Convert.ToInt32(context.Request.Form["ID"].ToString());
|
|||
|
|
Mtxfw.Model.P_Product model = new Mtxfw.DAL.P_Product().GetModel(UpdateID);
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
string strPhotos = "";
|
|||
|
|
for (int i = 0; i < strjiaoyouPhotoA.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (strjiaoyouPhotoA[i] != "")
|
|||
|
|
{
|
|||
|
|
string[] strPhoto = strjiaoyouPhotoA[i].Split(',');
|
|||
|
|
if (sels != "")
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
strPhotos += strPhoto[0] + "," + asels[i] + "|";
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
strPhotos += strPhoto[0] + "|";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
strPhotos += strPhoto[0] + "|";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
model.P_images = strPhotos;
|
|||
|
|
new Mtxfw.DAL.P_Product().Update(model);
|
|||
|
|
}
|
|||
|
|
context.Response.Write("保存成功");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("发生错误2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("发生错误1");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //保存配送地址-----------------------------------------------------------------------------------------
|
|||
|
|
//保存配送地址
|
|||
|
|
protected void saveaddress(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["name"]))
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["phone"]))
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["province"]))
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["city"]))
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["address"]))
|
|||
|
|
{
|
|||
|
|
string strname = HttpUtility.UrlDecode(context.Request.Form["name"].ToString()).Trim();
|
|||
|
|
string strphone = HttpUtility.UrlDecode(context.Request.Form["phone"].ToString()).Trim();
|
|||
|
|
string strprovince = HttpUtility.UrlDecode(context.Request.Form["province"].ToString()).Trim();
|
|||
|
|
string strcity = HttpUtility.UrlDecode(context.Request.Form["city"].ToString()).Trim();
|
|||
|
|
string straddress = HttpUtility.UrlDecode(context.Request.Form["address"].ToString());
|
|||
|
|
string strcounty = "";
|
|||
|
|
if (context.Request.Form["county"] != null)
|
|||
|
|
{
|
|||
|
|
strcounty = HttpUtility.UrlDecode(context.Request.Form["county"].ToString()).Trim();
|
|||
|
|
}
|
|||
|
|
string strpostalcode = "";
|
|||
|
|
if (context.Request.Form["postalcode"] != null)
|
|||
|
|
{
|
|||
|
|
strpostalcode = HttpUtility.UrlDecode(context.Request.Form["postalcode"].ToString()).Trim();
|
|||
|
|
}
|
|||
|
|
int addressid = 0;
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["addressid"]))
|
|||
|
|
{
|
|||
|
|
addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()).Trim());
|
|||
|
|
}
|
|||
|
|
bool b = true;
|
|||
|
|
if (!String.IsNullOrEmpty(strname))
|
|||
|
|
{
|
|||
|
|
if (!System.Text.RegularExpressions.Regex.IsMatch(strname, @"[\u4e00-\u9fa5]"))
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
context.Response.Write("联系人姓名填写不正确,只能输入中文!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
if (MemberId > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (addressid > 0)
|
|||
|
|
{
|
|||
|
|
Model.user_address model = new DAL.user_address().GetModel(addressid);
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
model.Contactname = strname;
|
|||
|
|
model.Contacttel = strphone;
|
|||
|
|
model.Province = strprovince;
|
|||
|
|
model.City = strcity;
|
|||
|
|
model.County = strcounty;
|
|||
|
|
model.Address = straddress;
|
|||
|
|
model.Zipcode = strpostalcode;
|
|||
|
|
new DAL.user_address().Update(model);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (new DAL.user_address().GetCount("UserID=" + MemberId) < 5)
|
|||
|
|
{
|
|||
|
|
Model.user_address model = new Model.user_address();
|
|||
|
|
model.Contactname = strname;
|
|||
|
|
model.Contacttel = strphone;
|
|||
|
|
model.Province = strprovince;
|
|||
|
|
model.City = strcity;
|
|||
|
|
model.County = strcounty;
|
|||
|
|
model.Address = straddress;
|
|||
|
|
model.Zipcode = strpostalcode;
|
|||
|
|
model.Guests = "";
|
|||
|
|
model.IFIndex = 0;
|
|||
|
|
model.UserID = MemberId;
|
|||
|
|
new DAL.user_address().Add(model);
|
|||
|
|
Mtxfw.Model.user_info ModelUser = new Mtxfw.DAL.user_info().GetModel(MemberId);
|
|||
|
|
if (ModelUser != null)
|
|||
|
|
{
|
|||
|
|
if (ModelUser.RealName == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.RealName = strname;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.Phone == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.Phone = strphone;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.Province == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.Province = strprovince;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.City == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.City = strcity;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.County == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.County = strcounty;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.MailingAddress == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.MailingAddress = straddress;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.PostalCode == "")
|
|||
|
|
{
|
|||
|
|
ModelUser.PostalCode = strpostalcode;
|
|||
|
|
}
|
|||
|
|
if (ModelUser.RealName == "")
|
|||
|
|
{
|
|||
|
|
new Mtxfw.DAL.user_info().Update(ModelUser);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("最多只能添加5个地址");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数错误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("城市必须选择");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("省份必须选择");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("联系电话不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("联系人不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //删除配送地址-----------------------------------------------------------------------------------------
|
|||
|
|
//删除配送地址
|
|||
|
|
protected void deladdress(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["addressid"]))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
int addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()).Trim());
|
|||
|
|
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
if (MemberId > 0)
|
|||
|
|
{
|
|||
|
|
if (addressid > 0)
|
|||
|
|
{
|
|||
|
|
Model.user_address model = new DAL.user_address().GetModel(addressid);
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
if (model.UserID == MemberId)
|
|||
|
|
{
|
|||
|
|
new DAL.user_address().Delete(addressid);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数有误2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数有误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("联系人不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //设置配送地址-----------------------------------------------------------------------------------------
|
|||
|
|
//设置配送地址
|
|||
|
|
protected void setaddress(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["addressid"]))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
int addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()).Trim());
|
|||
|
|
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
|
|||
|
|
{
|
|||
|
|
int MemberId = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
if (MemberId > 0)
|
|||
|
|
{
|
|||
|
|
if (addressid > 0)
|
|||
|
|
{
|
|||
|
|
Model.user_address model = new DAL.user_address().GetModel(addressid);
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
if (model.UserID == MemberId)
|
|||
|
|
{
|
|||
|
|
new DAL.user_address().UpdateIFIndex(model.Id,model.UserID);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数有误2");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数有误");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("联系人不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region //增加抽奖池金额-----------------------------------------------------------------------------------------
|
|||
|
|
//增加抽奖池金额
|
|||
|
|
protected void addqjje(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["t"]) && !String.IsNullOrEmpty(context.Request.Form["qjje"]))
|
|||
|
|
{
|
|||
|
|
int t = int.Parse(HttpUtility.UrlDecode(context.Request.Form["t"].ToString()));
|
|||
|
|
Double qjje = int.Parse(HttpUtility.UrlDecode(context.Request.Form["qjje"].ToString()));
|
|||
|
|
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
if (t == 0)
|
|||
|
|
{
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount("count1", qjje, 5);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount("count1", qjje, 6);
|
|||
|
|
}
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //保存中奖金额-----------------------------------------------------------------------------------------
|
|||
|
|
//保存中奖金额
|
|||
|
|
protected void savezjje(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["zjje1"]) && !String.IsNullOrEmpty(context.Request.Form["zjje2"]) && !String.IsNullOrEmpty(context.Request.Form["zjje3"]) && !String.IsNullOrEmpty(context.Request.Form["zjje4"]) && !String.IsNullOrEmpty(context.Request.Form["zjje5"]) && !String.IsNullOrEmpty(context.Request.Form["zjje21"]) && !String.IsNullOrEmpty(context.Request.Form["zjje22"]) && !String.IsNullOrEmpty(context.Request.Form["zjje23"]) && !String.IsNullOrEmpty(context.Request.Form["zjje24"]) && !String.IsNullOrEmpty(context.Request.Form["zjje25"]))
|
|||
|
|
{
|
|||
|
|
Double zjje1 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje1"].ToString()));
|
|||
|
|
Double zjje2 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje2"].ToString()));
|
|||
|
|
Double zjje3 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje3"].ToString()));
|
|||
|
|
Double zjje4 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje4"].ToString()));
|
|||
|
|
Double zjje5 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje5"].ToString()));
|
|||
|
|
Double zjje21 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje21"].ToString()));
|
|||
|
|
Double zjje22 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje22"].ToString()));
|
|||
|
|
Double zjje23 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje23"].ToString()));
|
|||
|
|
Double zjje24 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje24"].ToString()));
|
|||
|
|
Double zjje25 = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zjje25"].ToString()));
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count2", zjje1, 5);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count3", zjje2, 5);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count4", zjje3, 5);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count5", zjje4, 5);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count6", zjje5, 5);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count2", zjje21, 6);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count3", zjje22, 6);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count4", zjje23, 6);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count5", zjje24, 6);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount0("count6", zjje25, 6);
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("参数不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //保存抽奖设置-----------------------------------------------------------------------------------------
|
|||
|
|
//保存抽奖设置
|
|||
|
|
protected void savecj(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(context.Request.Form["vals"]))
|
|||
|
|
{
|
|||
|
|
string[] vals = HttpUtility.UrlDecode(context.Request.Form["vals"].ToString()).Trim().Split('|');
|
|||
|
|
|
|||
|
|
if (context.Session["MemberIdMemberId"] != null)
|
|||
|
|
{
|
|||
|
|
bool b = true;
|
|||
|
|
int t1 = 0;
|
|||
|
|
int t2 = 0;
|
|||
|
|
foreach (string val in vals)
|
|||
|
|
{
|
|||
|
|
if (val != "")
|
|||
|
|
{
|
|||
|
|
string[] ava = val.Split(',');
|
|||
|
|
Model.choujiang model = new DAL.choujiang().GetModel(int.Parse(ava[0]));
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (model.utype == 0)
|
|||
|
|
{
|
|||
|
|
if (Convert.ToInt32(ava[2]) > 10 || Convert.ToInt32(ava[3]) > 10 || Convert.ToInt32(ava[4]) > 10 || Convert.ToInt32(ava[5]) > 10 || Convert.ToInt32(ava[6]) > 10)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
t1 += 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (Convert.ToInt32(ava[2]) > 1 || Convert.ToInt32(ava[3]) > 1 || Convert.ToInt32(ava[4]) > 1 || Convert.ToInt32(ava[5]) > 1 || Convert.ToInt32(ava[6]) > 1)
|
|||
|
|
{
|
|||
|
|
b = false;
|
|||
|
|
t2 += 1;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (b)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
foreach (string val in vals)
|
|||
|
|
{
|
|||
|
|
if (val != "")
|
|||
|
|
{
|
|||
|
|
string[] ava = val.Split(',');
|
|||
|
|
Model.choujiang model = new DAL.choujiang().GetModel(int.Parse(ava[0]));
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
model.xfje = Convert.ToDouble(ava[1]);
|
|||
|
|
model.kzjzs1 = Convert.ToInt32(ava[2]);
|
|||
|
|
model.kzjzs2 = Convert.ToInt32(ava[3]);
|
|||
|
|
model.kzjzs3 = Convert.ToInt32(ava[4]);
|
|||
|
|
model.kzjzs4 = Convert.ToInt32(ava[5]);
|
|||
|
|
model.kzjzs5 = Convert.ToInt32(ava[6]);
|
|||
|
|
new DAL.choujiang().Update(model);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
context.Response.Write("true");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (t1 > 0)
|
|||
|
|
{
|
|||
|
|
context.Response.Write("次数填写错误,不能大于10次");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("次数填写错误,不能大于1次");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("联系人不能为空");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
context.Response.Write(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region //抽奖-----------------------------------------------------------------------------------------
|
|||
|
|
//抽奖
|
|||
|
|
protected void qoujiang(HttpContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.user_address daoaddress = new Mtxfw.DAL.user_address();
|
|||
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|||
|
|
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
|
|||
|
|
{
|
|||
|
|
bool bb = false;
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
if (dt.Hour >= 23 && dt.Minute >= 30)
|
|||
|
|
{
|
|||
|
|
bb = true;
|
|||
|
|
}
|
|||
|
|
if (bb)
|
|||
|
|
{
|
|||
|
|
context.Response.Write("系统正在结算中,请过了晚上12点再来抽奖^-^");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Mtxfw.DAL.choujiang daocj = new Mtxfw.DAL.choujiang();
|
|||
|
|
Mtxfw.DAL.User_xjcjq daocjq = new Mtxfw.DAL.User_xjcjq();
|
|||
|
|
Mtxfw.DAL.User_zhongjiang daozj = new Mtxfw.DAL.User_zhongjiang();
|
|||
|
|
int MemberId = int.Parse(context.Session["MemberId"].ToString());
|
|||
|
|
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
|
|||
|
|
if (umodel != null)
|
|||
|
|
{
|
|||
|
|
int utype = 0;
|
|||
|
|
if (context.Request.Form["t"] != null)
|
|||
|
|
{
|
|||
|
|
utype = int.Parse(context.Request.Form["t"].ToString());
|
|||
|
|
}
|
|||
|
|
if (utype == 0)
|
|||
|
|
{
|
|||
|
|
DataSet ds = daocjq.GetList("top 1 ", "utype=" + utype + " And MemberId=" + MemberId + " And (kqjcs-yqjcs)>0 And Seef=1 And (Select Count(Id) From User_zhongjiang b where b.utype=a.utype and b.MemberId=a.MemberId And b.cjqId=a.id And DateDiff(day,addtime,getdate())=0)=0");
|
|||
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
int cjqid = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
|
|||
|
|
int cjId = int.Parse(ds.Tables[0].Rows[0]["cjId"].ToString());
|
|||
|
|
int _cjqcount1 = daozj.GetCount("utype=" + utype + " And MemberId=" + MemberId + " And cjqId=" + cjqid + " And zjdj=1");
|
|||
|
|
int _cjqcount2 = daozj.GetCount("utype=" + utype + " And MemberId=" + MemberId + " And cjqId=" + cjqid + " And zjdj=2");
|
|||
|
|
int _cjqcount3 = daozj.GetCount("utype=" + utype + " And MemberId=" + MemberId + " And cjqId=" + cjqid + " And zjdj=3");
|
|||
|
|
int _cjqcount4 = daozj.GetCount("utype=" + utype + " And MemberId=" + MemberId + " And cjqId=" + cjqid + " And zjdj=4");
|
|||
|
|
int _cjqcount5 = daozj.GetCount("utype=" + utype + " And MemberId=" + MemberId + " And cjqId=" + cjqid + " And zjdj=5");
|
|||
|
|
Model.choujiang cjm = daocj.GetModel(cjId);
|
|||
|
|
if (cjm != null)
|
|||
|
|
{
|
|||
|
|
int cjqcount1 = cjm.kzjzs1 - _cjqcount1;
|
|||
|
|
int cjqcount2 = cjm.kzjzs2 - _cjqcount2;
|
|||
|
|
int cjqcount3 = cjm.kzjzs3 - _cjqcount3;
|
|||
|
|
int cjqcount4 = cjm.kzjzs4 - _cjqcount4;
|
|||
|
|
int cjqcount5 = cjm.kzjzs5 - _cjqcount5;
|
|||
|
|
string Vchar = "";
|
|||
|
|
if (cjqcount1 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",1";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount2 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "2";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",2";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount3 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "3";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",3";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount4 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "4";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",4";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount5 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "5";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",5";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string strzjhm = RandNum_CJ(1, Vchar);
|
|||
|
|
if (strzjhm == "")
|
|||
|
|
{
|
|||
|
|
strzjhm = "1";
|
|||
|
|
}
|
|||
|
|
int zjhm = int.Parse(strzjhm);
|
|||
|
|
Double zjje = 0, jcje = 0, zjje1 = 0, zjje2 = 0, zjje3 = 0, zjje4 = 0, zjje5 = 0;
|
|||
|
|
System.Data.DataSet Ds = new Mtxfw.DAL.user_jjfp().GetList("", "TType=5");
|
|||
|
|
|
|||
|
|
if (Ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
jcje = Convert.ToDouble(Ds.Tables[0].Rows[0]["count1"]);
|
|||
|
|
zjje1 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count2"]);
|
|||
|
|
zjje2 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count3"]);
|
|||
|
|
zjje3 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count4"]);
|
|||
|
|
zjje4 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count5"]);
|
|||
|
|
zjje5 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count6"]);
|
|||
|
|
}
|
|||
|
|
Ds.Clear();
|
|||
|
|
if (zjhm == 1)
|
|||
|
|
{
|
|||
|
|
zjje = zjje1;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 2)
|
|||
|
|
{
|
|||
|
|
zjje = zjje2;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 3)
|
|||
|
|
{
|
|||
|
|
zjje = zjje3;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 4)
|
|||
|
|
{
|
|||
|
|
zjje = zjje4;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 5)
|
|||
|
|
{
|
|||
|
|
zjje = zjje5;
|
|||
|
|
}
|
|||
|
|
if (Convert.ToDouble(jcje.ToString("f2")) > Convert.ToDouble(zjje.ToString("f2")))
|
|||
|
|
{
|
|||
|
|
Model.User_zhongjiang mzj = new Model.User_zhongjiang();
|
|||
|
|
mzj.cjqId = cjqid;
|
|||
|
|
mzj.zjdj = zjhm;
|
|||
|
|
mzj.zjje = zjje;
|
|||
|
|
mzj.addtime = DateTime.Now;
|
|||
|
|
mzj.MemberId = MemberId;
|
|||
|
|
mzj.utype = utype;
|
|||
|
|
daozj.Add(mzj);
|
|||
|
|
|
|||
|
|
Double money = zjje;
|
|||
|
|
Double umoney12 = (umodel.umoney12 - umodel.umoney22);
|
|||
|
|
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = MemberId;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = money;
|
|||
|
|
mjl2.Cutmoney = 0;
|
|||
|
|
mjl2.Totalmoney = umoney12 + money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "现金抽奖中奖金额";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 2;
|
|||
|
|
mjl2.utype2 = 0;
|
|||
|
|
mjl2.Seef = -1;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
new DAL.user_info().UpdateMoney("umoney12", money, MemberId);
|
|||
|
|
daocjq.Updateyqjcs(1, MemberId, utype, cjqid);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount("count1", -zjje, 5);
|
|||
|
|
context.Response.Write("恭喜您抽中" + Mtxfw.Utility.Common.czjhm(zjhm.ToString()) + "等奖,获得了" + zjje + "元|" + zjhm);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("奖池里的钱已经被抽完了,明天早点来吧,^-^" + zjje);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("抽奖权错误" + cjId);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您今日的抽奖权已经用完了,明天再来吧,^-^");
|
|||
|
|
}
|
|||
|
|
ds.Clear();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
int CJQCount = 0;
|
|||
|
|
string strCJQCount = new DAL.user_info().Getzd("(umoney30-umoney31) as umoney30", "UserState='正常' And ID=" + MemberId).ToString();
|
|||
|
|
if (strCJQCount != "")
|
|||
|
|
{
|
|||
|
|
CJQCount = Convert.ToInt32(strCJQCount.Split('.')[0]);
|
|||
|
|
}
|
|||
|
|
string strxfje = new DAL.choujiang().Getzd("xfje", "utype=" + utype).ToString();
|
|||
|
|
Double xfje = 0;
|
|||
|
|
if (strxfje != "")
|
|||
|
|
{
|
|||
|
|
xfje = Convert.ToDouble(strxfje);
|
|||
|
|
}
|
|||
|
|
int KYCJQCount = int.Parse((CJQCount / xfje).ToString().Split('.')[0].Replace(",", ""));
|
|||
|
|
if (KYCJQCount > 0)
|
|||
|
|
{
|
|||
|
|
if (daozj.GetCount("utype=" + utype + " And MemberId=" + MemberId + " And DateDiff(day,addtime,getdate())=0") == 0)
|
|||
|
|
{
|
|||
|
|
Model.choujiang cjm = daocj.GetModel(5);
|
|||
|
|
if (cjm != null)
|
|||
|
|
{
|
|||
|
|
int cjqcount1 = cjm.kzjzs1;
|
|||
|
|
int cjqcount2 = cjm.kzjzs2;
|
|||
|
|
int cjqcount3 = cjm.kzjzs3;
|
|||
|
|
int cjqcount4 = cjm.kzjzs4;
|
|||
|
|
int cjqcount5 = cjm.kzjzs5;
|
|||
|
|
string Vchar = "";
|
|||
|
|
if (cjqcount1 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",1";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount2 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "2";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",2";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount3 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "3";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",3";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount4 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "4";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",4";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (cjqcount5 > 0)
|
|||
|
|
{
|
|||
|
|
if (Vchar == "")
|
|||
|
|
{
|
|||
|
|
Vchar += "5";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Vchar += ",5";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string strzjhm = RandNum_CJ(1, Vchar);
|
|||
|
|
if (strzjhm == "")
|
|||
|
|
{
|
|||
|
|
strzjhm = "1";
|
|||
|
|
}
|
|||
|
|
int zjhm = int.Parse(strzjhm);
|
|||
|
|
Double zjje = 0, jcje = 0, zjje1 = 0, zjje2 = 0, zjje3 = 0, zjje4 = 0, zjje5 = 0;
|
|||
|
|
System.Data.DataSet Ds = new Mtxfw.DAL.user_jjfp().GetList("", "TType=6");
|
|||
|
|
|
|||
|
|
if (Ds.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
jcje = Convert.ToDouble(Ds.Tables[0].Rows[0]["count1"]);
|
|||
|
|
zjje1 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count2"]);
|
|||
|
|
zjje2 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count3"]);
|
|||
|
|
zjje3 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count4"]);
|
|||
|
|
zjje4 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count5"]);
|
|||
|
|
zjje5 = Convert.ToDouble(Ds.Tables[0].Rows[0]["count6"]);
|
|||
|
|
}
|
|||
|
|
Ds.Clear();
|
|||
|
|
if (zjhm == 1)
|
|||
|
|
{
|
|||
|
|
zjje = zjje1;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 2)
|
|||
|
|
{
|
|||
|
|
zjje = zjje2;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 3)
|
|||
|
|
{
|
|||
|
|
zjje = zjje3;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 4)
|
|||
|
|
{
|
|||
|
|
zjje = zjje4;
|
|||
|
|
}
|
|||
|
|
else if (zjhm == 5)
|
|||
|
|
{
|
|||
|
|
zjje = zjje5;
|
|||
|
|
}
|
|||
|
|
if (Convert.ToDouble(jcje.ToString("f2")) > Convert.ToDouble(zjje.ToString("f2")))
|
|||
|
|
{
|
|||
|
|
Model.User_zhongjiang mzj = new Model.User_zhongjiang();
|
|||
|
|
mzj.cjqId = 0;
|
|||
|
|
mzj.zjdj = zjhm;
|
|||
|
|
mzj.zjje = zjje;
|
|||
|
|
mzj.addtime = DateTime.Now;
|
|||
|
|
mzj.MemberId = MemberId;
|
|||
|
|
mzj.utype = utype;
|
|||
|
|
daozj.Add(mzj);
|
|||
|
|
|
|||
|
|
Double money = 10;
|
|||
|
|
Double umoney30 = (umodel.umoney30 - umodel.umoney31);
|
|||
|
|
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = MemberId;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = 0;
|
|||
|
|
mjl2.Cutmoney = -money;
|
|||
|
|
mjl2.Totalmoney = umoney30 - money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "积分抽奖扣除积分";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 1;
|
|||
|
|
mjl2.utype2 = 0;
|
|||
|
|
mjl2.Seef = -1;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
new DAL.user_info().UpdateMoney("umoney31", 10, MemberId);
|
|||
|
|
|
|||
|
|
umoney30 -= money;
|
|||
|
|
money = zjje;
|
|||
|
|
mjl2 = new Model.user_Results_jl2();
|
|||
|
|
mjl2.MemberId = MemberId;
|
|||
|
|
mjl2.MemberId2 = 0;
|
|||
|
|
mjl2.Addmoney = money;
|
|||
|
|
mjl2.Cutmoney = 0;
|
|||
|
|
mjl2.Totalmoney = umoney30 + money;
|
|||
|
|
mjl2.addtime = DateTime.Now;
|
|||
|
|
mjl2.BZContent = "积分抽奖中奖积分";
|
|||
|
|
mjl2.PayID = "";
|
|||
|
|
mjl2.OrdersIDs = "";
|
|||
|
|
mjl2.OrdersID = 0;
|
|||
|
|
mjl2.utype = 1;
|
|||
|
|
mjl2.utype2 = 0;
|
|||
|
|
mjl2.Seef = -1;
|
|||
|
|
mjl2.seeftime = DateTime.Now;
|
|||
|
|
new DAL.user_Results_jl2().Add(mjl2);
|
|||
|
|
new DAL.user_info().UpdateMoney("umoney30", money, MemberId);
|
|||
|
|
new Mtxfw.DAL.user_jjfp().Updatecount("count2", -zjje, 5);
|
|||
|
|
context.Response.Write("恭喜您抽中" + Mtxfw.Utility.Common.czjhm(zjhm.ToString()) + "等奖,获得了" + zjje + "积分|" + zjhm);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("积分奖池里的积分已经被抽完了,明天早点来吧,^-^");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您今日已经抽奖过了,明天再来试吧,^-^");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您的积分不足了,赶紧消费吧,^-^");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
context.Response.Write("您未登录");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin0.txt", ex.ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 生成指定位数的随机数
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="VcodeNum">参数是随机数的位数</param>
|
|||
|
|
/// <returns>返回一个随机数字符串</returns>
|
|||
|
|
private string RandNum_CJ(int VcodeNum, string Vchar)
|
|||
|
|
{
|
|||
|
|
string[] VcArray = Vchar.Split(','); //拆分成数组
|
|||
|
|
string VNum = "";
|
|||
|
|
Random random = new Random();
|
|||
|
|
for (int i = 0; i < VcArray.Length; i++)
|
|||
|
|
{
|
|||
|
|
VNum = VcArray[random.Next(VcArray.Length)];
|
|||
|
|
}
|
|||
|
|
return VNum;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
public bool IsReusable { get { return false; } }
|
|||
|
|
}
|
|||
|
|
}
|