Ejemplo n.º 1
0
        public object SaveMail(string JsonData, string IsSend, string ReplyParamData, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            try
            {
                B_Email email = JsonConvert.DeserializeObject<B_Email>(JsonData);
                string Mail_Id = ComClass.GetGuid();
                var userInfor = ComClass.GetUserInfo(userid);
                StringBuilder stringBuilder = new StringBuilder();
                //有无抄送若没有抄送清空抄送人
                if (email.isHaveCC == false)
                {
                    email.CCId = "";
                    email.CCName = "";
                }
                else
                {
                    //判断抄送人是否为空
                    if (email.CCId == null || email.CCId == "")
                    {
                        stringBuilder.Append("/b请选择抄送人");
                    }
                }

                //有没有密送若没有密送清空密送人
                if (email.isHaveSecretCC == false)
                {
                    email.CCSecretId = "";
                    email.CCSecretIdName = "";
                }
                else
                {
                    //判断密送人是否为空
                    if (email.CCSecretId == null || email.CCSecretId == "")
                    {
                        stringBuilder.Append("/b请选择密送人");
                    }
                }

                if (stringBuilder.Length > 0)
                {
                    return Utility.JsonMsg(false, stringBuilder.ToString());
                }

                //有没有附件
                if (email.Mail_SendAttachment == null || email.Mail_SendAttachment == "" || email.Mail_SendAttachment == "null")
                {
                    email.haveAttachment = false;
                }
                else
                {
                    email.haveAttachment = true;
                }

                //将其保存为草稿
                if (email.Mail_ID == null || email.Mail_ID == "")
                {//添加
                    email.Mail_ID = Mail_Id;
                    email.Mail_CreateData = DateTime.Now.ToString();//发送时间
                    email.ID = email.Mail_ID;// +"_" + DateTime.Now.ToLocalTime().ToString();/ID主键
                    email.Mail_SendPersonId = userid;//发件人ID
                    email.Mail_SendPersonName = userInfor.CnName;//发件人姓名
                    email.Mail_Deleted = "0";//是否已删除
                    email.Mail_deletedPerson = "";//删除人
                    email.Mail_Type = "0";//类型,0 未发送,草稿,1已发送
                    email.MailDocumentType = "chaogao";//的文件夹分类 默认是0收件箱
                    email.Mail_IsSee = "0";//是否已被查看
                    email.markId = "";//标签id
                    email.markName = "";//标签名称
                    email.markColor = "";//标签颜色
                    email.whosEmailId = userid;//邮件拥有者
                    Utility.Database.Insert<B_Email>(email, tran);
                }
                else
                {//修改
                    email.Condition.Add("ID=" + email.ID);
                    Utility.Database.Update<B_Email>(email, tran);

                }

                //发送邮件
                if (IsSend == "1")
                {

                    //保存发件
                    if (email.isSaveSendBox == true)
                    {
                        email.Condition.Add("ID=" + email.ID);
                        email.Mail_Type = "1";//邮件类型--已经发送
                        email.MailDocumentType = "fajian";//的文件夹分类 默认是0收件箱
                        email.Mail_SendDate = DateTime.Now.ToString();//发送时间
                        email.emailRecieveDate = DateTime.Now.ToString();//接收事件
                        Utility.Database.Update<B_Email>(email, tran);//修改发件人的数据
                    }
                    else
                    {
                        email.Condition.Add("ID=" + email.ID);
                        Utility.Database.Delete(email, tran);
                    }
                    if (email.Mail_SendPersonId != null && email.Mail_SendPersonId != "")
                    {
                        string[] sendIdArray = email.Mail_ReceivePersonId.Split(';');
                        for (int i = 0; i < sendIdArray.Length - 1; i++)
                        {
                            B_Email sendEmail = new B_Email();
                            sendEmail.ID = email.ID + sendIdArray[i];//主键
                            sendEmail.Mail_ID = email.Mail_ID;//关联ID
                            sendEmail.Mail_Title = email.Mail_Title;//主题
                            sendEmail.Mail_SendText = email.Mail_SendText;//发送内容
                            sendEmail.Mail_SendPersonId = email.Mail_SendPersonId;//发件人ID
                            var sendUserInfor = ComClass.GetUserInfo(sendEmail.Mail_SendPersonId);
                            sendEmail.Mail_SendPersonName = sendUserInfor.CnName;//发件人姓名
                            sendEmail.Mail_SendDate = email.Mail_SendDate;//发送时间
                            sendEmail.Mail_ReceivePersonId = sendIdArray[i];//接收人ID
                            sendEmail.Mail_ReceivePersonName = email.Mail_ReceivePersonName;
                            sendEmail.Mail_SendAttachment = email.Mail_SendAttachment;//附件
                            sendEmail.Mail_Deleted = "0";//是否删除0为未删除
                            sendEmail.Mail_Type = "1";//邮件类别(1已发送0草稿)
                            sendEmail.Mail_CreateData = DateTime.Now.ToString();//创建时间
                            sendEmail.Mail_IsSee = "0";//是否已读0未读1已读
                            sendEmail.MailDocumentType = "shoujian";//电子邮件文件夹类型
                            // sendEmail.isSaveSendBox = email.isSaveSendBox;//是否保存到发件箱
                            sendEmail.isImportant = email.isImportant;//是否是重要的邮件
                            sendEmail.isReadReceipt = email.isReadReceipt;//是否发送查看回执1发送回执0不回执
                            sendEmail.haveAttachment = email.haveAttachment;//是否有附件
                            sendEmail.CCId = email.CCId;//抄送人
                            sendEmail.CCName = email.CCName;//抄送人姓名
                            sendEmail.emailRecieveDate = DateTime.Now.ToString();//收件时间
                            sendEmail.markId = "";//标记ID
                            sendEmail.markName = "";//标记名称
                            sendEmail.markColor = "";//标记颜色
                            sendEmail.whosEmailId = sendIdArray[i]; //邮件拥有者
                            Utility.Database.Insert<B_Email>(sendEmail, tran);
                        }

                    }

                    //创建抄送发件
                    if (email.CCId != null || email.CCId != "")
                    {

                        string[] ccIdArray = email.CCId.Split(';');
                        for (int i = 0; i < ccIdArray.Length - 1; i++)
                        {
                            B_Email ccEmail = new B_Email();
                            ccEmail.ID = email.ID + ccIdArray[i] + "_cc";//主键
                            ccEmail.Mail_ID = email.Mail_ID;//关联ID
                            ccEmail.Mail_Title = email.Mail_Title;//主题
                            ccEmail.Mail_SendText = email.Mail_SendText;//发送内容
                            ccEmail.Mail_SendPersonId = email.Mail_SendPersonId;//发件人
                            ccEmail.Mail_SendDate = email.Mail_SendDate;//发送时间
                            ccEmail.Mail_ReceivePersonId = ccIdArray[i];//接收人
                            ccEmail.Mail_ReceivePersonName = email.Mail_ReceivePersonName;
                            var sendUserInfor = ComClass.GetUserInfo(ccIdArray[i]);
                            ccEmail.Mail_SendPersonName = sendUserInfor.CnName;//发件人姓名
                            ccEmail.Mail_SendAttachment = email.Mail_SendAttachment;//附件
                            ccEmail.Mail_Deleted = "0";//是否删除0为未删除
                            ccEmail.Mail_Type = "1";//邮件类别(1已发送0草稿)
                            ccEmail.Mail_CreateData = DateTime.Now.ToString();//创建时间
                            ccEmail.Mail_IsSee = "0";//是否已读0未读1已读
                            ccEmail.MailDocumentType = "shoujian";//电子邮件文件夹类型
                            // sendEmail.isSaveSendBox = email.isSaveSendBox;//是否保存到发件箱
                            ccEmail.isImportant = email.isImportant;//是否是重要的邮件
                            ccEmail.isReadReceipt = email.isReadReceipt;//是否发送查看回执1发送回执0不回执
                            ccEmail.haveAttachment = email.haveAttachment;//是否有附件
                            ccEmail.isHaveCC = true;//抄送人
                            ccEmail.CCId = email.CCId;//抄送人
                            ccEmail.CCName = email.CCName;//抄送人姓名
                            ccEmail.emailRecieveDate = DateTime.Now.ToString();//收件时间
                            ccEmail.isHaveSecretCC = false;
                            ccEmail.markId = "";//标记ID
                            ccEmail.markName = "";//标记名称
                            ccEmail.markColor = "";//标记颜色
                            ccEmail.whosEmailId = ccIdArray[i]; //邮件拥有者
                            Utility.Database.Insert<B_Email>(ccEmail, tran);
                        }
                    }

                    //创建密送发件
                    if (email.CCSecretId != null && email.CCSecretId != "")
                    {
                        string[] ccSecretIdArray = email.CCSecretId.Split(';');
                        for (int i = 0; i < ccSecretIdArray.Length - 1; i++)
                        {
                            B_Email ccsEmail = new B_Email();
                            ccsEmail.ID = email.ID + ccSecretIdArray[i] + "_ccs";//主键
                            ccsEmail.Mail_ID = email.Mail_ID;//关联ID
                            ccsEmail.Mail_Title = email.Mail_Title;//主题
                            ccsEmail.Mail_SendText = email.Mail_SendText;//发送内容
                            ccsEmail.Mail_SendPersonId = email.Mail_SendPersonId;//发件人
                            ccsEmail.Mail_SendDate = email.Mail_SendDate;//发送时间
                            ccsEmail.Mail_ReceivePersonId = ccSecretIdArray[i];//接收人
                            ccsEmail.Mail_ReceivePersonName = email.Mail_ReceivePersonName;
                            var sendUserInfor = ComClass.GetUserInfo(ccSecretIdArray[i]);
                            ccsEmail.Mail_SendPersonName = sendUserInfor.CnName;//发件人姓名
                            ccsEmail.Mail_SendAttachment = email.Mail_SendAttachment;//附件
                            ccsEmail.Mail_Deleted = "0";//是否删除0为未删除
                            ccsEmail.Mail_Type = "1";//邮件类别(1已发送0草稿)
                            ccsEmail.Mail_CreateData = DateTime.Now.ToString();//创建时间
                            ccsEmail.Mail_IsSee = "0";//是否已读0未读1已读
                            ccsEmail.MailDocumentType = "shoujian";//电子邮件文件夹类型
                            // sendEmail.isSaveSendBox = email.isSaveSendBox;//是否保存到发件箱
                            ccsEmail.isImportant = email.isImportant;//是否是重要的邮件
                            ccsEmail.isReadReceipt = email.isReadReceipt;//是否发送查看回执1发送回执0不回执
                            ccsEmail.haveAttachment = email.haveAttachment;//是否有附件
                            ccsEmail.CCId = email.CCId;//抄送人
                            ccsEmail.CCName = email.CCName;//抄送人姓名
                            ccsEmail.CCSecretId = email.CCSecretId;//密送人
                            ccsEmail.CCSecretIdName = email.CCSecretIdName;//密送人姓名
                            ccsEmail.isHaveCC = true;//抄送
                            ccsEmail.isHaveSecretCC = true;//密送
                            ccsEmail.emailRecieveDate = DateTime.Now.ToString();//收件时间
                            ccsEmail.markId = "";//标记ID
                            ccsEmail.markName = "";//标记名称
                            ccsEmail.markColor = "";//标记颜色
                            ccsEmail.whosEmailId = ccSecretIdArray[i]; //邮件拥有者
                            Utility.Database.Insert<B_Email>(ccsEmail, tran);
                        }
                    }

                    //若此邮件为回复邮件需要将原邮件的“是否回复”改成已经回复
                    if (ReplyParamData != null && ReplyParamData != "")
                    {
                        B_Email replyParamData = JsonConvert.DeserializeObject<B_Email>(ReplyParamData);
                        replyParamData.Condition.Add("ID=" + replyParamData.ID);
                        Utility.Database.Update<B_Email>(replyParamData, tran);
                        //StringBuilder strSql2 = new StringBuilder();

                        //strSql2.AppendFormat("update B_Email set haveReply =1 where ID ='{0}'", replyParamData.ID);

                        //Utility.Database.ExecuteNonQuery(strSql2.ToString());
                    }

                    Utility.Database.Commit(tran);
                    email = new B_Email();
                    return new
                    {
                        email = email
                    };
                }
                else
                {
                    Utility.Database.Commit(tran);
                    return JsonConvert.SerializeObject(email);
                }

            }
            catch (Exception e)
            {
                Utility.Database.Rollback(tran);
                throw (new Exception("保存失败!", e));
            }
        }
Ejemplo n.º 2
0
        public string SaveAricle(string JsonData, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            StringBuilder strSql = new StringBuilder();

            try
            {
                B_OA_Notice notice = JsonConvert.DeserializeObject<B_OA_Notice>(JsonData);

                //会议通知
                if (notice.isConferenceInform == false)
                {
                    notice.conferenceEndDate = null;
                }
                else
                {
                    if (notice.conferenceEndDate == "" || notice.conferenceEndDate == null)
                    {
                        strSql.Append("\n请输入会议时间");
                    }
                }
                //邮件送达
                if (notice.isSendEmail == false)
                {
                    notice.sendEmailToManId = "";
                    notice.sendEmailToManName = "";
                }
                else
                {
                    if (notice.sendEmailToManId == "" || notice.sendEmailToManId == null)
                    {
                        strSql.Append("\n请选择发件人");
                    }
                }
                //指定发布范围
                if (notice.publicRange == 0)
                {
                    notice.rangeCheckManId = "";
                    notice.rangeCheckManName = "";
                }
                else
                {
                    if (notice.rangeCheckManId == "" || notice.rangeCheckManId == null)
                    {
                        strSql.Append("\n请选择指定人员");
                    }
                }

                if (strSql.ToString().Length != 0)
                {
                    return Utility.JsonMsg(false, strSql.ToString()); //将对象转为json字符串并返回到客户端
                }

                if (notice.NewsId == null || notice.NewsId == "")
                {
                    notice.NewsId = ComClass.GetGuid();
                    notice.CreateTime = DateTime.Now.ToString();
                    notice.isSeeInDoor = false; //设置为已发布进入审核流程
                    Utility.Database.Insert(notice, tran);
                }
                else
                {
                    notice.Condition.Add("NewsId =" + notice.NewsId);
                    Utility.Database.Update(notice, tran);
                }

                var userInfor = ComClass.GetUserInfo(userid);

                //删除文章与目录关系表
                B_OA_Notice_FileType_R del_nf_R = new B_OA_Notice_FileType_R();
                del_nf_R.Condition.Add("noticeId = " + notice.NewsId);
                Utility.Database.Delete(del_nf_R, tran);
                //保存关系表
                string[] documenTypeArray = notice.documentTypeId.Split('/');
                for (int k = 0; k < documenTypeArray.Length; k++)
                {
                    B_OA_Notice_FileType_R nf_R = new B_OA_Notice_FileType_R();
                    nf_R.noticeId = notice.NewsId;
                    nf_R.fileTypeId = documenTypeArray[k];

                    Utility.Database.Insert(nf_R, tran);
                }

                //邮件送达
                if (notice.isSendEmail == true)
                {
                    string Mail_Id = ComClass.GetGuid();
                    //保存已发送
                    B_Email email = new B_Email();
                    email.Mail_ID = Mail_Id;
                    email.Mail_CreateData = DateTime.Now.ToString(); //发送时间
                    email.ID = Mail_Id; // +"_" + DateTime.Now.ToLocalTime().ToString();/ID主键
                    email.Mail_SendPersonId = userid; //发件人ID
                    email.Mail_SendPersonName = userInfor.CnName; //发件人姓名
                    email.Mail_Deleted = "0"; //是否已删除
                    email.Mail_deletedPerson = ""; //删除人
                    email.Mail_Type = "1"; //类型,0 未发送,草稿,1已发送
                    email.MailDocumentType = "fajian"; //的文件夹分类 默认是0收件箱
                    email.Mail_IsSee = "0"; //是否已被查看
                    email.markId = ""; //标签id
                    email.markName = ""; //标签名称
                    email.markColor = ""; //标签颜色
                    email.whosEmailId = userid; //邮件拥有者
                    email.Mail_SendDate = DateTime.Now.ToString(); //发送时间
                    email.emailRecieveDate = DateTime.Now.ToString(); //接收事件
                    email.isSaveSendBox = true; //保存发件
                    email.Mail_ReceivePersonId = notice.sendEmailToManId; //接收人ID
                    email.Mail_ReceivePersonName = notice.sendEmailToManName; //接收人名称
                    email.isImportant = true; //重要邮件
                    email.Mail_Title = "(来自文档中心)" + notice.NewsTitle; //标题
                    email.Mail_SendAttachment = notice.ShareAttachment; //附件
                    email.Mail_SendText = notice.NewsText; //内容
                    Utility.Database.Insert<B_Email>(email, tran);
                    //保存给发送方
                    string[] sendIdArray = email.Mail_ReceivePersonId.Split(';');
                    for (int i = 0; i < sendIdArray.Length - 1; i++)
                    {
                        B_Email sendEmail = new B_Email();
                        sendEmail.ID = email.ID + sendIdArray[i]; //主键
                        sendEmail.Mail_ID = email.Mail_ID; //关联ID
                        sendEmail.Mail_Title = email.Mail_Title; //主题
                        sendEmail.Mail_SendText = email.Mail_SendText; //发送内容
                        sendEmail.Mail_SendPersonId = email.Mail_SendPersonId; //发件人ID
                        var sendUserInfor = ComClass.GetUserInfo(sendEmail.Mail_SendPersonId);
                        sendEmail.Mail_SendPersonName = sendUserInfor.CnName; //发件人姓名
                        sendEmail.Mail_SendDate = email.Mail_SendDate; //发送时间
                        sendEmail.Mail_ReceivePersonId = sendIdArray[i]; //接收人ID
                        sendEmail.Mail_ReceivePersonName = email.Mail_ReceivePersonName;
                        sendEmail.Mail_SendAttachment = email.Mail_SendAttachment; //附件
                        sendEmail.Mail_Deleted = "0"; //是否删除0为未删除
                        sendEmail.Mail_Type = "1"; //邮件类别(1已发送0草稿)
                        sendEmail.Mail_CreateData = DateTime.Now.ToString(); //创建时间
                        sendEmail.Mail_IsSee = "0"; //是否已读0未读1已读
                        sendEmail.MailDocumentType = "shoujian"; //电子邮件文件夹类型
                        // sendEmail.isSaveSendBox = email.isSaveSendBox;//是否保存到发件箱
                        sendEmail.isImportant = email.isImportant; //是否是重要的邮件
                        sendEmail.isReadReceipt = email.isReadReceipt; //是否发送查看回执1发送回执0不回执
                        sendEmail.haveAttachment = email.haveAttachment; //是否有附件
                        sendEmail.CCId = email.CCId; //抄送人
                        sendEmail.CCName = email.CCName; //抄送人姓名
                        sendEmail.emailRecieveDate = DateTime.Now.ToString(); //收件时间
                        sendEmail.markId = ""; //标记ID
                        sendEmail.markName = ""; //标记名称
                        sendEmail.markColor = ""; //标记颜色
                        sendEmail.whosEmailId = sendIdArray[i]; //邮件拥有者
                        Utility.Database.Insert<B_Email>(sendEmail, tran);
                    }
                }

                //将指定人员查看存入关系表中
                if (notice.publicRange == 1)
                {
                    string rangeCheckManId = notice.rangeCheckManId;
                    string[] manIdArray = rangeCheckManId.Split(';');
                    //删除原数据
                    B_OA_Notice_AppointManSee manSee_Delete = new B_OA_Notice_AppointManSee();
                    manSee_Delete.Condition.Add("noticeid =" + notice.NewsId);
                    Utility.Database.Delete(manSee_Delete, tran);

                    for (var range = 0; range < manIdArray.Length - 1; range++)
                    {
                        B_OA_Notice_AppointManSee manSee = new B_OA_Notice_AppointManSee();
                        manSee.noticeid = notice.NewsId;
                        manSee.userid = manIdArray[range];
                        Utility.Database.Insert(manSee, tran);
                    }
                }

                Utility.Database.Commit(tran);
                return Utility.JsonMsg(true, "保存成功!"); //将对象转为json字符串并返回到客户端
            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex); //写异常日志到本地文件夹
                return Utility.JsonMsg(false, ex.Message); //将对象转为json字符串并返回到客户端
            }
        }
Ejemplo n.º 3
0
 public object GetAllEmailList(string userid)
 {
     var tran = Utility.Database.BeginDbTransaction();
     try
     {
         B_Email model = new B_Email();
         StringBuilder strSql = new StringBuilder();
         strSql.AppendFormat(@"select {0} from B_EMAIL as a  where  a.whosEmailId = '{1}' and  a.Mail_Deleted =0", FieldList, userid);
         DataSet dataSet = Utility.Database.ExcuteDataSet(strSql.ToString(), tran);
         string jsonData = JsonConvert.SerializeObject(dataSet.Tables[0]);
         List<B_Email> emailList = (List<B_Email>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_Email>));
         Utility.Database.Commit(tran);
         return new
         {
             model = model,
             emailList = emailList
         };
     }
     catch (Exception e)
     {
         Utility.Database.Rollback(tran);
         ComBase.Logger(e.Message);
         throw (new Exception("查找失败!", e));
     }
 }
Ejemplo n.º 4
0
 public object GetEmailModel(string id, string userid)
 {
     var tran = Utility.Database.BeginDbTransaction();
     try
     {
         B_Email model = new B_Email();
         model.whosEmailId = userid;
         B_Email para = new B_Email();
         if (!string.IsNullOrEmpty(id))
         {
             para.Condition.Add("ID =" + id);
             para = Utility.Database.QueryObject<B_Email>(para, tran);
         }
         Utility.Database.Commit(tran);
         return new
         {
             model = model,
             para = para
         };
     }
     catch (Exception e)
     {
         Utility.Database.Rollback(tran);
         ComBase.Logger(e.Message);
         throw (new Exception("查找失败!", e));
     }
 }
Ejemplo n.º 5
0
        public object DeleteEmailList(string JsonData, string userid)
        {
            var tran = Utility.Database.BeginDbTransaction();
            try
            {
                List<B_Email> listEmail = JsonConvert.DeserializeObject<List<B_Email>>(JsonData);
                foreach (B_Email newE in listEmail)
                {
                    newE.Condition.Add("ID=" + newE.ID);
                    Utility.Database.Delete(newE, tran);
                    //如果有附件,判断此附件是否已经是最后一条附件,若是则删除若不是则不删除,此机制用于邮件附件删除机制,以便不占内存空间
                    if (newE.haveAttachment == true)
                    {
                        B_Email d_Attach = new B_Email();
                        d_Attach.Condition.Add("Mail_SendAttachment like " + newE.Mail_SendAttachment);
                        List<B_Email> d_email = Utility.Database.QueryList<B_Email>(d_Attach, tran);
                        if (d_email.Count == 0)
                        {
                            string[] pathList = newE.Mail_SendAttachment.Split('|');
                            foreach (string path in pathList)
                            {
                                ComFileOperate.DeleteAttachment(path);
                            };
                        }
                    }
                }
                Utility.Database.Commit(tran);
                return Utility.JsonMsg(true, "保存成功!");
            }
            catch (Exception e)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(e.Message);
                throw (new Exception("保存失败!", e));

            }
        }
Ejemplo n.º 6
0
        public object UpdateB_EmailByIdSetMail_IsSee(string id, string mailIsSee, string userid, string emailType)
        {
            var tran = Utility.Database.BeginDbTransaction();
            try
            {
                B_Email email = new B_Email();
                email.Condition.Add("ID=" + id);
                email = Utility.Database.QueryObject<B_Email>(email);
                email.Mail_IsSee = mailIsSee;
                email.Condition.Add("ID=" + email.ID);
                Utility.Database.Update<B_Email>(email, tran);
                CounntModel countModel = new CounntModel();
                //刷新已读未读
                countModel = GetUnReadEmailCount(userid, tran, emailType);
                Utility.Database.Commit(tran);
                return new
                {
                    countModel = countModel
                };
            }
            catch (Exception e)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(e.Message);
                throw (new Exception("保存失败!", e));

            }
        }
 //邮件送达
 public void SendEmail(B_OA_Notice notice , IDbTransaction tran,string userid)
 {
     //邮件送达
     if (notice.isSendEmail == true)
     {
         string Mail_Id = ComClass.GetGuid();
         //保存已发送
         B_Email email = new B_Email();
         email.Mail_ID = Mail_Id;
         email.Mail_CreateData = DateTime.Now.ToString();//发送时间
         email.ID = Mail_Id;// +"_" + DateTime.Now.ToLocalTime().ToString();/ID主键
         email.Mail_SendPersonId = userid;//发件人ID
         var userInfor = ComClass.GetUserInfo(userid);
         email.Mail_SendPersonName = userInfor.CnName;//发件人姓名
         email.Mail_Deleted = "0";//是否已删除
         email.Mail_deletedPerson = "";//删除人
         email.Mail_Type = "1";//类型,0 未发送,草稿,1已发送
         email.MailDocumentType = "fajian";//的文件夹分类 默认是0收件箱
         email.Mail_IsSee = "0";//是否已被查看
         email.markId = "";//标签id
         email.markName = "";//标签名称
         email.markColor = "";//标签颜色
         email.whosEmailId = userid;//邮件拥有者
         email.Mail_SendDate = DateTime.Now.ToString();//发送时间
         email.emailRecieveDate = DateTime.Now.ToString();//接收事件
         email.isSaveSendBox = true;//保存发件
         email.Mail_ReceivePersonId = notice.sendEmailToManId;//接收人ID
         email.Mail_ReceivePersonName = notice.sendEmailToManName;//接收人名称
         email.isImportant = true;//重要邮件
         email.Mail_Title = "(来自文档中心)" + notice.NewsTitle;//标题
         email.Mail_SendAttachment = notice.ShareAttachment;//附件
         email.Mail_SendText = notice.NewsText;//内容
         Utility.Database.Insert<B_Email>(email, tran);
         //保存给发送方
         string[] sendIdArray = email.Mail_ReceivePersonId.Split(';');
         for (int i = 0; i < sendIdArray.Length - 1; i++)
         {
             B_Email sendEmail = new B_Email();
             sendEmail.ID = email.ID + sendIdArray[i];//主键
             sendEmail.Mail_ID = email.Mail_ID;//关联ID
             sendEmail.Mail_Title = email.Mail_Title;//主题
             sendEmail.Mail_SendText = email.Mail_SendText;//发送内容
             sendEmail.Mail_SendPersonId = email.Mail_SendPersonId;//发件人ID
             var sendUserInfor = ComClass.GetUserInfo(sendEmail.Mail_SendPersonId);
             sendEmail.Mail_SendPersonName = sendUserInfor.CnName;//发件人姓名
             sendEmail.Mail_SendDate = email.Mail_SendDate;//发送时间
             sendEmail.Mail_ReceivePersonId = sendIdArray[i];//接收人ID
             sendEmail.Mail_ReceivePersonName = email.Mail_ReceivePersonName;
             sendEmail.Mail_SendAttachment = email.Mail_SendAttachment;//附件
             sendEmail.Mail_Deleted = "0";//是否删除0为未删除
             sendEmail.Mail_Type = "1";//邮件类别(1已发送0草稿)
             sendEmail.Mail_CreateData = DateTime.Now.ToString();//创建时间
             sendEmail.Mail_IsSee = "0";//是否已读0未读1已读
             sendEmail.MailDocumentType = "shoujian";//电子邮件文件夹类型
             // sendEmail.isSaveSendBox = email.isSaveSendBox;//是否保存到发件箱
             sendEmail.isImportant = email.isImportant;//是否是重要的邮件
             sendEmail.isReadReceipt = email.isReadReceipt;//是否发送查看回执1发送回执0不回执
             sendEmail.haveAttachment = email.haveAttachment;//是否有附件
             sendEmail.CCId = email.CCId;//抄送人
             sendEmail.CCName = email.CCName;//抄送人姓名
             sendEmail.emailRecieveDate = DateTime.Now.ToString();//收件时间
             sendEmail.markId = "";//标记ID
             sendEmail.markName = "";//标记名称
             sendEmail.markColor = "";//标记颜色
             sendEmail.whosEmailId = sendIdArray[i]; //邮件拥有者
             Utility.Database.Insert<B_Email>(sendEmail, tran);
         }
     }
 }
Ejemplo n.º 8
0
 public string UpdateB_EmailByIdSetMail_IsSee(string id,string mailIsSee, string userid)
 {
     var tran = Utility.Database.BeginDbTransaction();
     try
     {
         B_Email email = new B_Email();
         email.Condition.Add("ID="+id);
         email = Utility.Database.QueryObject<B_Email>(email);
         email.Mail_IsSee = mailIsSee;
         Utility.Database.Commit(tran);
         return Utility.JsonMsg(true, "保存成功");
     }
     catch (Exception ex)
     {
         ComBase.Logger(ex.Message);
         return Utility.JsonMsg(false, ex.Message);
     }
 }
Ejemplo n.º 9
0
 public string GetEmailModel(string content)
 {
     B_Email model = new B_Email();
     return JsonConvert.SerializeObject( model);
 }
Ejemplo n.º 10
0
        public string UpdateB_EmailByIdSetMail_IsSee(string id, string mailIsSee, string userid, string emailType)
        {
            var tran = Utility.Database.BeginDbTransaction();
            try
            {
                B_Email email = new B_Email();
                email.Condition.Add("ID=" + id);
                email = Utility.Database.QueryObject<B_Email>(email);
                email.Mail_IsSee = mailIsSee;
                email.Condition.Add("ID=" + email.ID);
                Utility.Database.Update<B_Email>(email, tran);
                CounntModel countModel = new CounntModel();
                //刷新已读未读
                countModel = GetUnReadEmailCount(userid, tran, emailType);

                Utility.Database.Commit(tran);
                return JsonConvert.SerializeObject(countModel);
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex.Message);
                return Utility.JsonMsg(false, ex.Message);
            }
        }
Ejemplo n.º 11
0
 public string GetEmailModel(string content)
 {
     B_Email model = new B_Email();
     return Utility.JsonResult(true, null, model);
 }