private M_Guest_Bar FillBarMsg(string msg, int pid, int rid = 0) { string base64 = StrHelper.CompressString(msg); if (base64.Length > 40000) { throw new Exception("发贴失败,原因:内容过长,请减少内容文字"); } M_Guest_Bar parent = barBll.SelReturnModel(pid); M_Guest_Bar model = new M_Guest_Bar(); model.MsgType = 1; model.Status = (int)ZLEnum.ConStatus.Audited; model.CUser = mu.UserID; model.CUName = mu.HoneyName; model.R_CUName = mu.HoneyName; model.IDCode = mu.UserID <= 0 ? mu.WorkNum : mu.UserID.ToString(); model.MsgContent = base64; model.Pid = pid; model.ReplyID = rid; model.CateID = parent.CateID; model.IP = IPScaner.GetUserIP(HttpContext); string ipadd = IPScaner.IPLocation(model.IP); ipadd = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd; model.IP = model.IP + "|" + ipadd; model.ColledIDS = ""; //AddUserExp(mu, parent.CateID, parent.Title); return(model); }
private void CheckIP(M_Survey info) { string ip = IPScaner.GetUserIP(); if (info.IPRepeat < 1) { return; } if (ip.StartsWith("192.168") || ip.Equals("::1")) { return; } List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter("ip", ip), new SqlParameter("sdate", DateTime.Now.ToString("yyyy/MM/dd 00:00:00")), new SqlParameter("edate", DateTime.Now.ToString("yyyy/MM/dd 23:59:59")) }; int count = DBCenter.Count("ZL_Answer_Recode", "SubmitIP=@ip AND Sid=" + info.SurveyID + " AND (SubmitDate>@sdate AND SubmitDate<@edate)", sp); if (count > info.IPRepeat) { function.WriteErrMsg("对不起,系统限定:一个IP一天只能提交" + info.IPRepeat + "份,请明天再来。。"); } }
public IActionResult AddReply() { int GID = DataConverter.CLng(RequestEx["GID"]); if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["VCode"])) { return(WriteErr("验证码不正确", Request.RawUrl())); } M_GuestBook pinfo = guestBll.SelReturnModel(GID); M_GuestBookCate cateMod = cateBll.SelReturnModel(pinfo.CateID); M_GuestBook info = new M_GuestBook(); M_UserInfo mu = buser.GetLogin(); info.UserID = mu.UserID; info.ParentID = GID; info.Status = cateMod.Status == 1 ? 0 : 1; info.Title = "[会员回复]"; info.CateID = pinfo.CateID; info.TContent = Request.Form["Content"]; //info.Status = SiteConfig.SiteOption.OpenAudit > 0 ? 0 : 1; info.IP = IPScaner.GetUserIP(HttpContext); guestBll.AddTips(info); if (info.Status == 1) { return(WriteOK("回复成功", "GuestShow?Gid=" + GID)); } else { return(WriteOK("您的回复已提交,请等待后系统审核", "GuestShow?Gid=" + GID)); } }
public static M_AdminInfo AuthenticateAdmin(string AdminName, string Password) { if (string.IsNullOrEmpty(AdminName) || string.IsNullOrEmpty(Password)) { return(null); } M_AdminInfo adminMod = null; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("AdminName", AdminName), new SqlParameter("AdminPassword", StringHelper.MD5(Password)) }; using (DbDataReader reader = DBCenter.SelReturnReader(tbName, "AdminName=@AdminName AND AdminPassword=@AdminPassword", sp)) { if (reader.Read()) { adminMod = new M_AdminInfo().GetModelFromReader(reader); } else { return(null); } } adminMod.LastLoginIP = IPScaner.GetUserIP(); adminMod.LastLoginTime = DateTime.Now; adminMod.LoginTimes++; Update(adminMod); return(adminMod); }
public static void Insert(M_UserExpHis model) { if (model.UserID == 0) { M_UserInfo mu = new B_User().GetLogin(); if (mu != null) { model.UserID = mu.UserID; } } if (model.Operator == 0) { M_AdminInfo adminMod = B_Admin.GetLogin(); if (adminMod != null) { model.Operator = adminMod.AdminId; } } if (string.IsNullOrEmpty(model.OperatorIP)) { model.OperatorIP = IPScaner.GetUserIP(); } if (string.IsNullOrEmpty(model.Remark) && HttpContext.Current != null) { model.Remark = HttpContext.Current.Request.RawUrl; } if (model.HisTime <= DateTime.MinValue) { model.HisTime = DateTime.Now; } model.TbName = GetTbName((SType)model.ScoreType); DBCenter.Insert(model); }
public int Insert(M_Design_Pub model) { if (string.IsNullOrEmpty(model.IP)) { model.IP = IPScaner.GetUserIP(); } return(DBCenter.Insert(model)); }
public int Insert(M_Common_UserApply model) { if (string.IsNullOrEmpty(model.IP)) { model.IP = IPScaner.GetUserIP(); } return(DBCenter.Insert(model)); }
protected void btnSubmit_Click(object sender, EventArgs e) { M_Survey info = surBll.GetSurveyBySid(Sid); if (info.IsNull) { function.WriteErrMsg("该问卷不存在!可能已被删除"); } DateTime SubmitDate = DateTime.Now; string SIP = IPScaner.GetUserIP(); //----如该问卷是不用登录的,则以随机码作为用户名 int UserID = GetUserID(info); if (info.IsCheck && !CheckVCode(SendVcode.Text.Trim())) { function.Script(this, "alert('验证码不正确');"); return; } IList <M_Question> list = B_Survey.GetQueList(Sid); for (int i = 0; i < list.Count; i++) { M_Answer ans = new M_Answer(); string re = Request.Form["vote_" + i]; string[] OptionValue = list[i].QuestionContent.Split(new char[] { '|' }); if (list[i].TypeID == 2) { string[] ReArr = re.Split(new char[] { ',' }); for (int s = 0; s < ReArr.Length; s++) { ans.AnswerID = 0; ans.AnswerContent = ReArr[s]; ans.QuestionID = list[i].QuestionID; ans.SurveyID = Sid; ans.SubmitIP = SIP; ans.SubmitDate = SubmitDate; ans.UserID = UserID; B_Survey.AddAnswer(ans); } } else { ans.AnswerID = 0; ans.AnswerContent = re; ans.QuestionID = list[i].QuestionID; ans.SurveyID = Sid; ans.SubmitIP = SIP; ans.SubmitDate = SubmitDate; ans.UserID = UserID; B_Survey.AddAnswer(ans); } } B_Survey.AddAnswerRecord(Sid, UserID, SIP, SubmitDate, 1); string url = "VoteResult.aspx?SID=" + Sid; function.WriteSuccessMsg("提交成功!感谢您的参与!", Page.ResolveClientUrl(url)); }
public string Comment_API() { string action = RequestEx["action"]; string value = ""; string result = ""; switch (action) { case "report": //举报 value = Request.Form["cid"]; cmtBll.ReportComment(Convert.ToInt32(value), mu.UserID); result = Success.ToString(); break; case "support": //支持反对操作 value = Request.Form["flag"]; bool rflag = true; bool flag = DataConverter.CLng(value) > 0; if (buser.GetLogin().IsNull) { rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, IPScaner.GetUserIP(HttpContext)); } else { rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, IPScaner.GetUserIP(HttpContext), mu.UserID, mu.UserName); } result = rflag ? Success.ToString() : Failed.ToString(); break; case "assist": //顶与踩 bool bl = true; if (buser.GetLogin().IsNull) { bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), IPScaner.GetUserIP(HttpContext), Convert.ToInt32(Request.Form["gid"])); } else { bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), IPScaner.GetUserIP(HttpContext), mu.UserID, mu.UserName, Convert.ToInt32(Request.Form["gid"])); } result = bl ? "1" : "0"; break; case "reply": //回复 result = Comment_Reply(); break; case "sender": //发送评论 result = SendComm(); break; default: throw new Exception(action + "不存在"); } return(result); }
//------------- //检测问卷可否被提交 private bool CheckAsk(M_Design_Ask askMod, ref string err) { string ip = IPScaner.GetUserIP(HttpContext); if (askMod == null) { err = "问卷不存在"; return(false); } if (askMod.IsNeedLogin == 1 && mu.IsNull) { err = "[" + askMod.Title + "]必须登录后才可访问"; return(false); } if (askMod.ZStatus != (int)ZLEnum.ConStatus.Audited) { err = "[" + askMod.Title + "]未开放"; return(false); } if (askMod.StartDate >= DateTime.Now) { err = "[" + askMod.Title + "]尚未到开放时间"; return(false); } if (askMod.EndDate <= DateTime.Now) { err = "[" + askMod.Title + "]已经结束"; return(false); } if (askMod.IsIPLimit > 0) { //if (ip.StartsWith("192.168") || ip.Equals("::1")) { } List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter("ip", ip), new SqlParameter("sdate", DateTime.Now.ToString("yyyy/MM/dd 00:00:00")), new SqlParameter("edate", DateTime.Now.ToString("yyyy/MM/dd 23:59:59")) }; int count = DBCenter.Count(ansBll.TbName, "IP=@ip AND AskID=" + askMod.ID + " AND (CDate>@sdate AND CDate<@edate)", sp); if (count >= askMod.IsIPLimit) { err = "系统限定:一天只能提交" + askMod.IsIPLimit + "份,请明天再来"; return(false); } } if (askMod.IPInterval > 0) { //取最近的一条记录 M_Design_Answer ansMod = ansBll.SelModelByIP(ip); if (ansMod == null || (DateTime.Now - ansMod.CDate).TotalSeconds > askMod.IPInterval) { } else { err = "系统限定:每隔" + DateHelper.ShowSeconds(askMod.IPInterval) + "才可再次提交"; return(false); } } return(true); }
public IActionResult Add() { if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["VCode"])) { return(WriteErr("验证码不正确", Request.RawUrl())); } int CateID = DataConverter.CLng(RequestEx["Cate"]); M_GuestBook info = new M_GuestBook(); M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID); //不允许匿名登录,必须登录才能发表留言 if (cateMod.NeedLog == 1) { if (!mu.IsNull) { info.UserID = mu.UserID; } else { return(Redirect("/User/Login")); } } else if (buser.CheckLogin()) { info.UserID = buser.GetLogin().UserID; } info.CateID = CateID; //是否开启审核 info.Status = cateMod.Status == 1 ? 0 : 1; info.ParentID = 0; info.Title = HttpUtility.HtmlEncode(Request.Form["Title"]); info.TContent = RequestEx["Content"]; info.IP = IPScaner.GetUserIP(HttpContext); guestBll.AddTips(info); if (cateMod.Status == 1) { if (cateMod.IsShowUnaudit == 1) { return(WriteOK("您的留言已提交,请等待系统审核", "/Guest/Default?CateID=" + CateID)); } else { return(WriteOK("您的留言已提交,通过系统审核后会出现在开放列表中", "/Guest/Default?CateID=" + CateID)); } } else { return(WriteOK("留言成功", "/Guest/Default?CateID=" + CateID)); } }
//申请加入 protected void Apply_B_Click(object sender, EventArgs e) { int compid = DataConverter.CLng(compId_Hid.Value); M_UserInfo mu = buser.GetLogin(); //记录用户信息并写入 ualyMod.UserID = mu.UserID; ualyMod.ZType = "plat_joincomp"; ualyMod.UserName = mu.UserName + "(" + mu.TrueName + ")"; ualyMod.Remind = compid.ToString(); ualyMod.IP = IPScaner.GetUserIP(); ualyBll.Insert(ualyMod); function.WriteSuccessMsg("申请成功,请等待管理员审核"); }
//申请加入公司(一张表用于存其)//ZL_Plat_JoinCompApply protected void AddComp_Btn_Click(object sender, EventArgs e) { M_User_Plat upMod = B_User_Plat.GetLogin(); //记录用户信息并写入 M_Common_UserApply ualyMod = new M_Common_UserApply(); B_Common_UserApply ualyBll = new B_Common_UserApply(); ualyMod.UserID = upMod.UserID; ualyMod.ZType = "plat_joincomp"; ualyMod.UserName = upMod.UserName + "(" + upMod.TrueName + ")"; ualyMod.Remind = CompID.ToString(); ualyMod.IP = IPScaner.GetUserIP(); ualyBll.Insert(ualyMod); function.WriteSuccessMsg("申请成功,请等待管理员审核", "/Plat/"); }
protected void Page_Load(object sender, EventArgs e) { if (SiteConfig.SiteOption.RegManager != 1) { function.WriteErrMsg("未开启管理员申请功能"); } if (!IsPostBack) { IPCity cityMod = IPScaner.FindCity(IPScaner.GetUserIP()); if (cityMod.IsValid) { function.Script(this, "pcc.SetDef('" + cityMod.Province + "','" + cityMod.City + "','" + cityMod.County + "');"); } function.Script(this, "pcc.ProvinceInit();"); } }
public string ResultAdd_Submit() { if (!AdminCheck()) { return("无权访问"); } int ansnum = DataConvert.CLng(GetParam("ansnum")); if (ansnum < 1) { return("投票人数不正确"); } //[后期改为附加虚拟值的方式] M_Design_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return("问卷不存在"); } //-------------------------------- M_Design_Answer ansMod = new M_Design_Answer(); ansMod.AskID = askMod.ID; //ansMod.Answer = Req("answer");//{qid:1,answer:'is answer'} ansMod.Answer = GetParam("answer"); ansMod.UserID = -1; ansMod.IP = IPScaner.GetUserIP(HttpContext); ansMod.Source = "管理员添加"; for (int i = 0; i < ansnum; i++) { ansMod.ID = 0; ansMod.ID = ansBll.Insert(ansMod); //-----------单独写入表中,便于后期分析(后期优化为批量插入) List <M_SubOption> ansList = JsonConvert.DeserializeObject <List <M_SubOption> >(GetParam("answer")); foreach (M_SubOption ans in ansList) { M_Design_AnsDetail ansdeMod = new M_Design_AnsDetail(); ansdeMod.AskID = ansMod.AskID; ansdeMod.AnsID = ansMod.ID; ansdeMod.Qid = ans.qid; ansdeMod.Answer = ans.answer; ansdeMod.UserID = ansMod.UserID; ansdeBll.Insert(ansdeMod); } } return(Success.ToString()); }
public VM_Register() { //根据IP,分析出地址,并填充 cityMod = IPScaner.FindCity(IPScaner.GetUserIP());//"59.52.159.79" // //html_must = fieldBll.InputallHtml(0, 0, new ModelConfig() //{ // Source = ModelConfig.SType.UserRegister, // Fields = SiteConfig.UserConfig.RegFieldsMustFill //}); //html_select = fieldBll.InputallHtml(0, 0, new ModelConfig() //{ // Source = ModelConfig.SType.UserRegister, // Fields = SiteConfig.UserConfig.RegFieldsSelectFill //}); //1,添加字段2,用户参数--将其加入必填或选填字段3,输出给前端使用 string selectFields = SiteConfig.UserConfig.RegFieldsSelectFill, mustFields = SiteConfig.UserConfig.RegFieldsMustFill; if (!string.IsNullOrEmpty(selectFields) || !string.IsNullOrEmpty(mustFields)) { fieldDT = SqlHelper.ExecuteTable("SELECT *,ModelID=0,IsShow='True',IsSearchForm='False',IsView=1,IsDownField=0 FROM ZL_UserBaseField"); if (!string.IsNullOrEmpty(selectFields)) { fieldDT.DefaultView.RowFilter = "FieldName IN (" + WrapFields(selectFields) + ")"; selectDT = fieldDT.DefaultView.ToTable(); } if (!string.IsNullOrEmpty(mustFields)) { fieldDT.DefaultView.RowFilter = "FieldName IN (" + WrapFields(mustFields) + ")"; mustDT = fieldDT.DefaultView.ToTable(); } } //---------------------------------------------- groupDT = gpBll.GetSelGroup(); int puid = DataConvert.CLng(Request.QueryString["ParentUserID"]); string puname = DataConvert.CStr(Request.QueryString["ParentUser"]); if (puid > 0) { pmu = buser.SelReturnModel(puid); } else if (!string.IsNullOrEmpty(puname)) { pmu = buser.GetUserIDByUserName(puname); } }
private static M_Log EmptyDeal(Model.ZLEnum.Log type, M_Log model) { if (string.IsNullOrEmpty(model.Action)) { model.Action = type.ToString(); } if (model.CDate <= DateTime.MinValue) { model.CDate = DateTime.Now; } try { if (string.IsNullOrEmpty(model.IP)) { model.IP = IPScaner.GetUserIP(); } if (string.IsNullOrEmpty(model.Source)) { model.Source = HttpContext.Current.Request.RawUrl; } } catch { } if (type == Model.ZLEnum.Log.fileup || type == Model.ZLEnum.Log.safe) { try { if (string.IsNullOrEmpty(model.UName)) { M_UserInfo mu = new B_User().GetLogin(); if (mu != null && mu.UserID != 0) { model.UName = mu.UserName; } } if (string.IsNullOrEmpty(model.AName)) { M_AdminInfo adminMod = B_Admin.GetLogin(); if (adminMod != null && adminMod.AdminId > 0) { model.AName = adminMod.AdminName; } } } catch { } } return(model); }
public string Vote_Submit() { M_Design_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return("问卷不存在"); } if (askMod.IsEnableVCode == 1) { if (!ZoomlaSecurityCenter.VCodeCheck(GetParam("vkey"), GetParam("vcode"))) { return("验证码不正确"); } } if (!CheckAsk(askMod, ref err)) { return(err); } M_Design_Answer ansMod = new M_Design_Answer(); ansMod.AskID = askMod.ID; //ansMod.Answer = Req("answer");//{qid:1,answer:'is answer'} ansMod.Answer = GetParam("answer"); ansMod.UserID = mu.UserID; ansMod.IP = IPScaner.GetUserIP(HttpContext); //ansMod.Source = DeviceHelper.GetBrower().ToString(); ansMod.ID = ansBll.Insert(ansMod); //-----------单独写入表中,便于后期分析(后期优化为批量插入) List <M_SubOption> ansList = JsonConvert.DeserializeObject <List <M_SubOption> >(GetParam("answer")); foreach (M_SubOption ans in ansList) { M_Design_AnsDetail ansdeMod = new M_Design_AnsDetail(); ansdeMod.AskID = ansMod.AskID; ansdeMod.AnsID = ansMod.ID; ansdeMod.Qid = ans.qid; ansdeMod.Answer = ans.answer; ansdeMod.UserID = ansMod.UserID; ansdeBll.Insert(ansdeMod); } return(Success.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //BindDP(); M_UserInfo mu = buser.GetLogin(); if (Mid > 0) { M_UserRecei model = receBll.GetSelect(Mid, mu.UserID); if (model == null) { function.WriteErrMsg("修改的地址不存在"); } ZipCode_T.Text = model.Zipcode; //省市县 Street_T.Text = model.Street; ReceName_T.Text = model.ReceivName; MobileNum_T.Text = model.MobileNum; pro_hid.Value = model.Provinces; Def_chk.Checked = model.isDefault == 1 ? true : false; if (model.phone.Split('-').Length > 1) { Area_T.Text = model.phone.Split('-')[0]; Phone_T.Text = model.phone.Split('-')[1]; } rUrl = Request.QueryString["ReturnUrl"]; } else { IPCity cityMod = IPScaner.FindCity(IPScaner.GetUserIP());//"59.52.159.79" if (cityMod.IsValid) { function.Script(this, "pcc.SetDef('" + cityMod.Province + "','" + cityMod.City + "','" + cityMod.County + "');"); } } //用户没有其它地址时自动开启默认 DataTable addressDT = receBll.SelByUID(mu.UserID); if (addressDT == null || addressDT.Rows.Count < 1) { Def_chk.Checked = true; } } }
//批量插入(需优化代码) public void Insert(List <M_UAction> list) { string ip = IPScaner.GetUserIP(); int uid = 0; string uname = ""; DateTime cdate = DateTime.Now; M_UserInfo mu = new B_User().GetLogin(); if (mu != null && mu.UserID > 0) { uid = mu.UserID; uname = mu.UserName; } for (int i = 0; i < list.Count; i++)//后期更换为批量插入 { list[i].uid = uid; list[i].ip = ip; list[i].uname = uname; list[i].cdate = DateTime.Now; Insert(list[i]); } }
/// <summary> /// 执行签到/签退操作 /// </summary> /// <param name="uid"></param> /// <returns>签到记录ID,若返回值为-1说明今日已签退,此次没有进行任何操作</returns> private int Sign(M_UserInfo mu, int ZType) { M_Plat_Sign model = new M_Plat_Sign(); DateTime sdate = DataConvert.CDate("08:30"); //上班时间 DateTime edate = DataConvert.CDate("18:00"); //下班时间 model.State = 0; if (ZType == 0 && DateTime.Now > sdate) { model.State = 1; } //迟到 if (ZType == 1 && DateTime.Now < edate) { model.State = 2; } //早退 model.UserID = mu.UserID; model.IP = IPScaner.GetUserIP(); model.IPLocation = IPScaner.IPLocation(model.IP); model.ZType = ZType; return(Insert(model)); }
private void ForDataColumn(M_Pub pubMod, DataTable dt) { M_UserInfo mu = buser.GetLogin(); string[] fields = "PubAddTime,PubUserName,PubUserID,PubIP,Pubupid,Pubstart".Split(','); foreach (string field in fields) { if (!dt.Columns.Contains(field)) { dt.Columns.Add(new DataColumn(field, typeof(string))); } } DataRow dr = dt.Rows[0]; dr["PubAddTime"] = DateTime.Now; dr["PubUserName"] = mu.UserName; dr["PubUserID"] = mu.UserID; dr["PubIP"] = IPScaner.GetUserIP(); dr["Pubupid"] = PubID; dr["Pubstart"] = pubMod.PubIsTrue == 1 ? 0 : 1;//是否审核 }
protected void EBtnSubmit_Click(object sender, EventArgs e) { B_User buser = new B_User(); M_GuestBook info = new M_GuestBook(); if (Mid > 0) { info = guestBll.GetQuest(Mid); } info.ParentID = Convert.ToInt16(Request.QueryString["GID"]); info.CateID = Convert.ToInt16(Request.QueryString["CateId"]); info.UserID = buser.GetLogin().UserID; info.Title = this.TextBox1.Text.Trim() == "" ? "<font style='color:#1e860b;'>[管理员回复]</font>" : BaseClass.CheckInjection(this.TextBox1.Text.Trim()); info.TContent = BaseClass.CheckInjection(this.tx_Content.Value); info.Status = 1; info.IP = IPScaner.GetUserIP(); if (guestBll.AddTips(info)) { Response.Redirect("GuestBookShow.aspx?GID=" + Request.QueryString["GID"] + "&CateID=" + Request.QueryString["CateID"]); } }
//审核完成后,用户可自由修改店铺信息 public void UserShop_Edit() { M_CommonData storeMod = conBll.SelMyStore(mu.UserName); DataTable cmdinfo = conBll.GetContent(storeMod.GeneralID); //---------- DataTable dt = fieldBll.GetModelFieldList(Convert.ToInt32(cmdinfo.Rows[0]["StoreModelID"])); Call commonCall = new Call(); DataTable table; try { table = commonCall.GetDTFromMVC(dt, Request); } catch (Exception e) { function.WriteErrMsg(e.Message); return; } DataRow rs4 = table.NewRow(); rs4[0] = "StoreName"; rs4[1] = "TextType"; rs4[2] = Request.Form["StoreName_T"]; table.Rows.Add(rs4); DataRow rs5 = table.NewRow(); rs5[0] = "StoreStyleID"; rs5[1] = "int"; rs5[2] = Convert.ToInt32(Request.Form["SSTDownList"]); table.Rows.Add(rs5); M_StoreStyleTable sst = sstbll.GetStyleByID(Convert.ToInt32(Request.Form["SSTDownList"])); if (sst != null) { storeMod.Template = sst.StyleUrl; } storeMod.Title = Request.Form["StoreName_T"]; storeMod.IP = IPScaner.GetUserIP(); conBll.UpdateContent(table, storeMod); function.WriteSuccessMsg("提交成功", "Index"); return; }
public ActionResult Apply_Add() { B_Store_Info stBll = new B_Store_Info(); int modelid = DataConvert.CLng(Request.Form["model_dp"]); string store = Request.Form["store_t"]; M_CommonData CData = conBll.SelMyStore(mu.UserName); if (CData == null) { CData = new M_CommonData(); } //---------------------------------------- if (string.IsNullOrEmpty(store)) { function.WriteErrMsg("店铺名称不能为空"); return(Content("")); } //M_StoreStyleTable sst = sstbll.GetNewStyle(modelid); //if (sst.ID == 0) { function.WriteErrMsg("后台没有为该模型绑定可用的模板!"); return Content(""); } CData.Title = HttpUtility.HtmlEncode(Request.Form["store_t"]); CData.DefaultSkins = DataConverter.CLng(Request.Form["TempleID_Hid"]); CData.ModelID = modelid; CData.TableName = modBll.SelReturnModel(CData.ModelID).TableName; CData.Inputer = mu.UserName; CData.SuccessfulUserID = mu.UserID; CData.Inputer = mu.UserName; CData.IP = IPScaner.GetUserIP(); DataTable dt = fieldBll.GetModelFieldList(modelid); DataTable table = new Call().GetDTFromMVC(dt, Request); table = stBll.FillDT(CData, table); if (CData.GeneralID > 0) { conBll.UpdateContent(table, CData); } else { conBll.AddContent(table, CData); } return(View("StoreAuditing")); }
/// <summary> /// 购物车中有则增加数量,否则添加记录 /// </summary> public int AddModel(M_Cart model) { if (string.IsNullOrEmpty(model.Getip)) { model.Getip = IPScaner.GetUserIP(); } SqlParameter[] sp = new SqlParameter[] { new SqlParameter("cartid", model.Cartid) }; string sql = "Select * From ZL_Cart Where StoreID=" + model.StoreID + " And CartID=@cartid And ProID=" + model.ProID; DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, sql, sp); if (dt.Rows.Count > 0) { int id = Convert.ToInt32(dt.Rows[0]["ID"]); string updatesql = "Update ZL_Cart Set Pronum=Pronum+" + model.Pronum + " Where ID=" + id; SqlHelper.ExecuteSql(updatesql); return(id); } else { return(insert(model)); } }
public void AddUser(string password) { M_UserInfo uinfo = buser.GetUserByName(UserName_T.Text.Trim()); if (uinfo == null || uinfo.UserID <= 0) { uinfo = new M_UserInfo(); } uinfo.UserName = UserName_T.Text.Trim(); uinfo.UserPwd = password; uinfo.Email = UserEmail_T.Text; if (buser.IsExistMail(uinfo.Email)) { uinfo.Email = function.GetRandomString(6) + "@random.com"; } uinfo.GroupID = groupBll.DefaultGroupID(); uinfo.LastLoginIP = IPScaner.GetUserIP(); M_Uinfo binfo = new M_Uinfo(); binfo.Province = Request.Form["tbProvince"]; binfo.City = Request.Form["tbCity"]; binfo.County = Request.Form["tbCounty"]; binfo.Mobile = UserPhone_T.Text; binfo.Position = Compay_T.Text; binfo.QQ = QQ_T.Text; if (uinfo == null || uinfo.UserID <= 0)//如果未注册会员则添加会员信息 { int uid = buser.AddModel(uinfo); binfo.UserId = uid; buser.AddBase(binfo); } else { buser.UpDateUser(uinfo); binfo.UserId = uinfo.UserID; buser.UpdateBase(binfo); } }
//审核完成后,用户可自由修改店铺信息 public void UserShop_Edit() { M_CommonData storeMod = conBll.SelMyStore(mu.UserName); DataTable cmdinfo = conBll.GetContent(storeMod.GeneralID); //---------- DataTable dt = fieldBll.GetModelFieldList(Convert.ToInt32(cmdinfo.Rows[0]["StoreModelID"])); Call commonCall = new Call(); DataTable table; try { table = commonCall.GetDTFromMVC(dt, Request); } catch (Exception e) { function.WriteErrMsg(e.Message); return; } storeMod.Title = Request.Form["StoreName_T"]; storeMod.IP = IPScaner.GetUserIP(); storeMod.DefaultSkins = DataConverter.CLng(Request.Form["TempleID_Hid"]); conBll.UpdateContent(table, storeMod); function.WriteSuccessMsg("提交成功", "Index"); }
private M_Guest_Bar FillMsg(string title, string msg, int pid, int rid = 0, M_GuestBookCate catemod = null) { if (pid > 0) { M_Guest_Bar pmod = barBll.SelReturnModel(pid); catemod = cateBll.SelReturnModel(pmod.CateID); } string base64 = StrHelper.CompressString(msg); if (base64.Length > 40000) { throw new Exception("取消修改,原因:内容过长,请减少内容"); } M_UserInfo mu = tuBll.GetLogin("匿名用户"); //barBll.GetUser(); M_Guest_Bar model = new M_Guest_Bar(); model.MsgType = 1; model.Status = catemod.Status > 1 ? (int)ZLEnum.ConStatus.UnAudit : (int)ZLEnum.ConStatus.Audited;//判断贴吧是否开启审核,如果是就默认设置为未审核 model.CUser = mu.UserID; model.CUName = mu.HoneyName; model.R_CUName = mu.HoneyName; model.Title = title; model.SubTitle = GetSubTitle(ref msg); model.MsgContent = base64; model.CateID = catemod.CateID; model.IP = IPScaner.GetUserIP(HttpContext); string ipadd = IPScaner.IPLocation(model.IP); ipadd = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd; model.IP = model.IP + "|" + ipadd; model.Pid = pid; model.ReplyID = rid; model.ColledIDS = ""; model.IDCode = mu.UserID == 0 ? mu.WorkNum : mu.UserID.ToString(); model.CDate = DateTime.Now; return(model); }
public IActionResult Register_Submit() { B_UserBaseField bmf = new B_UserBaseField(); string siteurls = SiteConfig.SiteInfo.SiteUrl.TrimEnd('/'); if (!SiteConfig.UserConfig.EnableUserReg) { return(WriteErr("服务器已关闭用户注册")); } //----------------------------------- M_UserInfo info = new M_UserInfo(); info.UserBase = new M_Uinfo(); info.UserName = GetParam("TxtUserName").Replace(" ", ""); info.UserPwd = RequestEx["TxtPassword"]; info.Question = RequestEx["Question_DP"]; info.Answer = RequestEx["TxtAnswer"]; info.Email = DataConvert.CStr(RequestEx["TxtEmail"]).Replace(" ", ""); info.CheckNum = function.GetRandomString(10); info.GroupID = DataConverter.CLng(RequestEx["UserGroup"]); if (!SiteConfig.UserConfig.Reg_SelGroup)//不允许用户手动选择会员组 { info.GroupID = gpBll.DefaultGroupID(); } info.RegisterIP = IPScaner.GetUserIP(HttpContext); info.LastLoginIP = info.RegisterIP; //info.Purse = SiteConfig.UserConfig.PresentMoney;//注册赠送的余额,积分等 //info.UserPoint = SiteConfig.UserConfig.PresentPoint; //info.UserExp = DataConverter.CLng(SiteConfig.UserConfig.PresentExp); info.TrueName = RequestEx["TxtTrueName"]; info.UserPwd = StringHelper.MD5(info.UserPwd);; //----------------------------------------------------- //会员基本信息 info.UserBase.Address = RequestEx["TxtAddress"]; info.UserBase.BirthDay = RequestEx["TxtBirthday"]; info.UserFace = RequestEx["TxtUserFace"]; info.UserBase.Fax = RequestEx["TxtFax"]; info.UserBase.HomePage = RequestEx["TxtHomepage"]; info.UserBase.HomePhone = RequestEx["TxtHomePhone"]; info.UserBase.IDCard = RequestEx["TxtIDCard"]; info.UserBase.Mobile = RequestEx["TxtMobile"]; info.UserBase.OfficePhone = RequestEx["TxtOfficePhone"]; info.UserBase.Privating = DataConvert.CLng(RequestEx["DropPrivacy"]); info.UserBase.PHS = RequestEx["TxtPHS"]; info.UserBase.QQ = RequestEx["TxtQQ"]; info.UserBase.Sign = RequestEx["TxtSign"]; info.UserBase.UserSex = DataConverter.CBool(RequestEx["DropSex"]); info.UserBase.ZipCode = RequestEx["TxtZipCode"]; info.UserBase.HoneyName = ""; info.UserBase.CardType = ""; info.UserBase.Province = GetParam("selprovince"); info.UserBase.City = GetParam("selcity"); info.UserBase.County = GetParam("selcoutry"); if (!string.IsNullOrEmpty(RegisterMobile)) { info.UserBase.Mobile = RegisterMobile; RegisterMobile = null; } //----------------------------------------------------- #region 信息检测 string err = ""; if (SiteConfig.UserConfig.EnableCheckCodeOfReg) { if (!VerifyHelper.Check(RequestEx["VCode_hid"])) { return(WriteErr("您输入的验证码和系统产生的不一致,请重新输入", "javascript:history.go(-1);")); } } if (!CheckUserName(info.UserName, ref err)) { return(WriteErr(err)); } else if (!CheckUserInfo(info.UserBase)) { return(WriteErr(err)); } else if (SiteConfig.UserConfig.Reg_AnswerMust && string.IsNullOrEmpty(info.Answer)) { return(WriteErr("问题答案不能为空")); } else if (!CheckEmail(info.Email, ref err)) { return(WriteErr("问题答案不能为空")); } #endregion //推荐人处理 { //支持使用用户名和用户ID info.ParentUserID = CheckParentUser(RequestEx["TxtParentUser"]).UserID.ToString(); if (DataConvert.CLng(info.ParentUserID) < 1 && !string.IsNullOrEmpty(RequestEx["ParentUser_Hid"])) { info.ParentUserID = CheckParentUser(RequestEx["ParentUser_Hid"]).UserID.ToString(); } } //用于初始状态 if (SiteConfig.UserConfig.EmailCheckReg) { info.Status = 4; } //邮件认证 else if (SiteConfig.UserConfig.AdminCheckReg) { info.Status = 2; } //管理员认证 else if (SiteConfig.UserConfig.EmailCheckReg && SiteConfig.UserConfig.AdminCheckReg) { info.Status = 3; } //邮件认证及管理员认证 else if (!SiteConfig.UserConfig.UserValidateType) { info.Status = 5; } else { info.Status = 0; } //自定义字段信息 DataTable table; try { table = Call.GetDTFromMVC(bmf.Select_All(), Request); } catch (Exception e) { return(WriteErr(e.Message)); } string[] strArray2 = string.IsNullOrEmpty(SiteConfig.UserConfig.RegFieldsMustFill) ? new string[0] : SiteConfig.UserConfig.RegFieldsMustFill.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); foreach (string str2 in strArray2) { if (string.IsNullOrEmpty(GetParam("txt_" + str2))) { DataTable tbles = bmf.SelByFieldName(str2); } } //------------添加新用户 info.UserID = buser.Add(info); info.UserBase.UserId = info.UserID; if (info.UserID < 1) { return(WriteErr("注册失败")); } buser.AddBase(info.UserBase); if (table != null && table.Rows.Count > 0) { buser.UpdateUserFile(info.UserID, table); } buser.SetLoginState(info); //赠送虚拟币 //if (SiteConfig.UserConfig.PresentMoney > 0) //{ // buser.AddMoney(info.UserID, SiteConfig.UserConfig.PresentMoney, M_UserExpHis.SType.Purse, "注册赠送"); //} //if (SiteConfig.UserConfig.PresentExp > 0) //{ // buser.AddMoney(info.UserID, SiteConfig.UserConfig.PresentExp, M_UserExpHis.SType.Point, "注册赠送"); //} //---------------------------------------------------------------------------- string ReturnUrl = RequestEx["ReturnUrl_Hid"]; string RegMessage = ""; string RegRUrl = ""; bool isok = false; //关联绑定微信用户 //if (!string.IsNullOrEmpty(WXOpenID)) //{ // B_User_Token tokenBll = new B_User_Token(); // M_User_Token tokenMod = tokenBll.SelModelByUid(info.UserID); // if (tokenMod == null) { tokenMod = new M_User_Token(); } // tokenMod.uid = info.UserID; // tokenMod.WXOpenID = WXOpenID; // tokenBll.Insert(tokenMod); //} #region 自定义模型 int ModelID = DataConverter.CLng(gpBll.GetGroupModel(info.GroupID)); string usertablename = modBll.SelReturnModel(ModelID).TableName; if (ModelID > 0 && usertablename != "" && usertablename != null) { DataTable groupset = fieldBll.GetModelFieldListall(ModelID); DataTable tablereg = new DataTable(); tablereg.Columns.Add(new DataColumn("FieldName", typeof(string))); tablereg.Columns.Add(new DataColumn("FieldType", typeof(string))); tablereg.Columns.Add(new DataColumn("FieldValue", typeof(string))); if (groupset != null && groupset.Rows.Count > 0) { foreach (DataRow dr in groupset.Rows) { if (dr["FieldType"].ToString() == "FileType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { DataRow row2 = tablereg.NewRow(); row2[0] = sizefield; row2[1] = "FileSize"; row2[2] = RequestEx["txt_" + sizefield]; tablereg.Rows.Add(row2); } } if (dr["FieldType"].ToString() == "MultiPicType") { string[] Sett = dr["Content"].ToString().Split(new char[] { ',' }); bool chksize = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]); string sizefield = Sett[1].Split(new char[] { '=' })[1]; if (chksize && sizefield != "") { if (string.IsNullOrEmpty(RequestEx["txt_" + sizefield])) { return(WriteErr(dr["FieldAlias"].ToString() + "的缩略图不能为空!")); } DataRow row1 = tablereg.NewRow(); row1[0] = sizefield; row1[1] = "ThumbField"; row1[2] = RequestEx["txt_" + sizefield]; tablereg.Rows.Add(row1); } } DataRow row = tablereg.NewRow(); row[0] = dr["FieldName"].ToString(); string ftype = dr["FieldType"].ToString(); row[1] = ftype; string fvalue = RequestEx["txt_" + dr["FieldName"].ToString()]; if (ftype == "TextType" || ftype == "MultipleTextType" || ftype == "MultipleHtmlType") { if (dr["IsNotNull"].Equals("True") && string.IsNullOrEmpty(fvalue)) { return(WriteErr(dr["FieldAlias"] + ":不能为空!")); } } row[2] = fvalue; tablereg.Rows.Add(row); } try { if (tablereg.Select("FieldName='UserID'").Length == 0) { DataRow rowsd1 = tablereg.NewRow(); rowsd1[0] = "UserID"; rowsd1[1] = "int"; rowsd1[2] = info.UserID; tablereg.Rows.Add(rowsd1); } else { tablereg.Rows[0]["UserID"] = info.UserID; } } catch (Exception) { } try { if (tablereg.Select("FieldName='UserName'").Length == 0) { DataRow rowsd2 = tablereg.NewRow(); rowsd2[0] = "UserName"; rowsd2[1] = "TextType"; rowsd2[2] = info.UserName; tablereg.Rows.Add(rowsd2); } else { tablereg.Rows[0]["UserName"] = info.UserName; } } catch (Exception) { } try { if (tablereg.Select("FieldName='Styleid'").Length == 0) { DataRow rowsd3 = tablereg.NewRow(); rowsd3[0] = "Styleid"; rowsd3[1] = "int"; rowsd3[2] = 0; tablereg.Rows.Add(rowsd3); } else { tablereg.Rows[0]["UserName"] = 0; } } catch (Exception) { } try { if (tablereg.Select("FieldName='Recycler'").Length == 0) { DataRow rowsd4 = tablereg.NewRow(); rowsd4[0] = "Recycler"; rowsd4[1] = "int"; rowsd4[2] = 0; tablereg.Rows.Add(rowsd4); } else { tablereg.Rows[0]["Recycler"] = 0; } } catch (Exception) { } try { if (tablereg.Select("FieldName='IsCreate'").Length == 0) { DataRow rowsd5 = tablereg.NewRow(); rowsd5[0] = "IsCreate"; rowsd5[1] = "int"; rowsd5[2] = 0; tablereg.Rows.Add(rowsd5); } else { tablereg.Rows[0]["IsCreate"] = 0; } } catch (Exception) { } try { if (tablereg.Select("FieldName='NewTime'").Length == 0) { DataRow rs6 = tablereg.NewRow(); rs6[0] = "NewTime"; rs6[1] = "DateType"; rs6[2] = DateTime.Now; tablereg.Rows.Add(rs6); } else { tablereg.Rows[0]["NewTime"] = DateTime.Now; } } catch (Exception) { } } if (tablereg != null && tablereg.Rows.Count > 0) { buser.InsertModel(tablereg, usertablename); } } #endregion if (SiteConfig.UserConfig.EmailCheckReg && !string.IsNullOrEmpty(info.Email))//发送认证邮件,当需要邮件认证时 { //[c]需要新的邮件收发模块 //MailInfo mailInfo = new MailInfo(); //mailInfo.IsBodyHtml = true; //mailInfo.FromName = SiteConfig.SiteInfo.SiteName; //MailAddress address = new MailAddress(info.Email); //mailInfo.ToAddress = address; //string regurl = siteurls + "/User/Index/RegEmailCheck?UserName="******"&CheckNum=" + info.CheckNum; //string mailcontent = mailBll.SelByType(B_MailManage.MailType.NewUserReg); //mailInfo.MailBody = new OrderCommon().TlpDeal(mailcontent, GetRegEmailDt(info.UserName, info.CheckNum, regurl)); //mailInfo.Subject = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码"; //if (SendMail.Send(mailInfo) == SendMail.MailState.Ok) //{ // RegMessage = "注册验证码已成功发送到你的注册邮箱,请到邮箱查收并验证!"; // RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; //} //else //{ // RegMessage = "注册成功,但发送验证邮件失败,请检查邮件地址是否正确,或与网站管理员联系!"; // RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; //} } switch (info.Status) { case 0: #region 直接注册成功 //[c] //if (!string.IsNullOrEmpty(info.Email) && SiteConfig.UserConfig.EmailTell) //{ // MailInfo mailInfo = new MailInfo(); // mailInfo.IsBodyHtml = true; // mailInfo.FromName = SiteConfig.SiteInfo.SiteName; // MailAddress address = new MailAddress(info.Email); // mailInfo.ToAddress = address; // //SiteConfig.UserConfig.EmailOfRegCheck // string regurl = siteurls + "/User/Index/RegEmailCheck?UserName="******"&CheckNum=" + info.CheckNum; // mailInfo.MailBody = new OrderCommon().TlpDeal(mailBll.SelByType(B_MailManage.MailType.NewUserReg), GetRegEmailDt(info.UserName, info.CheckNum, regurl)); // //mailInfo.MailBody = mailInfo.MailBody.Replace("{$UserName}", info.UserName).Replace("{$UserPwd}", TxtPassword.Text); // mailInfo.Subject = SiteConfig.SiteInfo.SiteName + "_注册成功提醒"; // if (SendMail.Send(mailInfo) == SendMail.MailState.Ok) // { // RegMessage = "注册基本信息已成功发送到你的注册邮箱!"; // RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; // } // else // { // RegMessage = "注册成功,但发送注册基本信息邮件失败,请检查邮件地址是否正确,或与网站管理员联系!"; // RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; // } //} //else //{ RegMessage = "注册成功!"; if (string.IsNullOrEmpty(ReturnUrl)) { RegMessage = RegMessage + "<a href=\"/\">返回首页</a> <a href=\"/User/Index\">进入会员中心</a>,5秒后系统自动跳转到会员中心!"; RegRUrl = "/User/Index"; } else { RegMessage = RegMessage + "<a href=\"/\">返回首页</a> <a href=\"" + ReturnUrl + "\">进入默认页面</a>,5秒后系统自动跳转到默认页面!"; RegRUrl = ReturnUrl; } isok = true; //} #endregion break; case 2: //等待管理员认证 { RegMessage = "注册成功!新注册会员需管理员认证才能有效,请耐心等待!"; RegMessage = RegMessage + "若长期没有通过管理员认证,请及时和管理员联系!"; RegMessage = RegMessage + "<a href=\"/\">返回首页</a>"; } break; default: //未开启邮箱验证,则可以登录 //if (!SiteConfig.UserConfig.EmailCheckReg) { RegMessage = "注册成功!"; } if (string.IsNullOrEmpty(ReturnUrl)) { RegMessage = "注册成功<a href=\"/\">返回首页</a> <a href=\"/User/Index\">进入会员中心</a>,5秒后系统自动跳转到会员中心!"; RegRUrl = "default"; } else { RegMessage = "<a href=\"/\">返回首页</a> <a href=\"" + ReturnUrl + "\">进入默认页面</a>,5秒后系统自动跳转到默认页面!"; RegRUrl = ReturnUrl; } isok = true; break; } if (SiteConfig.UserConfig.EmailCheckReg) { RegMessage = "<div class='emptyDiv'><br/>注册成功! <a href='http://mail." + info.Email.Substring(info.Email.LastIndexOf('@') + 1) + "' target='_blank'>立即登录邮箱进行验证>></a><br/></div>"; isok = false; } ViewBag.RegMessage = RegMessage; ViewBag.RegRUrl = RegRUrl; ViewBag.isok = isok;//为true则自动跳转 ViewBag.pwd = RequestEx["TxtPassword"]; return(View("Register_Finish", info)); }