//存草稿//
        protected void Button1_Click(object sender, EventArgs e)
        {
            B_Message message = new B_Message();

            if (Page.IsValid)
            {
                M_Message messInfo = new M_Message();
                if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
                {
                    messInfo = message.SelReturnModel(Convert.ToInt32(Request.QueryString["Drafid"]));
                }
                User_T.Text         = StrHelper.RemoveDupByIDS(User_T.Text);
                messInfo.Incept     = buser.SelUserIDByOA(User_T.Text);
                messInfo.Sender     = buser.GetLogin().UserID.ToString();
                messInfo.Title      = this.TxtTitle.Text;
                messInfo.PostDate   = DateTime.Now;
                messInfo.Content    = this.EditorContent.Text;
                messInfo.Savedata   = 1;
                messInfo.Receipt    = "";
                messInfo.Attachment = SaveFile();
                if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
                {
                    messInfo.Attachment = (hasFileData.Value + "," + SaveFile()).Trim(',');
                    B_Message.Update(messInfo);
                }
                else
                {
                    message.GetInsert(messInfo);
                }
            }
            Response.Redirect("MessageDraftbox.aspx");
        }
 //步骤改变时,发送站内邮件给目标用户
 public void emailToUser(string content, string ids)
 {
     mailMod.Title    = "系统提醒";
     mailMod.MsgType  = 3;
     mailMod.Content  = content;//XXXX流程已进入下一步,XXXX
     mailMod.CCUser   = ids;
     mailMod.Sender   = "1";
     mailMod.PostDate = DateTime.Now;
     mailBll.GetInsert(mailMod);
 }
예제 #3
0
        protected void Send_Btn_Click(object sender, EventArgs e)
        {
            M_UserInfo mu       = buser.GetLogin();
            M_Message  messInfo = new M_Message();

            messInfo.Incept = buser.GetIdsByUserName(TxtInceptUser.Text.Trim());
            if (string.IsNullOrEmpty(messInfo.Incept.Trim(',')))
            {
                function.WriteErrMsg("收件人不存在!");
            }
            messInfo.Sender     = mu.UserID.ToString();
            messInfo.Title      = Server.HtmlEncode(TxtTitle.Text);
            messInfo.Content    = EditorContent.Text;
            messInfo.Savedata   = 0;
            messInfo.Receipt    = "";
            messInfo.Attachment = Attach_Hid.Value;
            msgBll.GetInsert(messInfo);
            function.WriteSuccessMsg("发送成功", "MessageOutbox.aspx");
        }
        //发送
        protected void BtnSend_Click(object sender, EventArgs e)
        {
            M_UserInfo mu = buser.GetLogin();

            if (mu.MailSize != -1)//邮箱容量检测
            {
                float surSize = CheckMailSize(mu);
                float upSize  = 0;
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    if (Request.Files[i].ContentLength < 1)
                    {
                        continue;
                    }
                    upSize += float.Parse((Request.Files[i].ContentLength / 1024f / 1024f).ToString("0.0"));
                }
                if (surSize <= upSize)//如果剩余容量小于该次上传的附件容量
                {
                    function.Script(this, "alert('邮箱空间已满,无法发送邮件:" + MailRemind(mu) + "');");
                    return;
                }
            }
            M_Message messInfo = new M_Message();

            if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
            {
                messInfo = msgBll.SelReturnModel(Convert.ToInt32(Request.QueryString["Drafid"]));
            }
            string UserID = buser.GetLogin().UserID.ToString();

            //发送
            messInfo.Incept   = buser.GetIdsByUserName(User_T.Text.Trim());
            messInfo.Sender   = UserID;
            messInfo.Title    = this.TxtTitle.Text;
            messInfo.PostDate = DataConverter.CDate(DateTime.Now);
            messInfo.Content  = this.EditorContent.Text;
            messInfo.Savedata = 0;
            messInfo.Receipt  = "";
            messInfo.CCUser   = buser.SelUserIDByOA(CCUser_T.Text.Trim());
            if (string.IsNullOrEmpty(messInfo.Incept.Replace(",", "")))
            {
                function.WriteErrMsg("收件人不存在,请检测输入是否正确");
            }
            messInfo.Attachment = SaveFile().TrimEnd(',');
            if (!string.IsNullOrEmpty(Request.QueryString["Drafid"]))
            {
                messInfo.Attachment = (hasFileData.Value + "," + SaveFile()).Trim(',');
                B_Message.Update(messInfo);
            }
            else
            {
                msgBll.GetInsert(messInfo);
            }
            Response.Redirect("MessageOutbox.aspx");
        }
예제 #5
0
        public IActionResult Message_Add()
        {
            M_Message msgMod = new M_Message();

            if (Mid > 0)
            {
                msgMod = msgBll.SelReturnModel(Mid);
            }
            msgMod.Savedata = 0;
            msgMod.status   = 1;
            FillMsgModel(msgMod);
            if (msgMod.MsgID > 0)
            {
                msgBll.UpdateByID(msgMod);
            }
            else
            {
                msgMod.Sender = mu.UserID; msgMod.UserName = mu.UserName; msgBll.GetInsert(msgMod);
            }

            return(WriteOK("发送成功", "MessageOutbox"));
        }
예제 #6
0
        public void Message_Add()
        {
            M_Message msgMod = new M_Message();

            if (Mid > 0)
            {
                msgMod = msgBll.SelReturnModel(Mid);
            }
            msgMod.Savedata = 0;
            msgMod.status   = 1;
            FillMsgModel(msgMod);
            if (msgMod.MsgID > 0)
            {
                msgBll.UpdateByID(msgMod);
            }
            else
            {
                msgMod.Sender = mu.UserID; msgMod.UserName = mu.UserName; msgBll.GetInsert(msgMod);
            }

            function.WriteSuccessMsg("发送成功", "MessageOutbox");
        }
        protected void Draft_Btn_Click(object sender, EventArgs e)
        {
            M_Message messInfo = new M_Message();

            messInfo.Sender   = buser.GetLogin().UserID.ToString();
            messInfo.Title    = Server.HtmlEncode(TxtTitle.Text);
            messInfo.Content  = EditorContent.Text;
            messInfo.Savedata = 1;
            messInfo.Receipt  = "";
            messInfo.status   = 0;
            bmsg.GetInsert(messInfo);
            function.WriteSuccessMsg("短信息已存入草稿箱!", "Message.aspx");
        }
        //统一状态码  -1:失败,99:成功
        //以下都限制为只能获取用户所在的公司
        public void ProcessRequest(HttpContext context)
        {
            M_APIResult retMod = new M_APIResult();

            retMod.retcode = M_APIResult.Failed;
            M_User_Plat upMod  = null;
            string      value  = context.Request.Form["value"];
            string      result = "";

            switch (Action)
            {
            case "plat_compuser":    //获取公司中成员,用于@功能
            {
                upMod = B_User_Plat.GetLogin();
                DataTable dt = upBll.SelByCompWithAT(upMod.CompID);
                result = JsonHelper.JsonSerialDataTable(dt);
                OldRep(result);
            }
            break;

            case "getuinfo":    //获取单个用户信息(只允许获取本公司),返回的信息存入Json,避免重复检测,后期将服务端也缓存化
            {
                upMod = B_User_Plat.GetLogin();
                int         uid   = Convert.ToInt32(value);
                M_User_Plat model = upBll.SelReturnModel(uid, upMod.CompID);
                if (model != null)
                {
                    result = "{\"id\":\"" + model.UserID + "\",\"UserID\":\"" + model.UserID + "\",\"UserName\":\"" + model.TrueName + "\",\"Mobile\":\"" + model.Mobile + "\",\"GroupName\":\"" + model.GroupName.Trim(',') + "\",\"UserFace\":\"" + model.UserFace + "\"}";
                }
                OldRep(result);
            }
            break;

            case "getnotify":    //获取提醒
            {
                B_Notify notBll = new B_Notify();
                if (B_Notify.NotifyList.Count < 1)
                {
                    retMod.retmsg = "none";
                }
                else
                {
                    notBll.RemoveExpire();        //去除超时的
                    M_UserInfo      mu    = new B_User().GetLogin();
                    List <M_Notify> list  = notBll.GetNotfiyByUid(mu.UserID);
                    DataTable       retdt = new DataTable();
                    retdt.Columns.Add(new DataColumn("title", typeof(string)));
                    retdt.Columns.Add(new DataColumn("content", typeof(string)));
                    retdt.Columns.Add(new DataColumn("cuname", typeof(string)));
                    if (list.Count > 0)
                    {
                        foreach (M_Notify model in list)        //有多个就发多条
                        {
                            notBll.AddReader(model, mu.UserID);
                            DataRow dr = retdt.NewRow();
                            dr["title"]   = model.Title;
                            dr["content"] = model.Content;
                            dr["cuname"]  = model.CUName;
                            retdt.Rows.Add(dr);
                        }
                    }
                    retMod.retcode = M_APIResult.Success;
                    retMod.result  = JsonConvert.SerializeObject(retdt);
                }
                RepToClient(retMod);
            }
            break;

            case "newblog":    //自己公司有无新的信息
            {
                upMod  = B_User_Plat.GetLogin();
                result = msgBll.SelByDateForNotify(Req("date"), upMod).ToString();
                OldRep(result);
            }
            break;

            case "privatesend":    //私信功能,走邮件模块
            {
                upMod = B_User_Plat.GetLogin();
                if (upMod != null)
                {
                    string msg      = context.Request.Form["msg"];
                    string receuser = context.Request.Form["receuser"];
                    if (!string.IsNullOrWhiteSpace(msg) && !string.IsNullOrWhiteSpace(receuser) && SafeSC.CheckIDS(receuser))
                    {
                        //过滤非用户公司的同事,后期处理
                        M_Message msgMod = new M_Message();
                        B_Message msgBll = new B_Message();
                        msgMod.Incept     = receuser;
                        msgMod.Sender     = upMod.UserID.ToString();
                        msgMod.Title      = upMod.TrueName + "的私信";
                        msgMod.PostDate   = DateTime.Now;
                        msgMod.Content    = msg;
                        msgMod.Savedata   = 0;
                        msgMod.Receipt    = "";
                        msgMod.CCUser     = "";
                        msgMod.Attachment = "";
                        msgBll.GetInsert(msgMod);
                        result = "99";
                        //添加一条新提醒
                        B_Notify.AddNotify(upMod.UserName, "你收到一封私信", msgMod.Title, msgMod.Incept);
                    }
                    else
                    {
                        result = "-1";
                    }
                }
                else
                {
                    result = "0";
                }                             //未登录
                OldRep(result);
                break;
            }

            case "addread":    //阅读量统计
            {
                string ids = context.Request.Form["ids"];
                msgBll.AddRead(ids.Trim(','));
                OldRep("1");
            }
            break;
            }
        }
예제 #9
0
        //common.ashx
        public ContentResult Common()
        {
            string value  = GetParam("value");
            string result = "";
            string action = GetParam("action");

            switch (action.ToLower())
            {
            default:
                return(Content("未匹配接口"));

            case "plat_compuser":    //获取公司中成员,用于@功能
            {
                DataTable dt = upBll.SelByCompWithAT(upMod.CompID);
                result = JsonHelper.JsonSerialDataTable(dt);
                return(Content(result));
            }

            case "getuinfo":    //获取单个用户信息(只允许获取本公司),返回的信息存入Json,避免重复检测,后期将服务端也缓存化
            {
                int         uid   = Convert.ToInt32(value);
                M_User_Plat model = upBll.SelReturnModel(uid, upMod.CompID);
                if (model != null)
                {
                    result = "{\"id\":\"" + model.UserID + "\",\"UserID\":\"" + model.UserID + "\",\"UserName\":\"" + model.TrueName + "\",\"Mobile\":\"" + model.Mobile + "\",\"GroupName\":\"" + model.GroupName.Trim(',') + "\",\"UserFace\":\"" + model.UserFace + "\"}";
                }
                return(Content(result));
            }

            case "getnotify":    //获取提醒
            {
                //B_Notify notBll = new B_Notify();
                //if (B_Notify.NotifyList.Count < 1) { retMod.retmsg = "none"; }
                //else
                //{
                //    notBll.RemoveExpire();//去除超时的
                //    List<M_Notify> list = notBll.GetNotfiyByUid(mu.UserID);
                //    DataTable retdt = new DataTable();
                //    retdt.Columns.Add(new DataColumn("title", typeof(string)));
                //    retdt.Columns.Add(new DataColumn("content", typeof(string)));
                //    retdt.Columns.Add(new DataColumn("cuname", typeof(string)));
                //    if (list.Count > 0)
                //    {
                //        foreach (M_Notify model in list)//有多个就发多条
                //        {
                //            notBll.AddReader(model, mu.UserID);
                //            DataRow dr = retdt.NewRow();
                //            dr["title"] = model.Title;
                //            dr["content"] = model.Content;
                //            dr["cuname"] = model.CUName;
                //            retdt.Rows.Add(dr);
                //        }
                //    }
                //    retMod.retcode = M_APIResult.Success;
                //    retMod.result = JsonConvert.SerializeObject(retdt);
                //}
                return(Content(retMod.ToString()));
            }

            case "newblog":    //自己公司有无新的信息
            {
                result = msgBll.SelByDateForNotify(GetParam("date"), upMod).ToString();
                return(Content(result));
            }

            case "privatesend":    //私信功能,走邮件模块
            {
                if (upMod != null)
                {
                    string msg      = GetParam("msg");
                    string receuser = GetParam("receuser");
                    if (!string.IsNullOrWhiteSpace(msg) && !string.IsNullOrWhiteSpace(receuser) && SafeSC.CheckIDS(receuser))
                    {
                        //过滤非用户公司的同事,后期处理
                        M_Message msgMod = new M_Message();
                        B_Message msgBll = new B_Message();
                        msgMod.Incept     = receuser;
                        msgMod.Sender     = upMod.UserID;
                        msgMod.Title      = upMod.TrueName + "的私信";
                        msgMod.PostDate   = DateTime.Now;
                        msgMod.Content    = msg;
                        msgMod.Savedata   = 0;
                        msgMod.Receipt    = "";
                        msgMod.CCUser     = "";
                        msgMod.Attachment = "";
                        msgBll.GetInsert(msgMod);
                        result = "99";
                        //添加一条新提醒
                        //B_Notify.AddNotify(upMod.UserName, "你收到一封私信", msgMod.Title, msgMod.Incept);
                    }
                    else
                    {
                        result = "-1";
                    }
                }
                else
                {
                    result = "0";
                }                             //未登录
                return(Content(result));
            }

            case "addread":    //阅读量统计
            {
                string ids     = GetParam("ids");
                string paraIds = "";
                Dictionary <string, DateTime> dataValue;
                //为True说明ReadData中有该用户浏览记录
                if (ReadData.TryGetValue(mu.UserID, out dataValue))
                {
                    //移除超时的记录并剔除IDS中在30s内浏览过的记录ID
                    foreach (string id in ids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                    {
                        bool isRead = true;
                        foreach (string key in new List <string>(dataValue.Keys))
                        {
                            //移除超过30s的记录
                            if ((DateTime.Now - dataValue[key]).TotalMilliseconds > 30000)
                            {
                                dataValue.Remove(key); continue;
                            }
                            //30s内浏览过的内容不+阅读量
                            if (key.Contains("," + id + ","))
                            {
                                isRead = false; break;
                            }
                        }
                        if (isRead)
                        {
                            paraIds += id + ",";
                        }
                    }
                    paraIds = paraIds.Trim(',');
                    //保存本次浏览记录
                    if (!dataValue.ContainsKey("," + paraIds + ","))
                    {
                        dataValue.Add("," + paraIds + ",", DateTime.Now);
                    }
                }
                else
                {
                    dataValue = new Dictionary <string, DateTime>();
                    paraIds   = ids.Trim(',');
                    dataValue.Add("," + paraIds + ",", DateTime.Now);
                    //保存记录
                    ReadData.Add(mu.UserID, dataValue);
                }
                msgBll.AddRead(paraIds);
                return(Content("1"));
            }
            }
        }