本文整理汇总了C#中Job.GetJobConsultant方法的典型用法代码示例。如果您正苦于以下问题:C# Job.GetJobConsultant方法的具体用法?C# Job.GetJobConsultant怎么用?C# Job.GetJobConsultant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job.GetJobConsultant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyJob
public ActionResult ApplyJob(JobApplyModel model, FormCollection col)
{
Job obj = new Job();
string body = System.IO.File.ReadAllText(Server.MapPath("~/Template") + "/jobApplyEmail.html");
DataTable dtConsultant = new DataTable();
dtConsultant = obj.GetJobConsultant(model.JobId);
string consultant = string.Empty;
foreach (DataRow drConsultant in dtConsultant.Rows)
{
consultant = drConsultant["first"].ToString() + ",";
}
if (!string.IsNullOrEmpty(consultant))
consultant = consultant.Remove(consultant.Length - 1, 1);
DataTable dtEss = new DataTable();
dtEss = obj.GetEssentialCriteria(model.JobId);
string essentialCriteria = "<tr><td width='180' align='left' colspan='2'><b>Essential Criteria:</b></td><td align='left'></td></tr>";
if (dtEss.Rows.Count > 0)
{
foreach (DataRow dr in dtEss.Rows)
{
essentialCriteria = essentialCriteria + "<tr><td align='left' colspan='2'> <b>Q." + dr["description"].ToString() + "</b> </td></tr><tr><td align='left' colspan='2'> A." + col[dr["EssentialCriteriaId"].ToString()] + "</td></tr>";
}
}
DataTable dtDesi = new DataTable();
dtDesi = obj.GetDesirableCriteria(model.JobId);
if (dtDesi.Rows.Count > 0)
{
string desirableCriteria = "<tr><td width='180' align='left' colspan='2'><b>Desirable Criteria:</b></td><td align='left'></td></tr>";
foreach (DataRow dr in dtDesi.Rows)
{
desirableCriteria = desirableCriteria + "<tr><td align='left' colspan='2'> <b>Q." + dr["description"].ToString() + "</b> </td></tr><tr><td align='left' colspan='2'> A." + col[dr["DesirableCriteriaId"].ToString()] + "</td></tr>";
}
essentialCriteria = essentialCriteria + desirableCriteria;
}
body = string.Format(body, model.JobTitle, model.ReferenceNo, consultant, model.FirstName, model.LastName, model.Email, model.ContactNumber, string.IsNullOrEmpty(col["retentionConsentChkBox"]) ? "NO" : "YES", essentialCriteria);
MailMessage message = new MailMessage
{
From = new MailAddress(model.Email, model.FirstName + " " + model.LastName),
Subject = "Job Application: " + model.JobTitle + " (" + model.FirstName + " " + model.LastName + "), Ref:" + model.ReferenceNo,
Body = body,
IsBodyHtml = true
};
message.To.Add(ConfigurationManager.AppSettings["jobEmail"].ToString());
if (model.Attachment != null && model.Attachment.ContentLength > 0)
{
var attachment = new Attachment(model.Attachment.InputStream, model.Attachment.FileName);
message.Attachments.Add(attachment);
}
if (model.CoverLetterOptional != null && model.CoverLetterOptional.ContentLength > 0)
{
var attachment = new Attachment(model.CoverLetterOptional.InputStream, model.CoverLetterOptional.FileName);
message.Attachments.Add(attachment);
}
else if (!string.IsNullOrEmpty(model.CoverLetter))
{
//byte[] data = Encoding.ASCII.GetBytes(model.CoverLetter);
//MemoryStream stm = new MemoryStream(data, 0, data.Length);
//var attachment = new Attachment(stm, "coverLetter.doc");
//message.Attachments.Add(attachment);
string coverLetter = "<tr><td width='180' align='left' colspan='2'><b>Cover letter:</b></td></tr>";
coverLetter += "<tr><td align='left' colspan='2'> " + model.CoverLetter + "</b> </td></tr>";
body = body + coverLetter;
message.Body = body;
}
string ackBody = System.IO.File.ReadAllText(Server.MapPath("~/Template") + "/jobAcknowledgement.html");
ackBody = string.Format(ackBody, "<img src='" + ConfigurationManager.AppSettings["logoURL"].ToString() + "' />", model.FirstName, model.JobTitle, model.ReferenceNo);
MailMessage ackMssage = new MailMessage
{
From = new MailAddress(ConfigurationManager.AppSettings["joEmailFrom"].ToString()),
Subject = "Application Acknowledgement For : " + model.JobTitle,
Body = ackBody,
IsBodyHtml = true
};
ackMssage.To.Add(model.Email);
SmtpClient sc = new SmtpClient();
sc.Host = ConfigurationManager.AppSettings["smtpHost"].ToString();
string smtpUser = ConfigurationManager.AppSettings["smtpUserName"].ToString();
string smtpPwd = ConfigurationManager.AppSettings["smtpPassword"].ToString();
sc.Credentials = new System.Net.NetworkCredential(smtpUser, smtpPwd);
sc.Send(message);
sc.Send(ackMssage);
return base.View("JobApplyConfirm");
}