Beispiel #1
0
        /// <summary>
        /// 用户订阅文档——赵英武
        /// </summary>
        /// <param name="resId"></param>
        public void BookRead(int resId)
        {
            CACLEntity acl = new CACLEntity();

            acl.Acl_Resource  = resId;
            acl.Acl_Operation = (int)ACLOPERATION.READ;
            if (!CheckPrivilege(acl))
            {
                throw new Exception("没有阅读权限!");
            }

            CMailEntity book = new CMailEntity();

            book.M_Organize = this.Usr_Organize;
            book.M_Resource = resId;
            book.M_UsrId    = this.Usr_Id;
            book.M_UsrMail  = this._Usr_Email;
            book.Insert();
        }
Beispiel #2
0
        public void DeleteResource(int resourceId)
        {
            CACLEntity acl = new CACLEntity(ConnString);

            acl.Acl_Resource  = resourceId;
            acl.Acl_Operation = (int)ACLOPERATION.WRITE;
            if (!CheckPrivilege(acl))
            {
                throw new Exception("没有写权限");
            }

            CResourceEntity res = new CResourceEntity(ConnString).Load(resourceId);

            res.Remove();

            CMailEntity mailRes = new CMailEntity();

            mailRes.Remove("this.M_Resource ='" + resourceId + "'");
        }
Beispiel #3
0
        /// <summary>
        /// 系统邮件服务——赵英武
        /// </summary>
        /// <param name="resId"></param>
        /// <param name="body"></param>
        public void MailSend(int resId, string body)
        {
            CMailEntity        mail     = new CMailEntity();
            List <CMailEntity> mailList = new List <CMailEntity>();
            string             filter   = "this.M_Resource ='" + resId + "'";

            filter  += "and this.M_Organize ='" + this.Usr_Organize + "'";
            mailList = mail.GetObjectList(filter);
            if (mailList.Count <= 0)
            {
                return;
            }

            COrganizeEntity org     = new COrganizeEntity().Load(this.Usr_Organize);
            string          from    = org.Org_Mail;
            string          subject = "文档管理系统邮件服务";
            string          pwd     = org.Org_MailPassword;

            SmtpClient client = new SmtpClient();

            client.Host = org.Org_MailSmtp;
            if (client.Host == null)
            {
                return;
            }
            if (org.Org_MailSSL == (int)SSL.CHECKED)
            {
                client.EnableSsl = true;
            }

            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Credentials    = new System.Net.NetworkCredential(from, pwd);

            foreach (CMailEntity m in mailList)
            {
                string      to  = m.M_UsrMail;
                MailMessage msg = new MailMessage(from, to, subject, body);
                client.Send(msg);
            }
        }