protected void Button1_Click(object sender, EventArgs e) { B_SiteInfo bsiteinfo = new B_SiteInfo(); model.SendId = buser.GetCookie().UserID; model.SendName = buser.GetCookie().LogName; model.Title = bsiteinfo.GetFiltering(Title.Text); model.Content = bsiteinfo.GetFiltering(Function.Encode(Content.Text)); model.IsSend = 1; model.ReceiverDel = 0; model.SendDel = 0; model.AddDate = DateTime.Now; model.OverdueDate = DateTime.Now; model.TypeId = 1; string sReceiverName = ReceiverName.Text; if (sReceiverName == "") { Function.ShowMsg(0, "<li>请输入用户</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } if (Title.Text.ToString() == "") { Function.ShowMsg(0, "<li>请输入标题</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } if (Content.Text.ToString() == "") { Function.ShowMsg(0, "<li>请输入内容</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } string AllUserName = ""; for (int i = 0; i < Function.GetSplit(sReceiverName, "|").Length; i++) { muser = buser.GetUser(Function.GetSplit(sReceiverName, "|")[i]); if (muser != null) { if (muser.UserID != 0) { model.ReceiverId = muser.UserID; model.ReceiverName = muser.LogName; model.IsRead = 0; model.AllUser = 0; model.UserGroupId = 0; bll.Insert(model); AllUserName += "[" + muser.LogName + "]"; } } } if (AllUserName == "") Function.ShowMsg(0, "<li>没有符合条件的用户</li><li><a href='Message/MessageList.aspx?TypeId=1'>返回短消息列表</a></li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); else Function.ShowMsg(1, "<li>成功给" + AllUserName + "用户发送短消息!</li><li><a href='Message/MessageList.aspx?TypeId=1'>返回短消息列表</a></li>"); }
protected void btnOk_Click(object sender, EventArgs e) { if (FId != 0) { if (txtReply.Text.Trim() == "") { Function.ShowMsg(0, "<li>回复内容不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } M_Feedback model = new M_Feedback(); B_SiteInfo siteBll = new B_SiteInfo(); model.Content = siteBll.GetFiltering(txtReply.Text); model.ParentId = FId; model.EndDate = model.ReplyDate = DateTime.Now; model.Ip = Request.UserHostAddress; model.Author = user.GetCookie().LogName; model.Title = ""; model.CategoryId = Convert.ToInt32(feedback.GetFeedback(FId).Tables[0].Rows[0]["CategoryId"]); model.State = 0; feedback.Add(model); txtReply.Text = ""; Response.Redirect("MyFeedback.aspx"); } }
protected void btnOk_Click(object sender, EventArgs e) { if (userModel != null) { if (txtTitle.Text.Trim() == "") { Function.ShowMsg(0, "<li>对不起,请输入问答标题</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } if (lsbCategory.SelectedValue == "") { Function.ShowMsg(0, "<li>对不起,请选择分类</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } M_Feedback model = new M_Feedback(); int rewardNum = int.Parse(ddlReward.SelectedValue); if (userModel.Integral >= rewardNum) { model.Reward = rewardNum; } else { Function.ShowMsg(0, "<li>您的积分不够,不能设置为 "+rewardNum+" 的悬赏分</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } model.ParentId = 0; model.ReplyDate = DateTime.Now; model.State = 0; model.Title = txtTitle.Text; model.Author = userModel.LogName; B_SiteInfo siteBll = new B_SiteInfo(); model.Content = siteBll.GetFiltering(txtContent.Text); model.Ip = Request.UserHostAddress; model.EndDate = DateTime.Now.AddDays(14); model.CategoryId = int.Parse(lsbCategory.SelectedValue); feedback.Add(model); rewardNum = rewardNum * -1; moneyBll.Integral(rewardNum, userModel.LogName); Response.Redirect("MyFeedback.aspx"); } }
/// <summary> /// 添加/修改专题 /// </summary> protected void btnAdd_Click(object sender, EventArgs e) { M_Special model = new M_Special(); if (txtCName.Text.Trim() == "" || txtEName.Text.Trim() == "") { Function.ShowSysMsg(0, "<li>专题中文名和英文名不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else { model.SpecialCName = txtCName.Text; model.SpecialEName = txtEName.Text; } string content = string.Empty; for (int i = 1; i <= 10; i++) { TextBox ctt = (TextBox)Page.FindControl("txtItemContent" + i); if (ctt.Text.Trim() != "") { content += ctt.Text; } content += "|"; } content = content.Substring(0, content.Length - 1); model.IsCommand = rblIsRcmd.SelectedValue == "1"; model.IsLock = rblIsLock.SelectedValue == "1"; model.MetaKeyWord = ""; model.MetaRemark = ""; model.ParentID = int.Parse(ddlSpeacil.SelectedValue); model.SaveDirType = ddlDirType.SelectedValue; model.SiteID = int.Parse(ddlChannel.SelectedValue); model.SpecialAddTime = DateTime.Now; model.SpecialDomain = txtDomain.Text; B_SiteInfo site = new B_SiteInfo(); model.SpecialRemark = site.GetFiltering(txtRemark.Text); model.SpecialContent = site.GetFiltering(content); model.SpecialItemNum = int.Parse(ddlItemNum.SelectedValue); model.Extension = rblExtension.SelectedValue; model.PicSavePath = "/" + txtPic.Text; if (txtTemplet.Text.Trim() == "") { Function.ShowSysMsg(0, "<li>专题模板路径不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else { model.SpecialTemplet = txtTemplet.Text; } if (Key != 0) { model.ID = Key; model.SpecialAddTime = DateTime.Parse(txtAddTime.Text); model.IsDeleted = Boolean.Parse(txtIsdelete.Text); special.Update(model); Response.Redirect("SpecialList.aspx"); } else { B_KyCommon kycomm = new B_KyCommon(); if (kycomm.CheckHas(txtEName.Text, "SpecialEName", "KySpecial")) { Function.ShowSysMsg(0, "<li>专题英文名重复,请修改</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else { special.Add(model); Response.Redirect("SpecialList.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetNoStore(); bool reviewIsCheck = false; B_Review bll = new B_Review(); B_SiteInfo SiteBll = new B_SiteInfo(); B_User bllUser = new B_User(); M_Review model = new M_Review(); M_User userModel = null; if (Request.Form["txtIsLogin"] == "False") { if (Request.Form["btnSubmit"] == "登录") { bool flaglogin = true; string msgBox = string.Empty; if (Request.Form["UserName"].ToString().Trim() == "") { flaglogin = false; msgBox = "<script>alert('用户名必须填写');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } else if (Request.Form["userPwd"].ToString().Trim() == "") { flaglogin = false; msgBox = "<script>alert('密码必须填写');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } if (flaglogin) { ltMsg.Text = ""; string logName = ""; string pwd = ""; string cookieType = ""; logName = Function.UrlDecode(Request.Form["UserName"].ToString()); pwd = Function.MD5Encrypt(Request.Form["userPwd"].ToString()); cookieType = "No"; if ((!string.IsNullOrEmpty(logName)) && (!string.IsNullOrEmpty(pwd))) { B_SiteInfo siteInfo = new B_SiteInfo(); M_Site siteModel = siteInfo.GetSiteModel(); M_User modelLogin = bllUser.GetUser(logName); if (modelLogin != null && siteModel != null) { //用户登录 bool flag = bllUser.Login(logName, pwd); if (flag && (!string.IsNullOrEmpty(cookieType))) { HttpCookie cookie = new HttpCookie("User"); cookie["uId"] = modelLogin.UserID.ToString(); cookie["logN"] = modelLogin.LogName; cookie["pd"] = modelLogin.UserPwd; switch (cookieType) { case "onehour": cookie.Expires = DateTime.Now.AddHours(1); break; case "oneday": cookie.Expires = DateTime.Now.AddDays(1); break; case "oneweek": cookie.Expires = DateTime.Now.AddDays(7); break; case "onemounth": cookie.Expires = DateTime.Now.AddMonths(1); break; case "oneyear": cookie.Expires = DateTime.Now.AddYears(1); break; case "No": default: break; } Response.Cookies.Add(cookie); string lastLoginIP = string.Empty; if (Request.UserHostAddress != null) { lastLoginIP = Request.UserHostAddress; } DateTime currLoginTime = DateTime.Now; DateTime oldLoginTime = modelLogin.LastLoginTime; bllUser.LoginSuccess(modelLogin.UserID, lastLoginIP, currLoginTime); if (oldLoginTime.Date != currLoginTime.Date) { B_Money moneyBll = new B_Money(); moneyBll.Integral(siteModel.LoginScore, modelLogin.UserID); } msgBox = "<script>alert('登录成功');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } else { msgBox = "<script>alert('登录失败');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } } else { msgBox = "<script>alert('登录失败');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } } } ltMsg.Text = msgBox; } else { if (Request.Form["hidNoName"].ToString() == "False") { ltMsg.Text = "<script>alert('本系统设置了不允许匿名评论,请先登录');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } else { //根据栏目的设置,对论评论审核进行初始化 if (Request.Form["hidColCommentSet"].ToString() == "True") reviewIsCheck = false; else reviewIsCheck = true; string validateCode = string.Empty; string flag = Request.Form["hidValidate"]; if (flag == "True") { if (Session["ValidateCode"] == null) { Response.Write("<script language='javascript'>alert('你在登陆页面停留的时间过长,验证码已经失效');window.history.back();</script>"); Response.End(); } //验证码错误 validateCode = Session["ValidateCode"].ToString().ToLower(); if (validateCode.ToLower() != Request.Form["txtValidate"].ToString().Trim().ToLower()) { Response.Write("<script language='javascript'>alert('验证码错误');window.history.back();</script>"); Response.End(); } } if (bllUser.IsLogin()) { M_User loginUserModel = bllUser.GetCookie(); userModel = bllUser.GetUser(loginUserModel.LogName); } model.ModelType = int.Parse(Request.Form["hidModeType"].ToString()); model.InfoId = Request.Form["hidNewsId"].ToString(); if (Request.Form["hidUserGroupViewIsCheck"] == "True" && bllUser.IsLogin()) reviewIsCheck = true; model.IsCheck = reviewIsCheck; model.ReviewTitle = ""; //评论标题 model.IsArgue = false; model.IsSquare = 3; model.BrarNum = 0; model.FightNum = 0; model.IsElite = false; model.ReviewContent = SiteBll.GetFiltering(Request.Form["txtContent"].ToString()); //评论内容 model.ReviewTime = DateTime.Now; //评论时间 if (bllUser.IsLogin()) //是否是登录用户 model.UserNum = userModel.UserID.ToString(); else model.UserNum = "0"; model.ReviewIP = Request.UserHostAddress; //评论用户的IP if (bll.Add(model)) { if (!reviewIsCheck) ltMsg.Text = "<script>alert('评论成功,将在审核后显示出来');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; else ltMsg.Text = "<script>window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } } } } else { if (Request.Form["hidNoName"].ToString() == "False") { ltMsg.Text = "<script>alert('本系统设置了不允许匿名评论,请先登录');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } else { //根据栏目的设置,对论评论审核进行初始化 if (Request.Form["hidColCommentSet"].ToString() == "True") reviewIsCheck = false; else reviewIsCheck = true; string validateCode = string.Empty; string flag = Request.Form["hidValidate"]; if (flag == "True") { if (Session["ValidateCode"] == null) { Response.Write("<script language='javascript'>alert('你在登陆页面停留的时间过长,验证码已经失效');window.history.back();</script>"); Response.End(); } //验证码错误 validateCode = Session["ValidateCode"].ToString().ToLower(); if (validateCode.ToLower() != Request.Form["txtValidate"].ToString().Trim().ToLower()) { Response.Write("<script language='javascript'>alert('验证码错误');window.history.back();</script>"); Response.End(); } } if (bllUser.IsLogin()) { M_User loginUserModel = bllUser.GetCookie(); userModel = bllUser.GetUser(loginUserModel.LogName); } model.ModelType = int.Parse(Request.Form["hidModeType"].ToString()); model.InfoId = Request.Form["hidNewsId"].ToString(); if (Request.Form["hidUserGroupViewIsCheck"] == "True" && bllUser.IsLogin()) reviewIsCheck = true; model.IsCheck = reviewIsCheck; model.ReviewTitle = ""; //评论标题 model.IsArgue = false; model.IsSquare = 3; model.BrarNum = 0; model.FightNum = 0; model.IsElite = false; model.ReviewContent = SiteBll.GetFiltering(Request.Form["txtContent"].ToString()); //评论内容 model.ReviewTime = DateTime.Now; //评论时间 if (bllUser.IsLogin()) //是否是登录用户 model.UserNum = userModel.UserID.ToString(); else model.UserNum = "0"; model.ReviewIP = Request.UserHostAddress; //评论用户的IP if (bll.Add(model)) { if (!reviewIsCheck) ltMsg.Text = "<script>alert('评论成功,将在审核后显示出来');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; else ltMsg.Text = "<script>window.location.href('" + Request.UrlReferrer.ToString() + "');</script>"; } } } }
/// <summary> /// 添加/修改 /// </summary> protected void btnAdd_Click(object sender, EventArgs e) { CheckInput(); if (flag != "Update")//说明是新增 { model = new M_Image(); //model.AddTime = DateTime.Now; //添加时间 if (txtAddTime.Text.Trim().Length != 0) { if (Function.IsDate(txtAddTime.Text.Trim().ToString())) model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString()); else Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else model.AddTime = DateTime.Now; model.IsCreated = false; model.IsDeleted = false; model.Status = 3; } else { //添加时间 if (txtAddTime.Text.Trim().Length != 0) { if (Function.IsDate(txtAddTime.Text.Trim().ToString())) model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString()); else Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } else model.AddTime = DateTime.Now; } model.AdminUId = adminModel.UserId; model.AdminUName = adminModel.AdminName; model.ChargeHourCount = Function.CheckNumber(txtChargeHourCount.Text) == true ? int.Parse(txtChargeHourCount.Text) : 0; for (int i = 1; i < 7; i++) { RadioButton chargType = Page.FindControl("rdBtnChargeType" + i) as RadioButton; if (chargType.Checked) { model.ChargeType = i; break; } } model.ChargeViewCount = Function.CheckNumber(txtChargeViewCount.Text) == true ? int.Parse(txtChargeViewCount.Text) : 0; model.ColId = int.Parse(Request.Form["ddlColumn"]); B_SiteInfo site=new B_SiteInfo(); model.Content = site.GetFiltering(txtContent.Text); string GroupId=""; for (int i = 0; i < UserGroup.Items.Count; i++) { if (UserGroup.Items[i].Selected) { GroupId += "|"+UserGroup.Items[i].Value; } } model.GroupIdStr = GroupId == "" ? "" : GroupId + "|"; model.HitCount = Function.CheckNumber(txtHitCount.Text) == true ? int.Parse(txtHitCount.Text) : 0; model.ImgPath = string.IsNullOrEmpty(Request.Form["imgs"]) == true ? "" : "|" + Request.Form["imgs"].Replace(",", "|") + "|"; model.IsAllowComment = property.Items[4].Selected; model.IsFocus = property.Items[2].Selected; model.IsOpened = int.Parse(rblIsOpened.SelectedValue); model.IsRecommend = property.Items[0].Selected; model.IsSideShow = (!rbTextTitle.Checked) && property.Items[3].Selected; model.IsTop = property.Items[1].Selected; model.PageType = rblPageType.SelectedIndex + 1; model.PointCount = Function.CheckNumber(txtPointCount.Text) == true ? int.Parse(txtPointCount.Text) : 0; string spclId = ""; for (int i = 0; i < lBoxTopicIdStr.Items.Count; i++) { if (lBoxTopicIdStr.Items[i].Selected) { spclId += "|" + lBoxTopicIdStr.Items[i].Value + "|"; } } model.SpecialIdStr = spclId; #region 关键字 string tagIdStr = string.Empty; string nameStr = txtTagNameStr.Text.Trim(); nameStr = Regex.Replace(nameStr, @"\s+", "|", RegexOptions.IgnoreCase); if (nameStr.Length != 0) { if (nameStr.StartsWith("|")) nameStr = nameStr.Substring(1, nameStr.Length - 1); if (nameStr.EndsWith("|")) nameStr = nameStr.Substring(0, nameStr.Length - 1); B_Tag tagBll = new B_Tag(); DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员"); if (dr != null) { tagIdStr = "|" + dr[0] + "|"; nameStr = "|" + dr[1] + "|"; } else { tagIdStr = ""; nameStr = ""; } } model.TagIdStr = tagIdStr; model.TagNameStr = nameStr; #endregion model.TemplatePath = txtTemplatePath.Text; model.Title = site.GetFiltering(txtTitle.Text); model.TitleColor = txtHeaderColor.Text; model.TitleFontType = int.Parse(ddlFontType.SelectedValue); model.TitleImgPath = rbPicTitle.Checked ? txtPicTitlePath.Text : ""; model.TitleType = rbTextTitle.Checked ? 1 : 2; model.UId = adminModel.UserId; model.UName = adminModel.AdminName; model.UpdateTime = DateTime.Now; model.UserType = 1; if (flag != "Update") { ImgId = imageBll.Add(model); if (property.Items[5].Selected) { DataRow dr = CreateBll.GetInfoById("kyimage", ImgId); CreateBll.CreateInfo(dr); } Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]); } else { imageBll.Update(model); if (property.Items[5].Selected) { DataRow dr = CreateBll.GetInfoById("kyimage", ImgId); CreateBll.CreateSingleInfo(dr); } Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]); } }
protected void Button1_Click(object sender, EventArgs e) { B_SiteInfo bsiteinfo = new B_SiteInfo(); string sSelectUserType = Request.Form["SelectUserType"]; string sTitle = bsiteinfo.GetFiltering(Title.Text); string sContent = bsiteinfo.GetFiltering(Function.Encode(Content.Text)); B_Admin adminBll = new B_Admin(); M_LoginAdmin loginModel = adminBll.GetLoginModel(); string sSendName = loginModel.AdminName.ToString(); string sOverdueDate = OverdueDate.Text; model.SendId = 0; model.SendName = sSendName; model.Title = sTitle; model.Content = sContent; model.IsSend = 1; model.ReceiverDel = 0; model.SendDel = 0; model.OverdueDate = DateTime.Parse(sOverdueDate); model.AddDate = DateTime.Now; model.TypeId = 1; //所有用户 if (sSelectUserType == "1") { model.ReceiverId = 0; model.ReceiverName = ""; model.IsRead = 1; model.AllUser = 1; model.UserGroupId = 0; bll.Insert(model); Function.ShowSysMsg(1, "<li>成功向所有用户发送短消息!</li><li><a href='WebMessage/WebMessage.aspx'>继续发送短消息</a> <a href='WebMessage/WebMessageList.aspx'>返回短消息管理列表</a></li>"); } //指定用户组 if (sSelectUserType == "2") { model.ReceiverId = 0; model.ReceiverName = ""; model.IsRead = 1; model.AllUser = 0; string MyUserGroupList = ""; if (UserGroupList.Items.Count > 0) { for (int i = 0; i < UserGroupList.Items.Count; i++) { if (UserGroupList.Items[i].Selected == true) { MyUserGroupList += UserGroupList.Items[i].Text+"、"; model.UserGroupId = int.Parse(UserGroupList.Items[i].Value.ToString()); bll.Insert(model); } } } Function.ShowSysMsg(1, "<li>成功向" + MyUserGroupList.Substring(0, MyUserGroupList.Length - 1) + "组发送短消息!</li><li><a href='WebMessage/WebMessage.aspx'>继续发送短消息</a> <a href='WebMessage/WebMessageList.aspx'>返回短消息管理列表</a></li>"); } //指定用户 if (sSelectUserType == "3") { string sUserNmuber = UserNmuber.Text; if (sUserNmuber == "") { Function.ShowSysMsg(0, "<li>请输入用户</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>"); } string MyUserNumber = ""; for (int i = 0; i < Function.GetSplit(sUserNmuber, "|").Length; i++) { muser = buser.GetUser(Function.GetSplit(sUserNmuber, "|")[i]); if (muser!=null) { MyUserNumber += Function.GetSplit(sUserNmuber, "|")[i] + "、"; model.ReceiverId = muser.UserID; model.ReceiverName = muser.LogName; model.IsRead = 0; model.AllUser = 0; model.UserGroupId = 0; bll.Insert(model); } } Function.ShowSysMsg(1, "<li>成功向" + MyUserNumber.Substring(0, MyUserNumber.Length - 1) + "用户发送短消息!</li><li><a href='WebMessage/WebMessage.aspx'>继续发送短消息</a> <a href='WebMessage/WebMessageList.aspx'>返回短消息管理列表</a></li>"); } }
protected void Set(bool isSet) { B_SiteInfo bsiteinfo = new B_SiteInfo(); model.SendId = buser.GetCookie().UserID; model.SendName = buser.GetCookie().LogName; model.Title = bsiteinfo.GetFiltering(Title.Text); model.Content = bsiteinfo.GetFiltering(Function.Encode(Content.Text)); if (isSet) model.IsSend = 1; else model.IsSend = 0; model.ReceiverDel = 0; model.SendDel = 0; model.AddDate = DateTime.Now; model.OverdueDate = DateTime.Now; model.TypeId = 1; string sReceiverName = ReceiverName.Text; if (sReceiverName == "") { lbMsg.Text = "<script>alert('请输入收件人')</script>"; return; } if (Title.Text.ToString() == "") { lbMsg.Text = "<script>alert('请输入标题')</script>"; return; } if (Content.Text.ToString() == "") { lbMsg.Text = "<script>alert('请输入内容')</script>"; return; } string AllUserName = ""; muser = buser.GetUser(sReceiverName); if (muser != null) { if (muser.UserID != 0) { model.ReceiverId = muser.UserID; model.ReceiverName = muser.LogName; model.IsRead = 0; model.AllUser = 0; model.UserGroupId = 0; bll.Insert(model); AllUserName = muser.LogName; } } if (AllUserName == "") { lbMsg.Text = "<script>alert('没有符合条件的用户')</script>"; return; } else { if (isSet) { lbMsg.Text = "<script>alert('成功给用户" + AllUserName + "发送短消息');hiddenIframe();</script>"; return; } else { lbMsg.Text = "<script>alert('成功保存草稿');hiddenIframe()</script>"; return; } } }