326 lines
19 KiB
C#
326 lines
19 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
namespace Mtxfw.VipSite
|
|
{
|
|
public partial class Admin_Member_PFQSGL : Mtxfw.Utility.MemberBase
|
|
{
|
|
Mtxfw.DAL.user_Results_jl3 daojl3 = new Mtxfw.DAL.user_Results_jl3();
|
|
Mtxfw.DAL.user_jjfp daojjfp = new Mtxfw.DAL.user_jjfp();
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
|
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
|
Mtxfw.DAL.user_Results_jl2 daojl2 = new Mtxfw.DAL.user_Results_jl2();
|
|
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
|
public int gtype = 0;
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
string hostname = Request.Url.Host;
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
if (Session["IFPassword"] == null)
|
|
{
|
|
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_PFQSGL.aspx");
|
|
}
|
|
if (IFStores != 1)
|
|
{
|
|
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
|
}
|
|
if (MemberJS.IndexOf("批发期数管理") == -1)
|
|
{
|
|
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
|
}
|
|
Page.Title = "批发期数管理 - " + GetWebName;
|
|
|
|
Data_Bind();
|
|
|
|
|
|
}
|
|
|
|
MyPager.PageChanged += delegate(object s, EventArgs ex)
|
|
{
|
|
Data_Bind();
|
|
};
|
|
}
|
|
|
|
protected void Data_Bind()
|
|
{
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
String SJ = Request.QueryString["SJ"];
|
|
String SJ2 = Request.QueryString["SJ2"];
|
|
|
|
if (!String.IsNullOrEmpty(SJ) && !String.IsNullOrEmpty(SJ2))
|
|
{
|
|
sb.Append(" and (addweektime1>=Convert(DateTime,'" + SJ + " 00:00:00') and addweektime2<=Convert(DateTime,'" + SJ2 + " 23:59:59'))");
|
|
}
|
|
|
|
string strOrder = " Order By addweek desc";
|
|
MyPager.PageSize = 20;
|
|
MyPager.RecordCount = daojjfp.GetCount("gtype=" + gtype + " and TType=6" + sb.ToString());
|
|
Mtxfw.Utility.Tools.ToBind(Repeater1, daojjfp.GetPager(MyPager, "", "gtype=" + gtype + " and TType=6" + sb.ToString() + strOrder));
|
|
|
|
}
|
|
protected void Run_Click(object s, System.EventArgs e)
|
|
{
|
|
|
|
CheckBox Check = new CheckBox();
|
|
int intvalue = Convert.ToInt32(seclect_Drop.SelectedItem.Value);
|
|
string strtext = seclect_Drop.SelectedItem.Text;
|
|
foreach (RepeaterItem Item in Repeater1.Items)
|
|
{
|
|
//在行中查找到该单选框
|
|
Check = (CheckBox)Item.FindControl("checka");
|
|
int strID = int.Parse(Check.CssClass);
|
|
if (Check.Checked == true)
|
|
{
|
|
if (intvalue == 0 || intvalue == 1 || intvalue == 4)
|
|
{
|
|
daojjfp.Updateaddmonth(intvalue, strID);
|
|
|
|
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
|
logmodel.MemberId = Card;
|
|
logmodel.AddTime = DateTime.Now;
|
|
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
|
logmodel.Body = strtext + daojjfp.Getzd("addweek", "id=" + strID).ToString() + "期";
|
|
logmodel.UType = 0;
|
|
logmodel.gtype = gtype;
|
|
new DAL.User_CZ_log().Add(logmodel);
|
|
}
|
|
else if (intvalue == 3)
|
|
{
|
|
daojjfp.Updateaddmonth(intvalue, strID);
|
|
int addweek=Convert.ToInt32(daojjfp.Getzd("addweek", "id=" + strID).ToString());
|
|
DateTime dt = DateTime.Now;
|
|
DataSet ds2 = daoorder.GetList1("id,UserId,Totalnum,pcount,ypcount,ypznum,Totalprice,Totalprice5,Totalprice7", "gtype=" + gtype + " and ttype=2 and ptype=1 And IFDelete=0 and poid=" + addweek + " and O_Seef=0 Order By O_Payed_Date Asc");
|
|
if (ds2.Tables[0].Rows.Count > 0)
|
|
{
|
|
foreach (System.Data.DataRow Dr2 in ds2.Tables[0].Rows)
|
|
{
|
|
Int32 OrderId = Convert.ToInt32(Dr2["id"]);
|
|
int UserId = Convert.ToInt32(Dr2["UserId"]);
|
|
int Totalnum = Convert.ToInt32(Dr2["Totalnum"]);
|
|
int pcount = Convert.ToInt32(Dr2["pcount"]);
|
|
int ypcount = Convert.ToInt32(Dr2["ypcount"]);
|
|
int ypznum = Convert.ToInt32(Dr2["ypznum"]);
|
|
Double Totalprice = Convert.ToDouble(Convert.ToDouble(Dr2["Totalprice"]).ToString("f2"));
|
|
Double Totalprice5 = Convert.ToDouble(Convert.ToDouble(Dr2["Totalprice5"]).ToString("f2"));
|
|
Double Totalprice7 = Convert.ToDouble(Convert.ToDouble(Dr2["Totalprice7"]).ToString("f2"));
|
|
daoorder.UpdateSeef(1, dt.ToString(), OrderId);
|
|
daoorder.UpdateqyState(0, "6", dt, OrderId);
|
|
int cenum = (Totalnum - ypznum);
|
|
if (cenum > 0)
|
|
{
|
|
daoorder.Updatesel("ypznum", cenum, OrderId);
|
|
daoorder.Updatesel("ifxnhy", cenum, OrderId);
|
|
if (pcount > 0)
|
|
{
|
|
daoorder.Updatesel("ifxnhy", -pcount, OrderId);
|
|
daoorder.Updatesel("pcount", -pcount, OrderId);
|
|
}
|
|
if (ypcount > 0)
|
|
{
|
|
daoorder.Updatesel("ifxnhy", -ypcount, OrderId);
|
|
daoorder.Updatesel("ypcount", -ypcount, OrderId);
|
|
}
|
|
Double xjmoney = Convert.ToDouble((Totalprice / Totalnum * cenum).ToString("f2"));
|
|
Double jzjfmoney = Convert.ToDouble((Totalprice5 / Totalnum * cenum).ToString("f2"));
|
|
Double usdtmoney = Convert.ToDouble((Totalprice7 / Totalnum * cenum).ToString("f2"));
|
|
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(UserId);
|
|
if (umodel != null)
|
|
{
|
|
Model.user_Results_jl2 mjl2;
|
|
if (usdtmoney > 0.00)
|
|
{
|
|
mjl2 = new Model.user_Results_jl2();
|
|
mjl2.MemberId = umodel.Id;
|
|
mjl2.MemberId2 = 0;
|
|
mjl2.Addmoney = usdtmoney;
|
|
mjl2.Cutmoney = 0;
|
|
mjl2.Totalmoney = (umodel.umoney32 + usdtmoney);
|
|
mjl2.addtime = dt;
|
|
mjl2.BZContent = "退货";
|
|
mjl2.PayID = "";
|
|
mjl2.OrdersIDs = "";
|
|
mjl2.OrdersID = 0;
|
|
mjl2.utype = 4;
|
|
mjl2.utype2 = 0;
|
|
mjl2.Seef = -1;
|
|
mjl2.seeftime = dt;
|
|
mjl2.gtype = gtype;
|
|
daojl2.Add(mjl2);
|
|
daoUser.UpdateMoney("umoney32", usdtmoney, umodel.Id);
|
|
}
|
|
else
|
|
{
|
|
if (jzjfmoney > 0.00)
|
|
{
|
|
Double zljfmoney = Convert.ToDouble((xjmoney - jzjfmoney).ToString("f2"));
|
|
mjl2 = new Model.user_Results_jl2();
|
|
mjl2.MemberId = umodel.Id;
|
|
mjl2.MemberId2 = 0;
|
|
mjl2.Addmoney = jzjfmoney;
|
|
mjl2.Cutmoney = 0;
|
|
mjl2.Totalmoney = (umodel.umoney30 + jzjfmoney);
|
|
mjl2.addtime = dt;
|
|
mjl2.BZContent = "退货";
|
|
mjl2.PayID = "";
|
|
mjl2.OrdersIDs = "";
|
|
mjl2.OrdersID = 0;
|
|
mjl2.utype = 2;
|
|
mjl2.utype2 = 0;
|
|
mjl2.Seef = -1;
|
|
mjl2.seeftime = dt;
|
|
mjl2.gtype = gtype;
|
|
daojl2.Add(mjl2);
|
|
daoUser.UpdateMoney("umoney30", jzjfmoney, umodel.Id);
|
|
if (zljfmoney > 0.00)
|
|
{
|
|
mjl2 = new Model.user_Results_jl2();
|
|
mjl2.MemberId = umodel.Id;
|
|
mjl2.MemberId2 = 0;
|
|
mjl2.Addmoney = zljfmoney;
|
|
mjl2.Cutmoney = 0;
|
|
mjl2.Totalmoney = (umodel.umoney22 + zljfmoney);
|
|
mjl2.addtime = dt;
|
|
mjl2.BZContent = "退货";
|
|
mjl2.PayID = "";
|
|
mjl2.OrdersIDs = "";
|
|
mjl2.OrdersID = 0;
|
|
mjl2.utype = 0;
|
|
mjl2.utype2 = 0;
|
|
mjl2.Seef = -1;
|
|
mjl2.seeftime = dt;
|
|
mjl2.gtype = gtype;
|
|
daojl2.Add(mjl2);
|
|
daoUser.UpdateMoney("umoney22", zljfmoney, umodel.Id);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mjl2 = new Model.user_Results_jl2();
|
|
mjl2.MemberId = umodel.Id;
|
|
mjl2.MemberId2 = 0;
|
|
mjl2.Addmoney = xjmoney;
|
|
mjl2.Cutmoney = 0;
|
|
mjl2.Totalmoney = (umodel.umoney30 + xjmoney);
|
|
mjl2.addtime = dt;
|
|
mjl2.BZContent = "退货";
|
|
mjl2.PayID = "";
|
|
mjl2.OrdersIDs = "";
|
|
mjl2.OrdersID = 0;
|
|
mjl2.utype = 2;
|
|
mjl2.utype2 = 0;
|
|
mjl2.Seef = -1;
|
|
mjl2.seeftime = dt;
|
|
mjl2.gtype = gtype;
|
|
daojl2.Add(mjl2);
|
|
daoUser.UpdateMoney("umoney30", xjmoney, umodel.Id);
|
|
}
|
|
}
|
|
Double jjmoney = Convert.ToDouble((xjmoney * Convert.ToDouble(config.webMoney30) / 100).ToString("f2"));
|
|
if (jjmoney > 0.00)
|
|
{
|
|
mjl2 = new Model.user_Results_jl2();
|
|
mjl2.MemberId = umodel.Id;
|
|
mjl2.MemberId2 = 0;
|
|
mjl2.Addmoney = jjmoney;
|
|
mjl2.Cutmoney = 0;
|
|
mjl2.Totalmoney = (umodel.umoney30 + jjmoney);
|
|
mjl2.addtime = dt;
|
|
mjl2.BZContent = "进货补助";
|
|
mjl2.PayID = "";
|
|
mjl2.OrdersIDs = "";
|
|
mjl2.OrdersID = 0;
|
|
mjl2.utype = 2;
|
|
mjl2.utype2 = 0;
|
|
mjl2.Seef = -1;
|
|
mjl2.seeftime = dt;
|
|
mjl2.gtype = gtype;
|
|
daojl2.Add(mjl2);
|
|
daoUser.UpdateMoney("umoney30", jjmoney, umodel.Id);
|
|
}
|
|
jjmoney = Convert.ToDouble((xjmoney * Convert.ToDouble(config.webMoney23) / 100).ToString("f2"));
|
|
if (jjmoney > 0.00)
|
|
{
|
|
mjl2 = new Model.user_Results_jl2();
|
|
mjl2.MemberId = umodel.Id;
|
|
mjl2.MemberId2 = 0;
|
|
mjl2.Addmoney = jjmoney;
|
|
mjl2.Cutmoney = 0;
|
|
mjl2.Totalmoney = (umodel.umoney22 + jjmoney);
|
|
mjl2.addtime = dt;
|
|
mjl2.BZContent = "进货补助";
|
|
mjl2.PayID = "";
|
|
mjl2.OrdersIDs = "";
|
|
mjl2.OrdersID = 0;
|
|
mjl2.utype = 0;
|
|
mjl2.utype2 = 0;
|
|
mjl2.Seef = -1;
|
|
mjl2.seeftime = dt;
|
|
mjl2.gtype = gtype;
|
|
daojl2.Add(mjl2);
|
|
daoUser.UpdateMoney("umoney22", jjmoney, umodel.Id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ds2.Clear();
|
|
daoorder.UpdateIFDelete1(1, dt.ToString(), addweek);
|
|
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
|
logmodel.MemberId = Card;
|
|
logmodel.AddTime = DateTime.Now;
|
|
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
|
logmodel.Body = strtext + addweek + "期";
|
|
logmodel.UType = 0;
|
|
logmodel.gtype = gtype;
|
|
new DAL.User_CZ_log().Add(logmodel);
|
|
}
|
|
else if (intvalue == 5)
|
|
{
|
|
TextBox addweektime = (TextBox)Item.FindControl("addweektime");
|
|
TextBox txtcount1 = (TextBox)Item.FindControl("txtcount1");
|
|
txtcount1.Text = txtcount1.Text.Trim();
|
|
if (!System.Text.RegularExpressions.Regex.IsMatch(txtcount1.Text, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(txtcount1.Text, @"^-?\d+$"))
|
|
{
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('总额度格式填写错误!');</script>");
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
|
|
DateTime addweektime1 = Convert.ToDateTime(addweektime.Text);
|
|
DateTime addweektime2 = addweektime1.AddDays(Convert.ToInt32(config.webMoney4));
|
|
if (config.webMoney46 == "hour")
|
|
{
|
|
addweektime2 = addweektime1.AddHours(Convert.ToInt32(config.webMoney4));
|
|
}
|
|
daojjfp.Updateaddweektime(addweektime1, addweektime2, strID);
|
|
daojjfp.Updatecount1("count1", Convert.ToDouble(txtcount1.Text), strID);
|
|
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
|
logmodel.MemberId = Card;
|
|
logmodel.AddTime = DateTime.Now;
|
|
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
|
logmodel.Body = strtext + daojjfp.Getzd("addweek", "id=" + strID).ToString() + "期";
|
|
logmodel.UType = 0;
|
|
logmodel.gtype = gtype;
|
|
new DAL.User_CZ_log().Add(logmodel);
|
|
}
|
|
catch
|
|
{
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('时间格式填写错误!');</script>");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Data_Bind();
|
|
}
|
|
}
|
|
} |