public ActionResult Contact(string Name, string Phone, string Email, string Address, string Company, string Comments) { #region //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(Name); if (!string.IsNullOrEmpty(Phone)) arrTokens.Add(Phone); else arrTokens.Add("Not Applicable"); arrTokens.Add(Email); arrTokens.Add(Address); if (!string.IsNullOrEmpty(Company)) arrTokens.Add(Company); else arrTokens.Add("Not Applicable"); arrTokens.Add(Comments); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = System.Configuration.ConfigurationManager.AppSettings["AdminMail"].ToString(); objSendMail.Subject = "email.contactUs.subject.content"; objSendMail.MsgBody = "email.contactUs.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); ViewData["ContactInfo"] = "Thank you for sharing your contact information"; ContentAction objContent = new ContentAction(); Content contactContent = objContent.GetContentByType("Contact"); ViewData["ContactContent"] = contactContent != null ? contactContent.Value1 : "Page is under construction, please visit again"; return View(); #endregion }
public bool SendEmail(SendMail obj) { SeedSpeakMail.getCommonTypeTable(); System.Net.Mail.MailMessage objMailMessage = new System.Net.Mail.MailMessage(); System.Net.Mail.SmtpClient objSmtpClient = new System.Net.Mail.SmtpClient(); string mailTo = obj.ToEmailId.ToString(); string mailFrom = System.Configuration.ConfigurationManager.AppSettings["mailFrom"].ToString(); string smtpHost = System.Configuration.ConfigurationManager.AppSettings["smtpHost"].ToString(); string authUserId = System.Configuration.ConfigurationManager.AppSettings["EmailUserId"].ToString(); string authPwd = System.Configuration.ConfigurationManager.AppSettings["EmailPassword"].ToString(); string subject = SeedSpeakMail.getKeyValue(obj._subject); if (obj._changesInSubject != null && obj._changesInSubject.Count > 0) { for (int ctr = 0; ctr < obj._changesInSubject.Count; ctr++) { string oldval = "#" + (ctr + 1) + "#"; string newval = (string)obj._changesInSubject[ctr]; subject = subject.Replace(oldval, newval); } } string message = SeedSpeakMail.getKeyValue(obj._msgBody); if(obj._changesInMessage !=null && obj._changesInMessage.Count>0) { for (int ctr = 0; ctr < obj._changesInMessage.Count; ctr++) { string oldval = "#" + (ctr + 1) + "#"; string newval = (string)obj._changesInMessage[ctr]; message = message.Replace(oldval, newval); } } NetworkCredential SMTPUserInfo = new NetworkCredential(authUserId, authPwd); objSmtpClient.UseDefaultCredentials = false; objSmtpClient.Credentials = SMTPUserInfo; objMailMessage.From = new MailAddress(mailFrom); objMailMessage.To.Add(mailTo); if (obj.CCEmailId != null && obj.CCEmailId.Length > 0) { objMailMessage.CC.Add(obj.CCEmailId.ToString()); } objMailMessage.Subject = subject; objSmtpClient.Port = 587; objSmtpClient.EnableSsl = false; objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; objMailMessage.IsBodyHtml = true; objMailMessage.Body = message; objSmtpClient.Host = smtpHost; try { objSmtpClient.Send(objMailMessage); return (true); } catch (Exception) { return (false); } }
public ActionResult MailNewPassword(string id) { MemberAction objMember = new MemberAction(); Member member = objMember.GetMemberByMemberId(id); string newPwd = GenerateRandomString(); member.passwd = Security.Encrypt(newPwd, true); if (objMember.UpdateMember(member)) { //send automated email // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(member.firstName + " " + member.lastName); arrTokens.Add("*****@*****.**"); arrTokens.Add(newPwd); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = member.username; objSendMail.Subject = "email.newPasswordGenerate.subject.content"; objSendMail.MsgBody = "email.newPasswordGenerate.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); ViewData["ManageUser"] = "******" + member.firstName + " " + member.lastName + "</b>"; } else { ViewData["ManageUser"] = "******"; } GetAllMemberList(); return View("ManageUser"); }
/// <summary> /// Method to send mail /// </summary> /// <returns></returns> public string SendMail() { #region string result = "sent"; try { ArrayList arrTokens = new ArrayList(); arrTokens.Add("Test user"); arrTokens.Add("Test Password"); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = "*****@*****.**"; objSendMail.Subject = "email.forget.password.subject.content"; objSendMail.MsgBody = "email.forget.password.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); } catch (Exception ex) { result = ex.InnerException.ToString(); } return result; #endregion }
public void HarvestSeed(string id) { #region bool isCompleted = false; SeedAction objSeed = new SeedAction(); Seed seed = GetSeedInformation(id); isCompleted = objSeed.HarvestTerminateSeed(id, "Harvest"); if (isCompleted == true) { //send automated email to inform the administrator that a new flag has been posted on a seed // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = seed.Member.username; objSendMail.Subject = "email.harvestSeed.subject.content"; objSendMail.MsgBody = "email.harvestSeed.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail);// Response.Redirect("/Seed/ManageSeeds"); } #endregion }
public ActionResult EditSeed(string SeedId, string SeedTitle, string SeedDescription, string SeedTags, string categoryIds) { #region SeedAction objSeed = new SeedAction(); Seed seed = objSeed.GetSeedBySeedId(SeedId); seed.title = SeedTitle; badWordsFilter objWords = new badWordsFilter(); string filePath = Server.MapPath("~/utils/badWords.xml"); List<string> lstBadWords = badWordsFilter.BadWordList(ref filePath); string description = objWords.FilterBadWords(lstBadWords, SeedDescription); if (description.Length > 999) description = description.Substring(0, 995); seed.description = description; seed = objSeed.UpdateSeed(seed); string[] arrCategoryIds; char[] separator = new char[] { ',' }; categoryIds = categoryIds.TrimStart(','); arrCategoryIds = categoryIds.Split(','); bool isPlanted = false; if (categoryIds.Trim().ToString() != "") { isPlanted = objSeed.AddCategories(SeedId, arrCategoryIds); } Tag objTagEntity = new Tag(); if (!string.IsNullOrEmpty(SeedTags)) { objTagEntity.name = SeedTags; objTagEntity.seedId = new Guid(SeedId); objSeed.ManageTag(objTagEntity); } if (seed.id != null) { //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = seed.Member.username; objSendMail.Subject = "email.editSeed.subject.content"; objSendMail.MsgBody = "email.editSeed.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); } Response.Redirect("/Seed/SeedDetails/" + SeedId); return View(); #endregion }
public string ShareIdea(string txtSeedTitle, string txtDesc, string seedCoordinates, string seedLocation, string txtCategory) { #region string returnMsg = string.Empty; try { SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); //Format address and create add seed model string[] splitAddress = seedLocation.Split(','); AddSeed seedData = new AddSeed(); seedData.SeedName = txtSeedTitle; seedData.Description = txtDesc; seedData.LongLat = seedCoordinates; if (splitAddress.Length > 4) { seedData.StreetAddress = splitAddress[0].ToString() + ", " + splitAddress[1].ToString(); seedData.City = splitAddress[2].ToString().Trim(); string[] splitZipRegion = splitAddress[3].ToString().Trim().Split(' '); seedData.ZipCode = splitZipRegion[1].ToString().Trim(); seedData.StateCode = splitZipRegion[0].ToString().Trim(); } else { seedData.StreetAddress = splitAddress[0].ToString(); seedData.City = splitAddress[1].ToString().Trim(); string[] splitZipRegion = splitAddress[2].ToString().Trim().Split(' '); seedData.ZipCode = splitZipRegion[1].ToString().Trim(); seedData.StateCode = splitZipRegion[0].ToString().Trim(); } //End formatting address string plantedSeedId = AddSeedData(seedData); if (txtCategory != null) { string catIds = string.Empty; string[] splitCategories = txtCategory.Split(','); for (int i = 0; i < splitCategories.Length; i++) { CategoryAction objCatg = new CategoryAction(); string idCatg = objCatg.GetCategoryIdByCategoryName(splitCategories[i].ToString()); if (!string.IsNullOrEmpty(idCatg)) { if (string.IsNullOrEmpty(catIds)) catIds = idCatg; else catIds = catIds + "," + idCatg; } } if (!string.IsNullOrEmpty(catIds)) { string[] arrCatIds = catIds.Split(','); objSeed.AddCategories(plantedSeedId, arrCatIds); } } try { // Get the HttpFileCollection HttpFileCollectionBase hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { if (hfc[i].ContentLength > 0) { hfc[i].SaveAs(Server.MapPath("UploadedMedia") + "\\" + System.IO.Path.GetFileName(hfc[i].FileName)); } } } catch { } #region code to send mail Seed seed = GetSeedInformation(plantedSeedId); // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/SeedDetails/" + seed.id); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile"); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = seed.Member.username; objSendMail.Subject = "email.seedPlanted.subject.content"; objSendMail.MsgBody = "email.seedPlanted.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); #endregion returnMsg = "Seed has been planted successfully"; } catch (Exception ex) { returnMsg = ex.Message.ToString(); } return returnMsg; #endregion }
public ActionResult UpdateUserName(ProfileModel objNewEmail) { #region Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject); MemberAction objMember = new MemberAction(); Privacy privacyData = objMember.GetPrivacyByMemberId(memberData.id); string newemail = objNewEmail.NewEmail.ToString(); bool updated = objMember.UpdateUserName(newemail, memberData.id.ToString()); if (updated == true) { //send automated email // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(memberData.firstName + " " + memberData.lastName); arrTokens.Add(newemail); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = newemail; objSendMail.Subject = "email.member.usernameChange.subject.content"; objSendMail.MsgBody = "email.member.usernameChange.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); ViewData["UpdateLoginMsg"] = "<b>Username updated successfully.</b>"; } else { ViewData["UpdateLoginMsg"] = "Error while updating username."; } ViewData["SelectedIndex"] = 2; GetRegions(); MyUsername(privacyData); SeedContributionMessage(privacyData); SeedCommitmentMessage(privacyData); GetExternalAccountList(); GetProfileData(); ViewData["LoggedInMember"] = memberData.id.ToString(); return View("Profile"); #endregion }
public ActionResult SeedLocation(string InfoLatLong, string seedLocation) { #region try { SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); //Format address and create add seed model string[] splitAddress = seedLocation.Split(','); AddSeed seedData = (AddSeed)SessionStore.GetSessionValue(SessionStore.SeedInfo); seedData.LongLat = InfoLatLong; seedData.StreetAddress = splitAddress[0].ToString(); seedData.City = splitAddress[1].ToString().Trim(); string[] splitZipRegion = splitAddress[2].ToString().Trim().Split(' '); seedData.ZipCode = splitZipRegion[1].ToString().Trim(); seedData.StateCode = splitZipRegion[0].ToString().Trim(); //End formatting address string categoryIds = (string)SessionStore.GetSessionValue(SessionStore.CategoryId); string[] arrCategoryIds; string latLong = seedData.LongLat; char[] separator = new char[] { ',' }; string[] strSplitLatLong = latLong.Split(separator); string lat = strSplitLatLong[0].ToString(); string longt = strSplitLatLong[1].ToString(); categoryIds = categoryIds.TrimStart(','); arrCategoryIds = categoryIds.Split(','); string plantedSeedId = AddSeedData(seedData); bool isPlanted = false; if (categoryIds.Trim().ToString() != "") { isPlanted = objSeed.AddCategories(plantedSeedId, arrCategoryIds); } bindCheckBox(plantedSeedId); Seed seed = GetSeedInformation(plantedSeedId); #region Send Mail // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/SeedDetails/" + seed.id); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile"); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = seed.Member.username; objSendMail.Subject = "email.seedPlanted.subject.content"; objSendMail.MsgBody = "email.seedPlanted.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); #endregion return Redirect("/Seed/SeedDetails/" + seed.id); } catch (Exception ex) { ViewData["SeedPlant"] = ex.Message.ToString(); } bindCategory(); return View(); #endregion }
public ActionResult SetCategory(string seedId, string categoryIds, AddSeed objAddSeedModel) { #region if (ModelState.IsValid) { try { SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); AddSeed seedData = (AddSeed)objAddSeedModel; string[] arrCategoryIds; string latLong = seedData.LongLat; char[] separator = new char[] { ',' }; string[] strSplitLatLong = latLong.Split(separator); string lat = strSplitLatLong[0].ToString(); string longt = strSplitLatLong[1].ToString(); categoryIds = categoryIds.TrimStart(','); arrCategoryIds = categoryIds.Split(','); string plantedSeedId = AddSeedData(seedData); bool isPlanted = false; if (categoryIds.Trim().ToString() != "") { isPlanted = objSeed.AddCategories(plantedSeedId, arrCategoryIds); } bindCheckBox(plantedSeedId); Seed seed = GetSeedInformation(plantedSeedId); #region Send Mail // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/SeedDetails/" + seed.id); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile"); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = seed.Member.username; objSendMail.Subject = "email.seedPlanted.subject.content"; objSendMail.MsgBody = "email.seedPlanted.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); #endregion return Redirect("/Seed/SeedDetails/" + seed.id); } catch (Exception ex) { ViewData["SeedPlant"] = ex.Message.ToString(); } } miniDashboard(); bindCategory(); RegionCode(); return View("../Member/Dashboard"); #endregion }
public ActionResult PlantSeed(string seedTitle, string description, string info, string address, string keyword, string categoryIds) { #region try { SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); //Format address and create add seed model string[] splitAddress = address.Split(','); AddSeed seedData = new AddSeed(); seedData.SeedName = seedTitle; badWordsFilter objWords = new badWordsFilter(); string filePath=Server.MapPath("~/utils/badWords.xml"); List<string> lstBadWords = badWordsFilter.BadWordList(ref filePath); description = objWords.FilterBadWords(lstBadWords, description); seedData.Description = description; seedData.LongLat = info; seedData.Tag = keyword; seedData.StreetAddress = splitAddress[0].ToString(); seedData.City = splitAddress[1].ToString().Trim(); string[] splitZipRegion = splitAddress[2].ToString().Trim().Split(' '); seedData.ZipCode = splitZipRegion[1].ToString().Trim(); seedData.StateCode = splitZipRegion[0].ToString().Trim(); //End formatting address string[] arrCategoryIds; string latLong = seedData.LongLat; char[] separator = new char[] { ',' }; string[] strSplitLatLong = latLong.Split(separator); string lat = strSplitLatLong[0].ToString(); string longt = strSplitLatLong[1].ToString(); categoryIds = categoryIds.TrimStart(','); arrCategoryIds = categoryIds.Split(','); string plantedSeedId = AddSeedData(seedData); bool isPlanted = false; if (categoryIds.Trim().ToString() != "") { isPlanted = objSeed.AddCategories(plantedSeedId, arrCategoryIds); } bindCheckBox(plantedSeedId); Seed seed = GetSeedInformation(plantedSeedId); #region Send Mail // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/SeedDetails/" + seed.id); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile"); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = seed.Member.username; objSendMail.Subject = "email.seedPlanted.subject.content"; objSendMail.MsgBody = "email.seedPlanted.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); #endregion return Redirect("/Seed/SeedDetails/" + seed.id); } catch (Exception ex) { ViewData["SeedPlant"] = ex.Message.ToString(); } bindCategory(); return View(); #endregion }
public ActionResult OfferSeedOwnership(string OwnerEmail) { #region //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(OwnerEmail); StringBuilder messageAccept = new StringBuilder(); messageAccept.Append(System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString()); messageAccept.Append("/Seed/OwnershipDecision?seedid="); messageAccept.Append("C5F6B54F-8D43-4F06-B846-152066FACE5A"); messageAccept.Append("&decision=Accept"); arrTokens.Add(messageAccept.ToString()); StringBuilder messageReject = new StringBuilder(); messageReject.Append(System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString()); messageReject.Append("/Seed/OwnershipDecision?seedid="); messageReject.Append("C5F6B54F-8D43-4F06-B846-152066FACE5A"); messageReject.Append("&decision=Reject"); arrTokens.Add(messageReject.ToString()); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = OwnerEmail; objSendMail.Subject = "email.offer.seedownership.subject.content"; objSendMail.MsgBody = "email.offer.seedownership.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); return View(); #endregion }
public void mailSeedInformation(string mSeedid, string eMail, string seedSubject, string seedBody) { #region //send automated email - content of email will be decided later //Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(eMail); arrTokens.Add(seedSubject); arrTokens.Add(seedBody); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = eMail; objSendMail.Subject = "email.seedInformation.subject.content"; objSendMail.MsgBody = "email.seedInformation.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); Response.Redirect("/Seed/SeedDetails/" + mSeedid); #endregion }
public ActionResult ForgotPassword(RegisterModel objPwdModel) { #region Send Mail for password MemberAction objMember = new MemberAction(); string memberPwd = objMember.GetPwdByUserName(objPwdModel.ForgotUserName); if (!string.IsNullOrEmpty(memberPwd)) { //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(objPwdModel.ForgotUserName); arrTokens.Add(memberPwd); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = objPwdModel.ForgotUserName; objSendMail.Subject = "email.forget.password.subject.content"; objSendMail.MsgBody = "email.forget.password.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); ViewData["Message"] = "Your password has been sent to the specified email address. Please check your email to find out the password."; return View("PasswordSent"); } else { ViewData["Message"] = "Sorry! We could not find a user registered with that email address"; return View("PasswordSent"); } #endregion }
public ActionResult ShareIdea1(string returnAction, string txtSeedTitle, string txtDesc, string seedCoordinates, string seedLocation, string txtCategory, IEnumerable<HttpPostedFileBase> mediaFiles) { #region codeRegion try { SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); //Format address and create add seed model string[] splitAddress = seedLocation.Split(','); AddSeed seedData = new AddSeed(); seedData.SeedName = txtSeedTitle; seedData.Description = txtDesc; seedData.LongLat = seedCoordinates; string seedCountry = string.Empty; if (splitAddress.Length > 4) { seedData.StreetAddress = splitAddress[0].ToString() + ", " + splitAddress[1].ToString(); seedData.City = splitAddress[2].ToString().Trim(); string[] splitZipRegion = splitAddress[3].ToString().Trim().Split(' '); seedData.ZipCode = splitZipRegion[1].ToString().Trim(); seedData.StateCode = splitZipRegion[0].ToString().Trim(); seedCountry = splitAddress[4].ToString(); } else { seedData.StreetAddress = splitAddress[0].ToString(); seedData.City = splitAddress[1].ToString().Trim(); string[] splitZipRegion = splitAddress[2].ToString().Trim().Split(' '); seedData.ZipCode = splitZipRegion[1].ToString().Trim(); seedData.StateCode = splitZipRegion[0].ToString().Trim(); seedCountry = splitAddress[3].ToString(); } //End formatting address if (seedCountry.Trim().Equals("USA") || seedCountry.Trim().Equals("US")) seedCountry = seedCountry.Trim(); else throw new Exception("Seeds can not be planted outside region of United States"); string plantedSeedId = AddSeedData(seedData); if (txtCategory != null) { string catIds = string.Empty; string[] splitCategories = txtCategory.Split(','); for (int i = 0; i < splitCategories.Length; i++) { CategoryAction objCatg = new CategoryAction(); string idCatg = objCatg.GetCategoryIdByCategoryName(splitCategories[i].ToString()); if (!string.IsNullOrEmpty(idCatg)) { if (string.IsNullOrEmpty(catIds)) catIds = idCatg; else catIds = catIds + "," + idCatg; } } //bool isPlanted = false; if (!string.IsNullOrEmpty(catIds)) { string[] arrCatIds = catIds.Split(','); objSeed.AddCategories(plantedSeedId, arrCatIds); } } if (mediaFiles != null) { foreach (var file in mediaFiles) { if (file.ContentLength > 0) { Bitmap sourceImage = new Bitmap(file.InputStream); MediaManagement objMedia = new MediaManagement(); bool isMediaSaved = false; int fileSize = file.ContentLength; string fileOk = CheckFile(file.FileName, fileSize); if (fileOk != "Invalid") { string strImgFileExtension = System.IO.Path.GetExtension(file.FileName); DateTime datImg = DateTime.Now; string ImgfileUploadtime = datImg.Day.ToString() + datImg.Month.ToString() + datImg.Year.ToString() + datImg.Hour.ToString() + datImg.Minute.ToString() + datImg.Second.ToString(); string filePath = Path.Combine(HttpContext.Server.MapPath("/UploadedMedia"), (plantedSeedId.ToString() + "_" + ImgfileUploadtime + strImgFileExtension)); objMedia.title = plantedSeedId.ToString() + "_" + ImgfileUploadtime; objMedia.path = "../../UploadedMedia/" + (plantedSeedId.ToString() + "_" + ImgfileUploadtime + strImgFileExtension); objMedia.type = fileOk; objMedia.seedId = plantedSeedId; sourceImage.Save(filePath, FileExtensionToImageFormat(filePath)); objMedia.embedScript = "Image Script"; isMediaSaved = SaveMediaInformation(objMedia); } else throw new Exception("Please check file type or file size, Max Size Allowed : (Image : 2 MB) & (Video : 4 MB)"); } } } Seed seed = GetSeedInformation(plantedSeedId); // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(seed.Member.firstName + " " + seed.Member.lastName); arrTokens.Add(seed.title); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/SeedDetails/" + seed.id); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile"); // Filling mail object SendMail objSendMail = new SendMail(); Regex rgxEmail = new Regex("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); if (rgxEmail.IsMatch(seed.Member.username)) objSendMail.ToEmailId = seed.Member.username; else objSendMail.ToEmailId = seed.Member.Email; objSendMail.Subject = "email.seedPlanted.subject.content"; objSendMail.MsgBody = "email.seedPlanted.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); return Redirect("/Seed/SeedDetails/" + seed.id); } catch (Exception ex) { SessionStore.SetSessionValue("PlantError", "Error occurred while planting seed#" + ex.Message.ToString()); //ViewData["PlantErrMsg"] = ex.Message.ToString(); return RedirectToAction("PlantError", "Seed"); } #endregion }
public ActionResult SignUpUser(RegisterModel objRegModel, string captcha) { #region Code for Registration MemberAction objMember = new MemberAction(); bool isUserExist = objMember.FindByUserName(objRegModel.UserName.Trim()); if (isUserExist) { ModelState.AddModelError("", "User Already exist. Please change Username."); } else { bool isRegistered = objMember.Signup(objRegModel); if (isRegistered == true) { #region Send Mail if Registration Successful //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(objRegModel.FirstName + " " + objRegModel.LastName); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Dashboard"); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/DiscoverSeed"); arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile"); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = objRegModel.UserName; objSendMail.Subject = "email.member.signup.subject.content"; objSendMail.MsgBody = "email.member.signup.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail);// SendMail.(member.username, SystemStatements.DEFAUL_EMAIL_ADDRESS, SystemStatements.EMAIL_SUBJECT_SIGNUP, ""); #endregion return RedirectToAction("SignUpThanks", "Member"); } else { ModelState.AddModelError("", "Error occured while registration."); } } return View("Default"); #endregion }
public void ContributionMail(string name, string token, string toMail, string contributionType) { #region //send automated email to inform the administrator that a new flag has been posted on a seed // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(name); arrTokens.Add(token); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = toMail; if (contributionType == "Flag") { objSendMail.Subject = "email.member.flagPosted.subject.content"; objSendMail.MsgBody = "email.member.flagPosted.body.content"; } if (contributionType == "Media") { objSendMail.Subject = "email.mediaFileUploaded.subject.content"; objSendMail.MsgBody = "email.mediaFileUploaded.body.content"; } objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); #endregion }
public void ContributionMailAlert(string name, string committername, string title, string url, string toMail, string contributionType) { #region Send Mail Code //send automated email to inform the administrator that a new flag has been posted on a seed // Creating array list for token subject ArrayList arrTokensSub = new ArrayList(); arrTokensSub.Add(committername); // Creating array list for token message ArrayList arrTokens = new ArrayList(); arrTokens.Add(name); arrTokens.Add(committername); arrTokens.Add(title); arrTokens.Add(url); if (contributionType == "Commitment") { arrTokens.Add(committername); } // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = toMail; if (contributionType == "Commitment") { objSendMail.Subject = "email.member.CommitmentPosted.subject.content"; objSendMail.MsgBody = "email.member.CommitmentPosted.body.content"; } if (contributionType == "Comment") { objSendMail.Subject = "email.member.CommentPosted.subject.content"; objSendMail.MsgBody = "email.member.CommentPosted.body.content"; } objSendMail.ChagesInSubject = arrTokensSub; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); #endregion }
/// <summary> /// Method to retrive password /// </summary> /// <param name="username"></param> /// <returns></returns> public bool ForgotPassword(string username) { MemberAction objMember = new MemberAction(); string memberPwd = objMember.GetPwdByUserName(username); if (!string.IsNullOrEmpty(memberPwd)) { //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(username); arrTokens.Add(memberPwd); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = username; objSendMail.Subject = "email.forget.password.subject.content"; objSendMail.MsgBody = "email.forget.password.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail);//SendMail.(member.username, SystemStatements.DEFAUL_EMAIL_ADDRESS, SystemStatements.EMAIL_SUBJECT_SIGNUP, ""); return true; } else { return false; } }