private void SendUserNamePasswordFromAdmin(MstUsers mMstUsers) { StringBuilder sbSendUserNamePassword = new StringBuilder(); mMailType = db.MstMailType.Where(u => u.MailTypeId == 13).FirstOrDefault(); //mMailType = db.MstMailType.Find(1); //sbSendUserNamePassword.Append(mMailType.MailBody.ToString().Replace("[name]", mMstUsers.UserName).Replace("[UserName]", mMstUsers.LoginName).Replace("[Password]", mMstUsers.Password).Replace("[SiteURL]", "www.EzyFind.co.za")); sbSendUserNamePassword.Append(mMailType.MailBody.ToString().Replace("[name]", mMstUsers.UserName).Replace("[Password]", mMstUsers.Password).Replace("[SiteURL]", "www.EzyFind.co.za")); string sbBody = AddImagePath(sbSendUserNamePassword.ToString()); MstEmailStack mMstEmailStack = new MstEmailStack() { ToName = mMstUsers.FirstName + " " + mMstUsers.LastName, ToAddress = mMstUsers.Email, Subject = "Registration confirmed", Body = sbBody, EmailCreatedOn = DateTime.Now, EmailSendCount = 0, EmailSentFrom = "Service", FromAddress = "*****@*****.**", EmailSentSuccess = false, AttachmentPath = null }; db.MstEmailStack.Add(mMstEmailStack); db.SaveChangesAsync(); }
public async Task <IActionResult> PostMstMailType([FromBody] MstMailType mstMailType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MstMailType.Add(mstMailType); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (MstMailTypeExists(mstMailType.MailTypeId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetMstMailType", new { id = mstMailType.MailTypeId }, mstMailType)); }
//********************** //private static StringBuilder BusinessRequest(PL_EmailInfo p_objEmailData) //{ // StringBuilder sbBusinessRequest = new StringBuilder(); // objMailFormat.MailTypeID = 9; // objMailFormat = objBLMailFormat.BL_fnGetMailBodyText(objMailFormat); // sbBusinessRequest.Append(objMailFormat.MailBody.ToString().Replace("[name]", p_objEmailData.UserName).Replace("[CompanyName]", p_objEmailData.strCommentingCompany).Replace("[Category]", p_objEmailData.strCategory).Replace("[RequestTitle]", p_objEmailData.strData).Replace("[RequestDetails]", p_objEmailData.strDescription).Replace("[RequestDate]", p_objEmailData.strRequestDate)).Replace("[RequestingMobile]", p_objEmailData.strRequestingMobile).Replace("[RequestingEmail]", p_objEmailData.strRequestingEmail); // return sbBusinessRequest; //} //private static StringBuilder BusinessComment(PL_EmailInfo p_objEmailData) //{ // StringBuilder sbBusinessComment = new StringBuilder(); // objMailFormat.MailTypeID = 7; // objMailFormat = objBLMailFormat.BL_fnGetMailBodyText(objMailFormat); // sbBusinessComment.Append(objMailFormat.MailBody.ToString().Replace("[name]", p_objEmailData.UserName).Replace("[CompanyName]", p_objEmailData.strCommentingCompany).Replace("[Title]", p_objEmailData.strData)); // return sbBusinessComment; //} //********************** private void SeekerComment(MstUsers mMstUsers) { StringBuilder sbSeekerComment = new StringBuilder(); //Get title // sbSeekerComment.Append(objMailFormat.MailBody.ToString().Replace("[name]", p_objEmailData.UserName).Replace("[Title]", p_objEmailData.strData)); mMailType = db.MstMailType.Where(u => u.MailTypeId == 10).FirstOrDefault(); //mMailType = db.MstMailType.Find(1); sbSeekerComment.Append(mMailType.MailBody.ToString().Replace("[name]", mMstUsers.UserName).Replace("[code]", mMstUsers.EmailActivationCode).Replace("[SiteURL]", "www.EzyFind.co.za")); string sbBody = AddImagePath(sbSeekerComment.ToString()); MstEmailStack mMstEmailStack = new MstEmailStack() { ToName = mMstUsers.FirstName + " " + mMstUsers.LastName, ToAddress = mMstUsers.Email, Subject = "Registration confirmed", Body = sbBody, EmailCreatedOn = DateTime.Now, EmailSendCount = 0, EmailSentFrom = "Service", FromAddress = "*****@*****.**", EmailSentSuccess = false, AttachmentPath = null }; db.MstEmailStack.Add(mMstEmailStack); db.SaveChangesAsync(); }
public async Task <IActionResult> PutMstMailType([FromRoute] int id, [FromBody] MstMailType mstMailType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mstMailType.MailTypeId) { return(BadRequest()); } _context.Entry(mstMailType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MstMailTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }