示例#1
0
        /// <summary>
        /// 加载邮件列表
        /// </summary>
        private void LoadEmailHistory()
        {
            EmailHistory cEmailHistory = new EmailHistory();

            if (EmailType != "")
            {
                cEmailHistory.EmailType = EmailType;
            }
            if (MasterCode != "")
            {
                cEmailHistory.MasterCode = MasterCode;
            }

            string    Receiver = "";
            DataTable dt       = new DataTable();

            switch (EmailType)
            {
            case "BiddingEmitTo":
                dt = SupplierRule.GetSupplierByCode(Request["SupplierCode"]).CurrentTable;
                if (dt.Rows.Count > 0)
                {
                    Receiver = dt.Rows[0]["Email"].ToString();
                }
                dt.Dispose();
                break;

            default:
                Receiver = "";
                break;
            }
            if (Receiver != "")
            {
                cEmailHistory.Receiver = Receiver;
            }

            dt = cEmailHistory.GetEmailHistorys();
            dt.Columns.Add(new DataColumn("EmailTypeCN", Type.GetType("System.String")));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["EmailTypeCN"] = GetEmailTypeCNByEmailType(dt.Rows[i]["EmailType"].ToString());
            }

            this.gvEmailHistoryList.DataSource          = dt;
            this.gvEmailHistoryList.AutoGenerateColumns = false;
            this.gvEmailHistoryList.Columns[6].Visible  = false;
            this.gvEmailHistoryList.DataBind();
        }
示例#2
0
文件: BiddingBFL.cs 项目: ishui/rms2
        /// <summary>
        /// 网上招投标发送Email通知供应商用户名密码,单个供应商
        /// </summary>
        /// <param name="SupplierCode">供应商编号</param>
        /// <param name="EmitToCode">投标编号</param>
        /// <param name="pwd">密码</param>
        /// <param name="gid">用户名</param>
        /// <param name="EmailTemplateFileName">邮件模板XML文件名</param>
        private static void SendEmail(string SupplierCode, string EmitToCode, string pwd, string gid, string EmailTemplateFileName)
        {
            try
            {
                string Title    = "";
                string MailBody = "";
                string UserMail = "";

                string UserName     = "";
                string BiddingTitle = "";

                string MailUser = ConfigurationManager.AppSettings["MailUser"].ToString();
                string MailPwd  = ConfigurationManager.AppSettings["MailPwd"].ToString();

                EntityData entity = new EntityData();
                entity = SupplierRule.GetSupplierByCode(SupplierCode);
                if (entity.HasRecord())
                {
                    UserName = entity.CurrentTable.Rows[0]["SupplierName"].ToString();
                    UserMail = entity.CurrentTable.Rows[0]["EMail"].ToString();
                    entity.Dispose();

                    if (UserMail != "")
                    {
                        Bidding           cBidding     = new Bidding();
                        BiddingEmit       cBiddingEmit = new BiddingEmit();
                        StandardEntityDAO dao          = new StandardEntityDAO("BiddingEmitTo");
                        string            BiddingCode  = cBiddingEmit.GetBiddingEmitByEmitToCode(dao, EmitToCode).CurrentRow["BiddingCode"].ToString();


                        BiddingTitle = cBidding.GetBiddingName(BiddingCode);

                        XMLTreeViewManager vm  = new XMLTreeViewManager(EmailTemplateFileName);
                        XmlDocument        doc = new XmlDocument();
                        doc.Load(vm.m_XMLFileName);
                        XmlNode EmailTypeNode = doc.DocumentElement.SelectSingleNode("BiddingEmitTo");
                        if (EmailTypeNode != null)
                        {
                            Title    = EmailTypeNode.SelectSingleNode("Title").InnerText;
                            MailBody = EmailTypeNode.SelectSingleNode("MailBody").InnerText;
                        }

                        Title    = Title.Replace("#BiddingTitle#", BiddingTitle);
                        Title    = Title.Replace("#Password#", pwd);
                        Title    = Title.Replace("#GID#", gid);
                        MailBody = MailBody.Replace("#BiddingTitle#", BiddingTitle);
                        MailBody = MailBody.Replace("#Password#", pwd);
                        MailBody = MailBody.Replace("#GID#", gid);
                        BLL.MailRule mail = new BLL.MailRule();
                        mail.Title  = Title;
                        mail.Body   = MailBody;
                        mail.ToMail = UserMail;
                        mail.sendMail();

                        EmailHistoryInsert("BiddingEmitTo", EmitToCode, Title, UserMail, MailUser, MailBody, DateTime.Now);
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog("BiddingBFL", ex, ex.Message);
            }
        }