示例#1
0
        /// <summary>
        /// 发送
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbSendPerson.Text.Trim()))
            {
                lbErr.Text = "收件人不能为空";
                return;
            }
            if (string.IsNullOrEmpty(tbContent.Text.Trim()))
            {
                lbErr.Text = "内容不能为空";
                tbContent.Focus();
                return;
            }
            try
            {
                //Email表
                CY.CSTS.Core.Business.Email email = new CY.CSTS.Core.Business.Email();
                email.SenderID = new Guid("e1db5af7-fd84-4a1f-8625-6d1e7b37580c");//Session["UserId"]  需要
                email.Content = tbContent.Text.Trim();
                email.SendTime = DateTime.Now;
                email.Status = 1;//已发送
                HttpFileCollection files = HttpContext.Current.Request.Files;
                if (files[0].FileName==""||files[0].ContentLength==0)
                {
                    email.Annex = 2;//没有附件
                }
                else
                {
                    email.Annex = 1;//有附件
                }
                email.Save();

                //EmailAdditional表
                string[] receiveArray = hdReceiveID.Value.Split(',');//收件人
                for (int a = 0; a < receiveArray.Count(); a++)
                {
                    Guid receiverId = new Guid(receiveArray[a].ToString());
                    User u = CY.CSTS.Core.Business.User.Load(receiverId);
                    if (u != null)
                    {
                        CY.CSTS.Core.Business.EmailAdditional EmailAdditional = new EmailAdditional();
                        EmailAdditional.MailID = email.Id;
                        EmailAdditional.ReceiverID = receiverId;
                        EmailAdditional.Save();
                    }
                }
                //AnnexType表
                SaveFiles(email.Id);
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存短消息成功');window.location.href='EmailList.aspx'</script>");
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('" + ex.Message + "');</script>");
            }
        }
示例#2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbSendPerson.Text.Trim()))
            {
                lbErr.Text = "收件人不能为空";
                return;
            }
            if (string.IsNullOrEmpty(tbContent.Text.Trim()))
            {
                lbErr.Text = "内容不能为空";
                tbContent.Focus();
                return;
            }
            try
            {
                //Email表
                CY.CSTS.Core.Business.Email email = new CY.CSTS.Core.Business.Email();
                CY.CSTS.Core.Business.User uu = Session["User"] as CY.CSTS.Core.Business.User;
                email.SenderID = uu.Id;
                email.Content = tbContent.Text.Trim();
                email.CreateTime= DateTime.Now;
                email.Status = 2;//未发送
                HttpFileCollection files = HttpContext.Current.Request.Files;
                int isAnnex = 0;
                if (files[0].FileName==""||files[0].ContentLength==0)
                {
                    email.Annex = 2;//没有附件
                    isAnnex = 2;
                }
                else
                {
                    email.Annex = 1;//有附件
                    isAnnex = 1;
                }
                email.Save();

                //EmailAdditional表
                string[] receiveArray = tbSendPerson.Text.Split(',');//收件人
                for (int a = 0; a < receiveArray.Count(); a++)
                {
                    User u = CY.CSTS.Core.Business.User.GetUserByUserId(receiveArray[a].ToString());
                    if (u != null)
                    {
                        CY.CSTS.Core.Business.EmailAdditional EmailAdditional = new EmailAdditional();
                        EmailAdditional.MailID = email.Id;
                        EmailAdditional.ReceiverID = u.Id;
                        EmailAdditional.ReceiveStatus = 2;//未读
                        EmailAdditional.Save();
                    }
                }
                //AnnexType表
                if (isAnnex == 1)
                {
                    SaveFiles(email.Id);
                }
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存短消息成功');window.location.href='Email.aspx'</script>");
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('" + ex.Message + "');</script>");
            }
        }
示例#3
0
        protected void btnExpAudit_Click(object sender, EventArgs e)
        {
            IList<CY.CSTS.Core.Business.StimulationExpertAssignment> expertList = CY.CSTS.Core.Business.StimulationExpertAssignment.SelectStimulationExpertAssignmentDynamic("[StimulationAppID]='" + appforcenter.Id + "'", "");
            CY.CSTS.Core.Business.Email email = new CY.CSTS.Core.Business.Email();
            email.Annex = 2;
            email.SenderID = U.Id;
            email.Content = "您好:有新的服务中心激励考评申请表需要您评分,请尽快提交您的评分单.";
            email.Status = 1;
            email.CreateTime = System.DateTime.Now;
            email.SendTime = System.DateTime.Now;
            email.Save();
            for (int i = 0; i < expertList.Count; i++)
            {
                CY.CSTS.Core.Business.EmailAdditional emailAdd = new CY.CSTS.Core.Business.EmailAdditional();
                emailAdd.MailID = email.Id;
                emailAdd.ReceiverID = expertList[i].ExpertID;
                emailAdd.ReceiveStatus = 2;
                emailAdd.Save();
                try
                {
                    CY.CSTS.Core.Business.User u = CY.CSTS.Core.Business.User.Load(expertList[i].ExpertID);
                    if (u != null && u.Phone != null)
                    {
                        CY.CSTS.Core.Business.Sendsms sms = new Sendsms();
                        sms.Content = "您好:有新的服务中心激励考评申请表需要您评分,请登录站点www.csts.net,尽快提交您的评分单.";
                        sms.Phone = "" + u.Phone + "";
                        sms.Save();
                    }
                }
                catch { }
            }

            appforcenter.State = 8;
            appforcenter.Save();

            bindCtr();
        }