protected void Save_Btn_Click(object sender, EventArgs e) { M_User_Plat upMod = B_User_Plat.GetLogin(); M_Common_Notify comMod = new M_Common_Notify(); if (Mid > 0) { comMod = comBll.SelReturnModel(Mid); } comMod.Title = Title_T.Text; comMod.Content = Content_T.Text; comMod.BeginDate = Convert.ToDateTime(BeginDate_T.Text); if (!comMod.ReceOrgin.Equals(manage_hid.Value)) { comMod.ReceOrgin = StrHelper.IdsFormat(manage_hid.Value); comMod.ReceUsers = StrHelper.IdsFormat(StrHelper.RemoveRepeat(comMod.ReceOrgin.Split(','), comMod.ReadedUsers.Split(','))); } if (Mid > 0) { comBll.UpdateByID(comMod); } else { comMod.NType = 2; comMod.InfoID = MsgID; comMod.CUser = upMod.UserID; comMod.CUName = upMod.UserName; comBll.Insert(comMod); } function.WriteSuccessMsg("操作成功"); }
public IActionResult Client_Add(M_CRMS_Client model) { if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.office, "crm")) { } model.ClientType = StrHelper.IdsFormat(Request.Form["ClientType"]); model.ID = Mid; M_ModelInfo modMod = modBll.SelReturnModel(48); DataTable fieldDT = fieldBll.SelByModelID(modMod.ModelID, false); DataTable table = Call.GetDTFromMVC(fieldDT, Request); model.ModelID = modMod.ModelID; model.ModelTable = modMod.TableName; model.CAdminID = adminMod.AdminId; model.LinkIds = Request.Form["LinkIds"]; if (model.ID < 1) { model.ID = clientBll.Insert(model, table); } else { M_CRMS_Client clientMod = clientBll.SelReturnModel(Mid); model.ItemID = clientMod.ItemID; model.CDate = clientMod.CDate; model.CUserID = clientMod.CUserID; model.Flow = clientMod.Flow; clientBll.UpdateByID(model, table); } return(WriteOK("操作成功", "ClientList")); }
public IActionResult Client_Add(M_CRMS_Client model) { model.ClientType = StrHelper.IdsFormat(RequestEx["ClientType"]); model.ID = Mid; M_ModelInfo modMod = modBll.SelReturnModel(48); //DataTable fieldDT = fieldBll.SelByModelID(modMod.ModelID, false); //DataTable table = new Call().GetDTFromMVC(fieldDT, Request); model.ModelID = modMod.ModelID; model.ModelTable = modMod.TableName; model.CUserID = mu.UserID; model.LinkIds = RequestEx["LinkIds"]; if (model.ID < 1) { model.ID = clientBll.Insert(model, new DataTable()); } else { M_CRMS_Client clientMod = clientBll.SelReturnModel(Mid); model.ItemID = clientMod.ItemID; model.CDate = clientMod.CDate; model.CUserID = clientMod.CUserID; model.Flow = clientMod.Flow; clientBll.UpdateByID(model, new DataTable()); } return(WriteOK("操作成功", "ConstPassen")); }
protected void SaveBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(UserIDS_Hid.Value) || string.IsNullOrEmpty(ids_Hid.Value)) { function.WriteErrMsg("未指定借阅人,或需要借阅的文档!"); } M_UserInfo mu = buser.GetLogin(); M_OA_Borrow borMod = new M_OA_Borrow(); if (Mid > 0) { borMod = borBll.SelReturnModel(Mid); } borMod.UserID = mu.UserID; borMod.Uids = StrHelper.IdsFormat(UserIDS_Hid.Value); //借阅人 borMod.UNames = buser.GetUserNameByIDS(borMod.Uids); borMod.DocIDS = StrHelper.IdsFormat(ids_Hid.Value); //借阅公文 borMod.DocTitles = oaBll.SelTitleByIDS(borMod.DocIDS); borMod.EDate = Convert.ToDateTime(EDate_T.Text); if (Mid > 0) { borBll.UpdateByID(borMod); } else { borBll.Insert(borMod); } Response.Redirect("BorrowList.aspx"); }
/// <summary> /// 按uids清除缓存,用于通知用户重新获取 /// </summary> public static void ClearByIDS(string ids) { if (string.IsNullOrEmpty(ids)) { return; } ids = StrHelper.IdsFormat(ids); string keys = ""; //后期改为搜索而不遍历 foreach (var item in UserSession) { if (ids.Contains("," + item.Value.UserID + ",")) { keys += item.Key + ","; } } ClearByKeys(keys); }
private M_Blog_Msg FillMsg(string msg, out string puremsg, int pid = 0, int rid = 0, string files = "") { puremsg = msg; M_User_Plat upMod = B_User_Plat.GetLogin(); M_Blog_Msg model = new M_Blog_Msg(); model.MsgType = 1; model.Status = 1; model.CUser = upMod.UserID; model.CUName = upMod.TrueName; model.ProID = CurProID; model.CompID = upMod.CompID; model.pid = pid; model.ReplyID = rid; #region 信息内容处理 //#话题(转码后会带有#符号,所以需要转码前处理完成) if (msg.Contains("#")) { msg = msg.Replace(deftopic, ""); string tlp = "<a href='/Plat/Blog?Skey={0}' title='话题浏览'>{1}</a>"; Dictionary <string, string> itemDic = new Dictionary <string, string>(); for (int i = 0; !string.IsNullOrEmpty(regHelper.GetValueBySE(msg, "#", "#", false)) && i < 5; i++)//最多不能超过5个话题 { string topic = "#" + regHelper.GetValueBySE(msg, "#", "#", false) + "#"; msg = msg.Replace(topic, "{" + i + "}"); topic = topic.Replace(" ", "").Replace(",", ""); itemDic.Add("{" + i + "}", string.Format(tlp, Server.UrlEncode(topic), topic)); model.Topic += topic + ","; } msg = HttpUtility.HtmlEncode(msg); foreach (var item in itemDic) { msg = msg.Replace(item.Key, item.Value); } } else { msg = HttpUtility.HtmlEncode(msg); } //URL转链接 { string tlp = "<a href='{0}' target='_blank'>{0}</a>"; MatchCollection mcs = regHelper.GetUrlsByStr(msg); foreach (Match m in mcs) { //同网址,信息替换多次会产生Bug,如多个www.baidu.com string url = m.Value.IndexOf("://") < 0 ? "http://" + m.Value : m.Value; msg = msg.Replace(m.Value, string.Format(tlp, url)); } } //表情 { if (!string.IsNullOrEmpty(ImgFace_Hid.Value)) { string imgHtml = "<img src='/Plugins/Ueditor/dialogs/emotion/{0}' class='imgface_img' />"; DataTable imgDT = JsonHelper.JsonToDT(ImgFace_Hid.Value); foreach (DataRow dr in imgDT.Rows) { msg = msg.Replace(dr["title"].ToString(), string.Format(imgHtml, dr["realurl"].ToString())); puremsg = puremsg.Replace(dr["title"].ToString(), ""); } } } //@功能 { MatchCollection mc = regHelper.GetValuesBySE(msg, "@", "]"); int id = 0; string atuser = "", atgroup = "", name = ""; string uTlp = "<a href='javascript:;' onclick='ShowUser({0});'>{1}</a>"; string gTlp = "<a href='javascript:;' onclick='ShowGroup({0});'>{1}</a>"; foreach (Match m in mc) { //@what130[uid:19],名字替换为超链接,之后的取值取入数据库 if (string.IsNullOrEmpty(m.Value)) { continue; } if (m.Value.Contains("uid:")) { id = DataConvert.CLng(regHelper.GetValueBySE(m.Value, "uid:", "]", false)); name = regHelper.GetValueBySE(m.Value, "@", @"\[").Replace("[", ""); atuser += id + ","; msg = msg.Replace(m.Value, string.Format(uTlp, id, name)); } else if (m.Value.Contains("gid:")) { id = DataConvert.CLng(regHelper.GetValueBySE(m.Value, "gid:", "]", false)); name = regHelper.GetValueBySE(m.Value, "@", @"\[").Replace("[", ""); atgroup += id + ","; msg = msg.Replace(m.Value, string.Format(gTlp, id, name)); } puremsg = puremsg.Replace(m.Value, ""); } if (!string.IsNullOrEmpty(atuser) || !string.IsNullOrEmpty(atgroup)) { atuser += upBll.SelByGIDS(atgroup); if (!string.IsNullOrEmpty(atuser.Replace(",", ""))) { model.ATUser = StrHelper.IdsFormat(atuser); //model.ATUser = model.ATUser.Replace("," + upMod.UserID, "");//过滤自己 //提示被@人 M_Notify notifyMod = new M_Notify(); notifyMod.CUName = upMod.UserName; notifyMod.Title = "Hi,[" + B_User.GetUserName(upMod.TrueName, upMod.UserName) + "]@你了,点击查看详情"; notifyMod.Content = puremsg.Length > 30 ? puremsg.Substring(0, 30) : puremsg; notifyMod.ReceUsers = model.ATUser; B_Notify.NotifyList.Add(notifyMod); } } } //-------------------------------- msg = msg.Replace("\r", "").Replace("\n", "<br/>");//替换换行标识 #endregion //msg = msg.Replace("'", "\'"); model.MsgContent = msg; if (rid > 0) { M_Blog_Msg msgMod = msgBll.SelReturnModel(model.ReplyID); model.ReplyUserID = msgMod.CUser; model.ReplyUName = msgMod.CUName; } if (string.IsNullOrEmpty(files) && !string.IsNullOrEmpty(Request.Form["Attach_Hid"])) { files = SafeSC.PathDeal(Request.Form["Attach_Hid"].Trim()); } if (!string.IsNullOrEmpty(files))//为安全,不允许全路径,必须后台对路径处理 { string uppath = B_Plat_Common.GetDirPath(B_Plat_Common.SaveType.Blog); foreach (string file in files.Split('|')) { if (string.IsNullOrEmpty(file)) { continue; } model.Attach += uppath + file + "|"; } } if (!string.IsNullOrEmpty(Request.Form["GOnlyMe_Chk"])) { model.GroupIDS = "0"; } else { model.GroupIDS = string.IsNullOrEmpty(Request.Form["GroupIDS_Chk"]) ? "" : Request.Form["GroupIDS_Chk"];//后期需加入检测,避免前台伪造 } model.ColledIDS = ""; return(model); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <M_UserInfo> Dinfo = new List <M_UserInfo>(); List <M_Uinfo> Iinfo = new List <M_Uinfo>(); mu = buser.SelReturnModel(UserID); if (mu.IsNull) { function.WriteErrMsg("用户[" + UserID + "]不存在"); } basemu = buser.GetUserBaseByuserid(UserID); //判断是否是认证用户 ApproveFailure_B.Visible = (mu.State == 2); if (DataConvert.CLng(mu.ParentUserID) > 0) { pmu = buser.SelReturnModel(Convert.ToInt32(mu.ParentUserID)); } Dinfo.Add(mu); Iinfo.Add(basemu); UInfo_RPT.DataSource = Dinfo; UInfo_RPT.DataBind(); BaseMU_RPT.DataSource = Iinfo; BaseMU_RPT.DataBind(); #region 增加模型选项卡 DataTable dtModelUser = bm.GetListUser(); string labstr = ""; int tabnum = 3; for (int i = 0; i < dtModelUser.Rows.Count; i++) { string tablename = dtModelUser.Rows[i]["TableName"].ToString(); DataTable info = bmf.SelectTableName(tablename, "userid=" + UserID); if (info != null && info.Rows.Count > 0) { int modelid = Convert.ToInt32(dtModelUser.Rows[i]["ModelId"].ToString()); DataTable modelfiled = bmf.GetModelFieldList(modelid); labstr += "<td id=\"TabTitle" + (tabnum) + ("\" class=\"tabtitle\" onclick=\"ShowTabss(" + (tabnum)) + ")\">\r"; labstr += dtModelUser.Rows[i]["ModelName"].ToString() + "\r"; labstr += ("</td>\r"); tabTitles += ", \"TabTitle" + (tabnum) + "\""; tabs += ", \"Tabs" + (tabnum) + "\""; ltlTab.Text += "<tbody id=\"Tabs" + (tabnum) + "\" style=\"display: none\">"; ltlTab.Text += "<tr>"; ltlTab.Text += "<td colspan=\"4\">"; ltlTab.Text += " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">"; for (int k = 0; k < modelfiled.Rows.Count; k++) { if (k % 2 == 0) { ltlTab.Text += "<tr class=\"tdbg\">\r"; } ltlTab.Text += "<td class=\"tdbgleft\" style=\"width: 15%; height: 22px\" align=\"right\">\r"; ltlTab.Text += modelfiled.Rows[k]["FieldAlias"].ToString() + "\r"; ltlTab.Text += "</td>\r"; ltlTab.Text += "<td style=\"width: 35%; height: 22px\" align=\"left\">\r"; ltlTab.Text += info.Rows[0][modelfiled.Rows[k]["FieldName"].ToString()].ToString() + "\r"; ltlTab.Text += "</td>\r"; if (k % 2 != 0) { ltlTab.Text += "</tr>\r"; } } ltlTab.Text += " </table>"; ltlTab.Text += " </td>"; ltlTab.Text += " </tr>"; ltlTab.Text += "</tbody>"; tabnum++; } } #endregion tbSign.Text = basemu.Sign; txtDeadLine.Text = mu.DeadLine.ToString();//有效期截止时间 txtCerificateDeadLine.Text = mu.CerificateDeadLine.ToString(); Privancy.Text = tbPrivacy.SelectedValue.ToString(); Privancy.Text = tbPrivacy.Items[basemu.Privating].Text; DataTable dtuser2 = buser.GetUserBaseByuserid(UserID.ToString()); lblHtml.Text = bub.GetUpdateHtml(dtuser2); BindUserRole(mu); AuthorDT = null; //----------------- try { DataTable gpdt = gpBll.Sel(); UserGroup_DP.DataSource = gpdt; UserGroup_DP.DataBind(); UserGroup_DP.Items.Insert(0, new ListItem("未分组", "0")); UserGroup_DP.SelectedValue = mu.GroupID.ToString(); } catch { UserGroup_DP.Items[0].Text = "会员组[" + mu.GroupID + "]不存在"; } M_User_BindPro ubpMod = ubpBll.SelModelByUid(UserID); if (ubpMod != null && !string.IsNullOrEmpty(ubpMod.ProIDS)) { UPProDT = proBll.SelByIDS(StrHelper.PureIDSForDB(ubpMod.ProIDS)); string pids = "", nids = ""; foreach (DataRow dr in UPProDT.Rows) { pids += dr["ID"] + ","; } foreach (DataRow dr in UPProDT.Rows) { nids += dr["NodeID"] + ","; } nids = nids.TrimEnd(','); pids.TrimEnd(','); DataTable nodedt = nodeBll.SelByIDS(nids); UPRONode_RPT.DataSource = nodedt; UPRONode_RPT.DataBind(); UProIDS_Hid.Value = StrHelper.IdsFormat(pids); } if (DataConvert.CStr(Request["show"]) == "diag") { Call.HideBread(Master); } else { Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='AdminManage.aspx'>用户管理</a></li><li><a href='UserManage.aspx'>会员管理</a></li><li class='active'><a href='" + Request.RawUrl + "'>会员信息</a> 当前用户:" + mu.UserName + "</li>"); } } }
public M_Blog_Msg FillMsg(string msg, int pid = 0, int rid = 0) { M_User_Plat upMod = B_User_Plat.GetLogin(); M_Blog_Msg model = new M_Blog_Msg(); model.MsgType = 1; model.Status = 1; model.CUser = upMod.UserID; model.CUName = upMod.TrueName; #region 信息内容处理 msg = Server.HtmlEncode(msg); //避免写入js,后面可插入Html //------处理@功能 //@功能 { MatchCollection mc = regHelper.GetValuesBySE(msg, "@", "]"); int id = 0; string atuser = "", atgroup = "", name = ""; string uTlp = "<a href='javascript:;' onclick='ShowUser({0});'>{1}</a>"; string gTlp = "<a href='javascript:;' onclick='ShowGroup({0});'>{1}</a>"; foreach (Match m in mc) { if (string.IsNullOrEmpty(m.Value)) { continue; } if (m.Value.Contains("uid:")) { id = DataConvert.CLng(regHelper.GetValueBySE(m.Value, "uid:", "]", false)); name = regHelper.GetValueBySE(m.Value, "@", @"\[").Replace("[", ""); atuser += id + ","; msg = msg.Replace(m.Value, string.Format(uTlp, id, name)); } else if (m.Value.Contains("gid:")) { id = DataConvert.CLng(regHelper.GetValueBySE(m.Value, "gid:", "]", false)); name = regHelper.GetValueBySE(m.Value, "@", @"\[").Replace("[", ""); atgroup += id + ","; msg = msg.Replace(m.Value, string.Format(gTlp, id, name)); } msg = msg.Replace(m.Value, ""); } if (!string.IsNullOrEmpty(atuser) || !string.IsNullOrEmpty(atgroup)) { atuser += upBll.SelByGIDS(atgroup); if (!string.IsNullOrEmpty(atuser.Replace(",", ""))) { model.ATUser = StrHelper.IdsFormat(atuser); //model.ATUser = model.ATUser.Replace("," + upMod.UserID, "");//过滤自己 //提示被@人 M_Notify notifyMod = new M_Notify(); notifyMod.CUName = upMod.UserName; notifyMod.Title = "Hi,有人@你了,点击查看详情"; notifyMod.Content = msg.Length > 30 ? msg.Substring(0, 30) : msg; notifyMod.ReceUsers = model.ATUser; B_Notify.NotifyList.Add(notifyMod); } } } #endregion model.MsgContent = msg; model.pid = pid; model.ReplyID = rid; if (rid > 0) { M_Blog_Msg msgMod = msgBll.SelReturnModel(model.ReplyID); model.ReplyUserID = msgMod.CUser; model.ReplyUName = msgMod.CUName; } if (!string.IsNullOrEmpty(Request.Form["Attach_Hid"]))//为安全,不允许全路径,必须后台对路径处理 { string uppath = B_Plat_Common.GetDirPath(B_Plat_Common.SaveType.Blog); M_UserInfo bus = buser.GetLogin(); string files = SafeSC.PathDeal(Request.Form["Attach_Hid"].Trim()); foreach (string file in files.Split('|')) { if (string.IsNullOrEmpty(file)) { continue; } model.Attach += uppath + file + "|"; } } model.GroupIDS = Request.Form["GroupIDS_Chk"];//后期需加入检测,避免前台伪造 model.ColledIDS = ""; //model.CompID = upMod.CompID; return(model); }
public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; string action = request["action"]; string result = ""; //传两个uid,rece目标uid switch (action) { case "sendmsg": { string uid = request.Form["uid"]; M_OnlineUser mu = chatBll.GetModelByUid(uid); M_ChatMsg model = new M_ChatMsg(); model.UserID = mu.UserID; model.UserName = mu.UserName; model.UserFace = mu.UserFace; model.Content = request.Form["content"]; model.ReceUser = StrHelper.IdsFormat(request.Form["rece"]); chatBll.Insert(model); B_ChatMsg.MsgList.Add(model); result = "99"; //更新在线用户信息(一个计数,每过十秒更新一次状态) response.Write(result); } break; case "getmsg": //同时更新在线状态 { string uid = request.Form["uid"]; //我要接收谁的信息 string rece = request.Form["rece"]; //在线用户在进页面的时候加入这里只更新,用户自已提交ID上来 M_OnlineUser mu = chatBll.GetModelByUid(uid); List <M_ChatMsg> msglist = msgBll.GetMsgByUid(mu.UserID.ToString(), rece); string contents = ""; chatBll.UpdateTime(mu.UserID.ToString()); string onlinelist = chatBll.GetOnlineStr(); //在线列表IDS格式 string unread = chatBll.GetMsgCount(mu.UserID); foreach (M_ChatMsg model in msglist) { //model.ReceUser = model.ReceUser.Replace("," + mu.UserID + ",", ",");//移除用户指示 result += "{\"UserName\":\"" + model.UserName + "\",\"UserFace\":\"" + model.UserFace + "\",\"CDate\":\"" + model.CDate.ToString("HH:mm:ss") + "\"},"; contents += boundary + model.Content; } result = result.TrimEnd(','); result = "[" + result + "]"; result += boundary + onlinelist; result += boundary + unread; result += contents; response.Write(result); } break; case "getonline": //初次登录时检测一次 { string uid = context.Request.Form["uid"]; chatBll.UpdateTime(uid); result = chatBll.GetOnlineStr(); //在线列表IDS格式 response.Write(result); } break; case "userlogin": //用户与游客登录 { string uname = request.Form["name"]; string userid = request.Form["userid"]; M_OnlineUser model = chatBll.GetUser(uname, userid); result = "{\"UserID\":\"" + model.UserID + "\",\"UserName\":\"" + model.UserName + "\",\"UserFace\":\"" + model.UserFace + "\"}"; response.Write(result); } break; case "getonlinelist": result = chatBll.GetOnlineJson(true); //在线列表Json格式 response.Write(result); break; case "gethistorymsg": //获取聊天记录: { string uid = request.Form["uid"]; //我要接收谁的信息 string rece = request.Form["rece"]; M_OnlineUser mu = chatBll.GetModelByUid(uid); DataTable msglist = msgBll.SelHistoryMsg(mu.UserID.ToString(), rece); chatBll.UpdateTime(mu.UserID.ToString()); string contents = ""; foreach (DataRow dr in msglist.Rows) { result += "{\"UserName\":\"" + dr["UserName"] + "\",\"UserFace\":\"" + dr["UserFace"] + "\",\"CDate\":\"" + Convert.ToDateTime(dr["CDate"]).ToString("HH:mm:ss") + "\",\"Type\":\"" + (mu.UserName.Equals(dr["UserName"]) ? "my" : "other") + "\"},"; contents += boundary + dr["Content"]; } result = result.TrimEnd(','); result = "[" + result + "]"; result += contents; response.Write(result); } break; case "getunreadmsg": //获取未读消息 { string uid = request.Form["uid"]; M_OnlineUser mu = chatBll.GetModelByUid(uid); List <M_ChatMsg> msglist = msgBll.GetUnreadMsgByUid(mu.UserID.ToString()); string contents = ""; chatBll.UpdateTime(mu.UserID.ToString()); foreach (M_ChatMsg model in msglist) { result += "{\"UserID\":\"" + model.UserID + "\",\"UserName\":\"" + model.UserName + "\",\"UserFace\":\"" + model.UserFace + "\",\"CDate\":\"" + model.CDate.ToString("HH:mm:ss") + "\"},"; contents += boundary + model.Content; } result = result.TrimEnd(','); result = "[" + result + "]"; result += contents; response.Write(result); } break; } response.Flush(); response.End(); }