public void Deal(int userReportID,int adminID,string adminName,string re,byte jiangliType) { bool giveJiangli = false ; bizUsers bu = new bizUsers(); bizUserMsg bum = new bizUserMsg(); UserReports model = Get(userReportID); Users modelUser = bu.Get(model.UserID); model.Attach(); model.AdminID = adminID; model.AdminName = adminName; model.AdminRe = re; if (model.JiangliType == 0) { giveJiangli = true; model.JiangliType = jiangliType; } model.ReTime = DateTime.Now; model.Detach(); Update(model); if (giveJiangli == true) { if (model.JiangliType == 1) { modelUser.Attach(); modelUser.Jinbi += 200; modelUser.Detach(); bu.Update(modelUser); bum.AddSysMsg(model.UserID, "因为你的举报,系统奖励了你200吧币。"); } if (model.JiangliType == 2) { bizUserXCard buc = new bizUserXCard(); buc.AddCard(model.UserID, "bigqiqiu", 1); bum.AddSysMsg(model.UserID, "因为你的举报,系统奖励了你1张强化气球卡。"); } } }
public ActionResult JulinjuShifang() { int userID = UserID; bizUsers bu = new bizUsers(); Users model = bu.Get(userID); int currValue = 0; if (SZXX.Common.Untilies.UserCommon.JulinzhuIsToday(model.JulinzhuDate)) { model.Attach(); currValue = (int)model.JulinzhuCurrValue; model.Jingyan += currValue; model.JulinzhuMaxValue -= currValue; if (model.JulinzhuMaxValue < 0) model.JulinzhuMaxValue = 0; model.Detach(); bu.Update(model); Users model1 = bu.Get(model.UserID); model1.Attach(); model1.JulinzhuCurrValue = 0; model1.Detach(); bu.Update(model1); return Content("���Ѿ�����Ӿ������л��" + currValue + "�㾭�顣"); } else { return Content("��ľ����黹û�б������"); } }
/// <summary> /// 用户签名的上传 /// </summary> /// <param name="userID"></param> /// <param name="basePath"></param> /// <param name="files"></param> /// <param name="fileTypes"></param> /// <param name="imagePath"></param> /// <returns></returns> public static string ImageUpOfQianming(int userID, HttpPostedFileBase files, Enumerations.ImageUseType fileTypes, out string imagePath) { string basePath = ConfigurationManager.AppSettings["ImagePath"]; string imageDomain = ConfigurationManager.AppSettings["ImageDomain"]; imagePath = ""; bizUsers b = new bizUsers(); Users model = b.Get(userID); DateTime nowDate = DateTime.Now; string extName = MyText.GetFileExtName(files.FileName); if (MyText.IsImage(extName) == false) { return "文件类型不符合"; } if (files.ContentLength > 1024 * 20) { return "签名照片已超过20K,不能上传"; } System.Drawing.Image image = System.Drawing.Image.FromStream(files.InputStream); if (image.Width > 300 || image.Height > 300) { return "头像图片已经超过最大尺寸:300×300(象素)"; } try { System.IO.File.Delete(basePath + model.Images); } catch { ; } try { string filePath = "/userfiles/profile/" + nowDate.Year + "/" + nowDate.Month + "/" + nowDate.Day; string fileName = "user" + model.UserID + "." + extName; string imageUrl = imageDomain + filePath + "/" + fileName; filePath = basePath + filePath; System.IO.Directory.CreateDirectory(filePath); files.SaveAs(filePath + "/" + fileName); model.Attach(); model.Images = imageUrl; model.Detach(); b.Update(model); imagePath = imageUrl; } catch (Exception e) { return e.Message; } return ""; }
public ActionResult qidApply(FormCollection f) { ViewData["CurrMenu"] = "QID����"; int userID = UserID; ViewData["Remark"] = f["Remark"].Trim(); bizUsers bu = new bizUsers(); bizUserQID b = new bizUserQID(); Users modelU = bu.Get(f["QIDUserName"].Trim()); if (f["QIDUserName"].Trim() == "") { TempData["Msg"] = "�û�������Ϊ��"; return View(); } if (modelU == null) { TempData["Msg"]="���û�������"; return View(); } if (modelU.UserID == userID) { TempData["Msg"] = "���������Լ�"; return View(); } Users modelMy = bu.Get(userID); if (modelMy.Jinbi < 5000) { TempData["Msg"] = "��İɱҲ���"; return View(); } if (modelMy.Score-modelMy.UsedScore<2) { TempData["Msg"] = "��Ļ��ֲ���"; return View(); } UserQID modelQiding = b.GetIngByAllUserID(modelU.UserID); if (modelQiding != null) { TempData["Msg"] = "�Է��Ѿ��������ˣ��㲻���ٷ������롣"; return View(); } UserQID modelQidingMy = b.GetIngByAllUserID(userID); if (modelQidingMy != null) { TempData["Msg"] = "���Ѿ������˱��˻������룬�����ٷ������롣"; return View(); } UserQID modelQid = b.GetByUserID(modelU.UserID); if (modelQid != null) { TempData["Msg"] = "���ź����Է��Ѿ�����QID��"; return View(); } UserQID model = new UserQID(); model.User1ID = userID; model.User2ID = modelU.UserID; model.Remark = f["Remark"].Trim(); model.Status = 0; model.AddTime = DateTime.Now; b.Add(model); modelMy.Attach(); modelMy.Jinbi -= 5000; modelMy.UsedScore += 2; modelMy.Detach(); bu.Update(modelMy); (new bizUserMsg()).AddSysMsg(modelU.UserID, "�û� [b]" + UserName + "[/b] ���㷢����QID���룬[url=/useractive/qidapply.html]ǰȥ������[/url]��"); TempData["Msg"] = "�����Ѿ������������ĵȴ��Է��Ĵɡ�"; return RedirectToAction("qidApplyIng"); }
/// <summary> /// ��QID����Ĵ��� /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult qidApplydealing(int id) { ViewData["CurrMenu"] = "QID����"; bizUsers b = new bizUsers(); bizUserQID buq = new bizUserQID(); UserQID model = buq.GetIngByUser2ID(UserID); Users user1 = b.Get(model.User1ID); Users user2 = b.Get(model.User2ID); if(model==null) return RedirectToAction("qidApply"); if (id == 1) { model.Attach(); model.PassTime = DateTime.Now; model.Status = 1; model.Detach(); buq.Update(model); user1.Attach(); user1.QID = user2.UserID; user1.Detach(); b.Update(user1); user2.Attach(); user2.QID = user1.UserID; user2.Detach(); b.Update(user2); (new bizUserMsg()).AddSysMsg(user1.UserID, "�û� [b]" + user2.UserName + "[/b] [color=red]�ѽ���[/color]��Ϊ���QID��������Ѱɶ�������ϵ�ף����"); (new bizBBSNotice()).Add("��ϲ " + user2.UserName + " �� " + user1.UserName + " ��ΪQID", DateTime.Now.AddHours(12)); TempData["Msg"] = "���Ѿ������� " + user2.UserName + " ��Ϊ���QID�����Ƚ����Ѱɶ�������ϵ�ף����"; return RedirectToAction("qidApplyed"); } if (id == 2) { model.Attach(); model.PassTime = DateTime.Now; model.Status = 2; model.Detach(); buq.Update(model); (new bizUserMsg()).AddSysMsg(user1.UserID, "�û� [b]" + user2.UserName + "[/b] [color=red]�Ѿܾ�[/color]��Ϊ���QID��"); TempData["Msg"] = "���Ѿ��ܾ��� " + user2.UserName + " ��Ϊ��/��QID�����롣"; } return RedirectToAction("qidApply"); }
public ActionResult qidApplyed(FormCollection f) { ViewData["CurrMenu"] = "QID����"; int userID = UserID; bizUsers b = new bizUsers(); bizUserQID buq = new bizUserQID(); Users user1 = b.Get(userID); UserQID model = buq.GetByUserID(userID); if (model == null) { TempData["Msg"] = "��û��QID��ȡ��˭�أ�"; return View(); } if (user1.Jinbi < 10000) { TempData["Msg"] = "��İɱҲ�����"; return View(); } if ((user1.Score-user1.UsedScore) < 5) { TempData["Msg"] = "��Ļ��ֲ�����"; return View(); } Users user2 = b.Get(user1.QID); model.Attach(); model.Status = 3; model.Detach(); buq.Update(model); user1.Attach(); user1.QID = null; user1.Jinbi -= 10000; user1.UsedScore += 5; user1.Detach(); b.Update(user1); user2.Attach(); user2.QID = null; user2.Detach(); b.Update(user2); return RedirectToAction("qidApply"); }
/// <summary> /// 修改主帖 /// </summary> /// <param name="bbsMainID"></param> /// <param name="typeDeID"></param> /// <param name="title"></param> /// <param name="content"></param> /// <param name="fileType"></param> /// <param name="filePath"></param> /// <param name="face"></param> /// <param name="isShowTag"></param> public string TopiceUpdate(int bbsMainID,int userID, int typeDeID, string title, string content,byte types, string face, byte isShowTag) { if (title == "") return "标题不能为空"; if (content.Trim() == "") return "内容不能为空"; BBSMain model = Get(bbsMainID); if (model == null) return "该帖不存在"; if (model.AddUser != userID) return "你无权修改该帖"; if (model.AddTime.AddDays(5) < DateTime.Now) { bizUsers bu = new bizUsers(); Users modelUser = bu.Get(userID); if (modelUser.Jinbi < 500) return "你的吧币不够,无法修改"; modelUser.Attach(); modelUser.Jinbi -= 500; modelUser.Detach(); bu.Update(modelUser); } model.Attach(); model.TypeDeID = typeDeID; model.Title = title; model.Types = types; //model.FileType = fileType; //model.FilePath = filePath; model.Face = face; model.IsShowTag = isShowTag; model.ModTime = DateTime.Now; model.Detach(); Update(model); dalInfoContent ic=new dalInfoContent(); InfoContent cModel = ic.Get(model.ContentID); cModel.Attach(); cModel.ContentType = 2; cModel.Content = content; cModel.Detach(); ic.Update(cModel); return ""; }
public ActionResult UserQMSet() { bizUsers bu = new bizUsers(); List<Users> list = bu.List(); foreach (var item in list) { Users model = bu.Get(item.UserID); model.Attach(); if(model.HeadImages!=null) model.HeadImages = model.HeadImages.Replace("/userfiles/profile", "http://img1.woxx8.com/userfiles/profile"); if (model.Images != null) model.Images = model.Images.Replace("/userfiles/profile", "http://img1.woxx8.com/userfiles/profile"); model.Detach(); bu.Update(model); } return View(); }
public string DeleteSelf(int bbsMainID,int userID) { BBSMain model = Get(bbsMainID); if (model == null) return "该帖不存在。"; if (userID != model.AddUser) return "你无权删除该帖子。"; //if (model.Score > 0) // return "该帖已加分,无法删除"; bizUsers bu = new bizUsers(); Users modelUser = bu.Get(userID); if (model.Score > 0) { if (modelUser.FactionID != 0) { return "该帖已加分。你身在部落,为了部落的利益,无法删除该帖。"; } else { modelUser.Jinbi -= 2000 * model.Score; if (modelUser.Jinbi < 0) return "你的吧币不够,无法删除"; } } if (model.AddTime.AddMinutes(10) < DateTime.Now) { if (modelUser.Jinbi < 1000) return "你的吧币不够,无法删除"; modelUser.Attach(); modelUser.Jinbi -= 1000; modelUser.Detach(); bu.Update(modelUser); } DeleteBySelf(bbsMainID); //model.Attach(); //model.DeleteType = 1; //model.Detach(); //Update(model); //(new bizUsers()).UpdateBBSNum((int)model.AddUser); return "自杀成功。"; }
/// <summary> /// 自己删除回复 /// </summary> /// <param name="bbsMainID"></param> /// <param name="bbsDeID"></param> /// <param name="user"></param> /// <param name="isDelete"></param> /// <returns></returns> public string DeleteDeBySelf(int bbsMainID, int bbsDeID, int userID, byte isDelete) { BBSDE model = Get(bbsMainID, bbsDeID); if (model == null) return "该帖不存在"; if (model.AddUser != userID) return "你无权修改该帖"; if (((DateTime)model.AddTime).AddDays(5) < DateTime.Now) { bizUsers bu = new bizUsers(); Users modelUser = bu.Get(model.AddUser); if (modelUser.Jinbi < 1000) return "你的吧币不够,无法修改"; modelUser.Attach(); modelUser.Jinbi -= 1000; modelUser.Detach(); bu.Update(modelUser); } model.Attach(); model.IsDelete = isDelete; model.Detach(); Update(model); return ""; }
public string Update(int bbsMainID,int bbsDeID,int userID,string content, string images, string face, byte isShowTag) { BBSDE model = Get(bbsMainID, bbsDeID); if (model == null) return "该帖不存在"; if (model.AddUser != userID) return "你无权修改该帖"; if (content.Trim() == "") return "内容不能为空"; if (((DateTime)model.AddTime).AddDays(5) < DateTime.Now) { bizUsers bu = new bizUsers(); Users modelUser = bu.Get(model.AddUser); if (modelUser.Jinbi < 500) return "你的吧币不够,无法修改"; modelUser.Attach(); modelUser.Jinbi -= 500; modelUser.Detach(); bu.Update(modelUser); } model.Attach(); model.ContentType = 2; model.Content = MyText.SafeStr(content); model.Face = face; model.IsShowTag = isShowTag; model.ModTime = DateTime.Now; model.Detach(); Update(model); return ""; }
public ActionResult FGiveJinbi(int id,FormCollection f) { if (id != FactionID) return RedirectToAction("FAdminAlert", new { id = id }); int jinbi = int.Parse(f["JinbiNum"].ToString()); bizUsers bu = new bizUsers(); bizFaction bf = new bizFaction(); Faction modelF = bf.Get(id); bizFactionLog blog = new bizFactionLog(); FactionLog modelBlog = new FactionLog(); Users model = bu.Get(UserID); if (jinbi <= 0) { TempData["Msg"] = "��̫������˰ɣ�"; return RedirectToAction("FGiveJinbi", new { id = id }); } if (model.Jinbi <= jinbi) { TempData["Msg"] = "��û����ô��ɱҰɣ�"; return RedirectToAction("FGiveJinbi", new { id = id }); } modelF.Attach(); modelF.FJinbi += jinbi; modelF.Detach(); model.Attach(); model.Jinbi -= jinbi; model.Detach(); modelBlog.FactionID = id; modelBlog.Remark = model.UserName+" ����������� "+jinbi+" �ɱ�"; bf.Update(modelF); bu.Update(model); blog.Add(modelBlog); TempData["Msg"] = "�����ɹ�����л��Բ������ľ�����"; return RedirectToAction("FGiveJinbi", new { id = id }); }
public ActionResult FExit(int id) { int userID = UserID; bizUsers bu = new bizUsers(); bizFactionUserLog blog = new bizFactionUserLog(); if ((new bizFactionDe()).GetByIsAdmin(id) == FactionDeID) { TempData["Msg"] = "���Dz��������������˳�"; return Redirect("/Factions/FUsers/" + id + ".html"); } Users model = bu.Get(userID); model.Attach(); model.FactionID = 0; model.FactionDeID = 0; model.Detach(); bu.Update(model); SessionSet(SessionName.FactionID, 0); SessionSet(SessionName.FactionDeID, 0); //UserCommon.RefreshUser(); FactionUserLog modelLog = blog.GetCurrByUserID(userID); modelLog.Attach(); modelLog.ExitTime = DateTime.Now; modelLog.Detach(); blog.Update(modelLog); bizFactionLog bfl = new bizFactionLog(); bfl.Add(id, model.UserName +" �˳�����"); return Redirect("/Factions/FAdminAlert/" + id + ".html?result=��ɹ��˳�����"); }