/*-----------------------------------------------------*/ protected override XmlNode Get_MailParamNode(cAppl aAppl) { XmlNode aEMailParamNode; aEMailParamNode = cXMLDoc.FindNodeWithChildNode(((cWebAppl) aAppl).Get_ApplNode(), "EMailParams/EMailParam", "ReleaseBuild", "BuildKey", aAppl.BuildKey); return aEMailParamNode; }
/*-----------------------------------------------------*/ protected override string Get_SMTPHost(cAppl aAppl) { XmlNode aEMailParamNode; aEMailParamNode = Get_MailParamNode(aAppl); if (aEMailParamNode != null) { return cXMLDoc.AttributeToString(aEMailParamNode, "SMTPHost", ""); } return ""; }
/*-----------------------------------------------------*/ protected string GetCloseTag(cAppl aAppl) { String strTag = ">"; XmlNode aEmailMergeNode; aEmailMergeNode = cXMLDoc.FindNode(((cWebAppl) aAppl).Get_ApplNode(), "EMailParams/EmailMerge", "Key", "Tags"); if (aEmailMergeNode != null) { strTag = cXMLDoc.AttributeToString(aEmailMergeNode, "CloseTag", ">"); } if (mIsHtml) { strTag = "/" + strTag; } return strTag; }
/*-----------------------------------------------------*/ public virtual void SetMailMessageParams(cAppl aAppl) { //XmlNode aEMailParamNode; //String aEMailParamToAddress; mMailMessage = new MailMessage(); mMailMessage.From = mFrom; if (mFromName != "") { mMailMessage.Headers.Add("From", string.Format("{0} <{1}>", mFromName, mFrom)); } //email sent from development, testin or demo servers //aEMailParamToAddress = Get_ToAddress(aAppl); if (aAppl.EmailSwitchEnabled == true) { if (mIsHtml) { mMailMessage.Body = "To: " + mTo + "<br>" + "Cc: " + mCc + "<br>" + "Bcc: " + mBcc + "<br>" + "<br>" + mBodyText; mMailMessage.BodyFormat = MailFormat.Html; } else { mMailMessage.Body = "To: " + mTo + "\n" + "Cc: " + mCc + "\n" + "Bcc: " + mBcc + "\n" + "\n" + mBodyText; mMailMessage.BodyFormat = MailFormat.Text; } // if (aEMailParamToAddress != "") { // mMailMessage.To = aEMailParamToAddress; // } } else { mMailMessage.To = mTo; mMailMessage.Cc = mCc; mMailMessage.Bcc = mBcc; mMailMessage.Body = mBodyText; if (mIsHtml) mMailMessage.BodyFormat = MailFormat.Html; else mMailMessage.BodyFormat = MailFormat.Text; } if (aAppl.BuildKey != "Release") { if (mIsHtml) { mMailMessage.Body = "Server: " + Server.MachineName + "<br>" + "Build: " + aAppl.BuildKey + "<br>" + mMailMessage.Body; } else { mMailMessage.Body = "Server: " + Server.MachineName + "\n" + "Build: " + aAppl.BuildKey + "\n" + mMailMessage.Body; } } mMailMessage.Subject = mSubject; }
/*----------------------------------------------------*/ public bool SendEmail(cAppl aAppl, bool aSetParams) { String aSMTPHost; bool aReturnValue = false; aSMTPHost = Get_SMTPHost(aAppl); if (aSMTPHost != "") SmtpMail.SmtpServer = aSMTPHost; if (EmailArgs != null) { foreach (cDataObject aDataObject in EmailArgs.BaseDataObjList) { if (aSetParams) { SetEmailParams(aDataObject); //SetMailMessageParams(aAppl); } SetMailMessageParams(aAppl); if (mMailMessage.To != "") { SmtpMail.Send(mMailMessage); aReturnValue = true; } if (mIsLog) InsertEmailLog(); } } else { if (aSetParams) { SetEmailParams(); //SetMailMessageParams(aAppl); } SetMailMessageParams(aAppl); if (mMailMessage.To != "") { SmtpMail.Send(mMailMessage); aReturnValue = true; } if (mIsLog) InsertEmailLog(); } return aReturnValue; }
/*-----------------------------------------------------*/ // protected Hashtable DataProviderTable // { // get {return mDataProviderTable;} // set {mDataProviderTable = value;} // } /*-----------------------------------------------------*/ public cDataObjectFactory(cAppl aAppl, cXMLDoc aDataDefinitionDoc) { mAppl = aAppl; mDataDefinitionDoc = aDataDefinitionDoc; // mDataProviderTable = new Hashtable(); }
/*-----------------------------------------------------*/ public cUser(cAppl aAppl) { mAppl = aAppl; }
/*-----------------------------------------------------*/ public cDataProviderXML(cAppl aAppl, string aDataFile) : base(aAppl) { mDataDoc = new cXMLDoc(Appl.Build_RootFileSystemPath(aDataFile)); }
/*----------------------------------------------------*/ public bool SendEmail(cAppl aAppl) { return SendEmail(aAppl, true); }
/*-----------------------------------------------------*/ protected virtual string Get_SMTPHost(cAppl aAppl) { return ""; }
/*-----------------------------------------------------*/ protected virtual string Get_ToAddress(cAppl aAppl) { return ""; }
/*====================================================*/ protected virtual XmlNode Get_MailParamNode(cAppl aAppl) { return null; }
/*-----------------------------------------------------*/ public cDataProvider(cAppl aAppl) { mAppl = aAppl; }