Files
g.hnyhua.cn/Mtxfw.VipSite/Admin_Member_renwu_gl.aspx.cs

310 lines
16 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
namespace Mtxfw.VipSite
{
public partial class Admin_Member_renwu_gl : Mtxfw.Utility.MemberBase
{
Mtxfw.DAL.user_bank daoBank = new Mtxfw.DAL.user_bank();
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.DAL.user_Results_jl2 daojl2 = new Mtxfw.DAL.user_Results_jl2();
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
public Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
public string strTitle = "未审核任务列表";
public int t = 0;
public int gtype = 0;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string hostname = Request.Url.Host;
if (!String.IsNullOrEmpty(Request.QueryString["t"]))
{
t = Convert.ToInt32(Request.QueryString["t"].ToString());
}
if (t == 1)
{
strTitle = "已完成任务列表";
}
if (!IsPostBack)
{
if (Session["IFPassword"] == null)
{
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_renwu_gl.aspx");
}
if (IFStores != 1)
{
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
}
if (MemberJS.IndexOf("任务管理") == -1)
{
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
}
Page.Title = strTitle + " - " + GetWebName;
Data_Bind();
if (t == 0)
{
seclect_Drop.Items.Add(new ListItem("审核通过", "0"));
seclect_Drop.Items.Add(new ListItem("审核不合格", "1"));
seclect_Drop.Items.Add(new ListItem("删除", "2"));
}
else
{
seclect_Drop.Items.Add(new ListItem("删除", "2"));
}
}
MyPager.PageChanged += delegate(object s, EventArgs ex)
{
Data_Bind();
};
}
protected void Data_Bind()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
String MemberId = Request.QueryString["MemberId"];
String key = Request.QueryString["key"];
String SJ = Request.QueryString["SJ"];
String SJ2 = Request.QueryString["SJ2"];
sb.Append("gtype=" + gtype + " and utype=6");
sb.Append(" and IFDelete=0");
if (t == 1)
{
sb.Append(" and seef=2");
}
else
{
sb.Append(" and seef<>2");
}
if (!String.IsNullOrEmpty(SJ) && !String.IsNullOrEmpty(SJ2))
{
sb.Append("and (addtime between '" + SJ + " 00:00:00' and '" + SJ2 + " 23:59:59') ");
}
if (!String.IsNullOrEmpty(MemberId))
{
sb.Append(" and MemberId=" + MemberId);
}
if (!String.IsNullOrEmpty(key))
{
key = key.Trim();
sb.Append(" and MemberId=(Select id from user_info b where b.UserName='" + key + "')");
}
string groupby = "";
string strOrder = "addtime desc";
int Start = 0;
int Limit = 0;
Int32 Recount = 0;
MyPager.PageSize = 100;
Start = MyPager.PageSize * (MyPager.CurrentPageIndex - 1);
Limit = MyPager.PageSize;
DataSet dss = daoResults.GetDataSet(groupby, strOrder, "id,MemberId,conent,Managers,LDR,addtime,Seef,b1,hasRead,ListNumber,(Select UserName From user_info b Where b.Id=MemberId) as MemberName,(Select realname From user_info b Where b.Id=MemberId) as realname,(Select title From Article b Where b.Id=tbl.hasRead) as title,(Select c.content From Article c Where c.Id=tbl.Sended) as jdconent", "", sb.ToString(), Start, Limit, out Recount);
Mtxfw.Utility.Tools.ToBind(Repeater1, dss.Tables[1]);
MyPager.RecordCount = Recount;
if (MyPager.RecordCount == 0)
{
MyPager.Visible = false;
}
}
protected void Run_Click(object s, System.EventArgs e)
{
CheckBox Check = new CheckBox();
string strs = seclect_Drop.SelectedItem.Value;
foreach (RepeaterItem Item in Repeater1.Items)
{
//在行中查找到该单选框
Check = (CheckBox)Item.FindControl("checka");
Int64 strID = Int64.Parse(Check.CssClass);
if (Check.Checked == true)
{
Mtxfw.Model.user_Results mr = daoResults.GetModel(strID);
if (mr != null)
{
string atitle = daoArt.Getzd("title", "gtype=" + gtype + " and parentid=18 and Id=" + mr.hasRead).ToString();
if (strs == "0")
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId);
if (umodel != null)
{
DateTime dt = DateTime.Now;
daoResults.UpdateSeef(2, dt, strID);
bool IFJS = true;
DataSet ds = daoArt.GetList1("id,(select top 1 b.seef from user_Results b where b.utype=6 And b.IFDelete=0 And b.MemberId=" + umodel.Id + " and b.hasRead=" + mr.hasRead + " and b.Sended=convert(varchar(50),a.id) and b.ListNumber='" + mr.ListNumber + "') as seef", "gtype=" + gtype + " and parentid=16 And categoryid='" + mr.hasRead + "'");
if (ds.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int G_ID = int.Parse(Dr["id"].ToString());
string seef = Dr["seef"].ToString();
if(seef != "2")
{
IFJS = false;
}
}
}
ds.Clear();
if (IFJS)
{
daoResults.UpdateSeef(2, dt, Convert.ToInt64(mr.ListNumber));
Double money = mr.b0;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney29 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "完成任务";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 3;
mjl2.utype2 = 0;
mjl2.Seef = 0;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney29", money, umodel.Id);
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "任务进度通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/renwu-ico.png";
amodel.Content = "您的任务【" + atitle + "】已完成";
amodel.Paths = "myrenwu_uploadpic.html";
amodel.Content2 = "";
amodel.Paths2 = mr.ListNumber;
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 5;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = daoArt.Add(amodel).ToString();
if (umodel.registrationId != "")
{
List<string> RegistrationIDList = new List<string>();
RegistrationIDList.Add(umodel.registrationId);
string title = amodel.Title;
string strMsg = amodel.Content;
bool is_production = true;
string strLog = "";
new Jiguang.JPush.JPushV3().SendPushV2(RegistrationIDList, title, dataid, strMsg, is_production, out strLog);
}
}
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 = "审核通过" + atitle + "ID为" + strID + ",用户名为" + umodel.UserName + ",时间为" + mr.addtime;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
if (strs == "1")
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId);
if (umodel != null)
{
daoResults.UpdateSeef(1, DateTime.Now, 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 = "审核不合格" + atitle + "ID为" + strID + ",用户名为" + umodel.UserName + ",时间为" + mr.addtime;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "任务进度通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/renwu-ico.png";
amodel.Content = "您的任务【" + atitle + "】有内容审核不合格";
amodel.Paths = "myrenwu_uploadpic.html";
amodel.Content2 = "";
amodel.Paths2 = mr.ListNumber;
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 5;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = daoArt.Add(amodel).ToString();
if (umodel.registrationId != "")
{
List<string> RegistrationIDList = new List<string>();
RegistrationIDList.Add(umodel.registrationId);
string title = amodel.Title;
string strMsg = amodel.Content;
bool is_production = true;
string strLog = "";
new Jiguang.JPush.JPushV3().SendPushV2(RegistrationIDList, title, dataid, strMsg, is_production, out strLog);
}
}
}
if (strs == "2")
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId);
if (umodel != null)
{
daoResults.UpdateIFDelete(1, DateTime.Now.ToString(), 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 = "删除" + atitle + "ID为" + strID + ",用户名为" + umodel.UserName + ",时间为" + mr.addtime;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
public string getpics(string pics)
{
string returnpics = "";
string[] apic = pics.Split('|');
foreach (string pic in apic)
{
if (pic != "")
{
string strpic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "100x100", "cut");
returnpics += "<a href=\""+ pic.Split('|')[0] + "\" target=\"_blank\"><img src=\"" + strpic + "\" /></a>";
}
}
return returnpics;
}
}
}