public sp_Email_DM hSelectPrimaryVolEmail(sp_Email_DM givenEmail) { sp_Email_DM Email = new sp_Email_DM(); sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); Email = VolEmailBll.ListPrimaryEmail(givenEmail); return Email; }
public List<sp_Email_DM> hSelectVolEmail(sp_Email_DM givenEmail) { List<sp_Email_DM> EmailList = null; sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); EmailList = VolEmailBll.ListEmails(givenEmail); return EmailList; }
/// <summary> /// Return a list or single email for a given volunteer /// </summary> /// <returns></returns> public List<sp_Email_DM> ListEmails(sp_Email_DM cVolEmail) { List<sp_Email_DM> list = new List<sp_Email_DM>(); try { using (VolTeerEntities context = new VolTeerEntities()) { list = (from result in context.sp_Vol_Email_Select(cVolEmail.VolID, cVolEmail.EmailID, null) select new sp_Email_DM { EmailID = result.EmailID, EmailAddr = result.EmailAddr, VolID = result.VolID, ActiveFlg = result.ActiveFlg, PrimaryFlg = result.PrimaryFlg }).ToList(); } // Guaranteed to close the Connection } catch (Exception ex) { throw (ex); } return list; }
protected void RegisterUser_CreatedUser(object sender, EventArgs e) { //Log the user in FormsAuthentication.SetAuthCookie(RegisterUser.UserName, createPersistentCookie: false); // Create Volunteer Record RadTextBox userNameTextBox = (RadTextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName"); MembershipUser user = Membership.GetUser(userNameTextBox.Text); sp_Volunteer_BLL BLL = new sp_Volunteer_BLL(); sp_VolEmail_BLL VolEmailBLL = new sp_VolEmail_BLL(); sp_Volunteer_DM vol = new sp_Volunteer_DM(); sp_Email_DM volEmail = new sp_Email_DM(); vol.VolID = (Guid)user.ProviderUserKey; vol.VolFirstName = (CreateUserWizardStep1.ContentTemplateContainer.FindControl("rTXTFirstName") as RadTextBox).Text.Trim(); vol.VolMiddleName = (CreateUserWizardStep1.ContentTemplateContainer.FindControl("rTXTMiddleName") as RadTextBox).Text.Trim(); vol.VolLastName = (CreateUserWizardStep1.ContentTemplateContainer.FindControl("rTXTLastName") as RadTextBox).Text.Trim(); vol.ActiveFlg = true; vol = BLL.InsertVolunteerContext(ref vol); volEmail.VolID = (Guid)user.ProviderUserKey; volEmail.EmailAddr = (CreateUserWizardStep1.ContentTemplateContainer.FindControl("Email") as RadTextBox).Text.Trim(); volEmail.ActiveFlg = true; volEmail.PrimaryFlg = true; VolEmailBLL.InsertEmailContext(ref volEmail); cMail.SendMessage("*****@*****.**", (CreateUserWizardStep1.ContentTemplateContainer.FindControl("Email") as RadTextBox).Text.Trim(), "VolTeer Registration", "Please click link to confirm"); string continueUrl = ConfigurationManager.AppSettings["HomePage"].ToString(); Response.Redirect(continueUrl); }
public static void InsertVolEmailData(TestContext testContext) { System.Diagnostics.Debug.WriteLine(String.Format("{0}", DateTime.Now)); cExcel.RemoveAllData(); cExcel.InsertData(ExcelFilenames); sp_Volunteer_BLL volBLL = new sp_Volunteer_BLL(); generalTestVol = new sp_Volunteer_DM(); generalTestVol.VolFirstName = "TestFirst"; generalTestVol.VolMiddleName = "TestMiddle"; generalTestVol.VolLastName = "TestLast"; generalTestVol.ActiveFlg = true; Guid volID = Guid.NewGuid(); generalTestVol.VolID = volID; volBLL.InsertVolunteerContext(ref generalTestVol); sp_VolEmail_BLL volEmail_bll = new sp_VolEmail_BLL(); primaryTestVolEmail = new sp_Email_DM(); primaryTestVolEmail.EmailAddr = "*****@*****.**"; primaryTestVolEmail.VolID = volID; primaryTestVolEmail.ActiveFlg = true; primaryTestVolEmail.PrimaryFlg = true; volEmail_bll.InsertEmailContext(ref primaryTestVolEmail); secondaryTestVolEmail = new sp_Email_DM(); secondaryTestVolEmail.EmailAddr = "*****@*****.**"; secondaryTestVolEmail.VolID = volID; secondaryTestVolEmail.ActiveFlg = true; secondaryTestVolEmail.PrimaryFlg = false; volEmail_bll.InsertEmailContext(ref secondaryTestVolEmail); }
/* public sp_Email_DM hSelectVolAddress(int emailID) { sp_Email_DM Email = new sp_Email_DM(); sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); Email = VolEmailBll.ListEmails(emailID); return Email; }*/ public void hUpdateVolEmail(sp_Email_DM Email, string emailAddress) { sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); Email.EmailAddr = emailAddress; VolEmailBll.UpdateEmailAddr(Email); }
public void hUpdateVolEmail(sp_Email_DM Email, string emailAddress, bool primaryFlg) { sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); Email.EmailAddr = emailAddress; Email.PrimaryFlg = primaryFlg; VolEmailBll.UpdateEmailAddr(Email); }
/// <summary> /// DeleteEmailsContext - Will do a soft delete (make inactive) by EmailID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteEmailsContext(sp_Email_DM _cEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var EmailsToRemove = (from n in context.tblVolEmails where n.EmailID == _cEmail.EmailID select n).FirstOrDefault(); context.tblVolEmails.Remove(EmailsToRemove); context.SaveChanges(); } }
public void DeleteEmailsContext(sp_Email_DM _cEmail) { System.Web.Caching.Cache cache = HttpRuntime.Cache; sp_Email_DM cacheEmails = (sp_Email_DM)cache[EmailType.VolEmail + "|" + _cEmail.VolID]; if(cacheEmails != null) { cache.Remove(EmailType.VolEmail + "|" + _cEmail.VolID); } BLL.DeleteEmailsContext(_cEmail); }
public List<sp_Email_DM> ListEmails(sp_Email_DM cVolEmail) { System.Web.Caching.Cache cache = HttpRuntime.Cache; List<sp_Email_DM> cacheEmails = (List<sp_Email_DM>)cache["" + EmailType.VolEmailList]; if (cacheEmails == null) { cacheEmails = BLL.ListEmails(cVolEmail); cache.Insert("" + EmailType.VolEmailList, cacheEmails, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, callback); } return cacheEmails; }
protected void HandleScreenLoad() { currentUser = Membership.GetUser(); pnlEmailGrid.Visible = true; sp_Email_DM VolDM = new sp_Email_DM(); VolDM.VolID = (Guid)currentUser.ProviderUserKey; rGridEmail.DataSource = VolEmailCash.ListEmails(VolDM); rGridEmail.DataBind(); }
/// <summary> /// DeleteEmailsContext - Will do a soft delete (make inactive) by EmailID /// </summary> /// <param name="_cVolunteer"></param> public void DeleteEmailsContext(sp_Email_DM _cEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var EmailsToRemove = (from n in context.tblVolEmails where n.EmailID == _cEmail.EmailID select n).FirstOrDefault(); //context.tblVolEmails.Remove(EmailsToRemove); EmailsToRemove.ActiveFlg = false; context.sp_Vol_Email_Update(EmailsToRemove.EmailID, EmailsToRemove.VolID, EmailsToRemove.EmailAddr, EmailsToRemove.ActiveFlg, EmailsToRemove.PrimaryFlg); context.SaveChanges(); } }
public sp_Email_DM ListPrimaryEmail(sp_Email_DM cVolEmail) { System.Web.Caching.Cache cache = HttpRuntime.Cache; sp_Email_DM cacheEmails = (sp_Email_DM)cache[EmailType.VolEmailPrimary + "|" + cVolEmail.EmailID]; if (cacheEmails == null) { cacheEmails = BLL.ListPrimaryEmail(cVolEmail); if (cacheEmails != null) { cache.Insert("" + EmailType.VolEmailPrimary + "|" + cVolEmail.EmailID, cacheEmails, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, callback); } } return cacheEmails; }
public sp_Email_DM hCreateVolEmail(string EmailAddr,Guid VolID,bool primaryEmail,ref int numberEmails) { sp_Email_DM Email = new sp_Email_DM(); sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); numberEmails = numberEmails + 1; Email.EmailID = numberEmails; Email.EmailAddr = EmailAddr; Email.VolID = VolID; Email.PrimaryFlg = primaryEmail; Email.ActiveFlg = true; VolEmailBll.InsertEmailContext(ref Email); return Email; }
/// <summary> /// InsertEmailContext - Will insert a record into Volunteer Email table via SProc /// </summary> /// <param name="_cVolunteer"></param> public void InsertEmailContext(sp_Email_DM _cEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var cEmail = new tblVolEmail { VolID = _cEmail.VolID, EmailID = _cEmail.EmailID, EmailAddr = _cEmail.EmailAddr, ActiveFlg = _cEmail.ActiveFlg }; context.tblVolEmails.Add(cEmail); context.SaveChanges(); } }
/// <summary> /// rGridEmail_NeedDataSource - Called when the grid needs a data source /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rGridEmail_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { try { sp_Email_DM VolDM = new sp_Email_DM(); VolDM.VolID = (Guid)currentUser.ProviderUserKey; rGridEmail.DataSource = VolEmailCash.ListEmails(VolDM); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public sp_Email_DM ListPrimaryEmail(sp_Email_DM cVolEmail) { sp_Email_DM item = new sp_Email_DM(); try { using (VolTeerEntities context = new VolTeerEntities()) { item = (from result in context.sp_Vol_Email_Select(cVolEmail.VolID, null, true) select new sp_Email_DM { EmailID = result.EmailID, EmailAddr = result.EmailAddr, VolID = result.VolID, ActiveFlg = result.ActiveFlg, PrimaryFlg = result.PrimaryFlg }).FirstOrDefault(); } // Guaranteed to close the Connection } catch (Exception ex) { throw (ex); } return item; }
public void InsertEmailContext(ref sp_Email_DM _cEmail) { BLL.InsertEmailContext(ref _cEmail); System.Web.Caching.Cache cache = HttpRuntime.Cache; cache.Insert(EmailType.VolEmail + "|" + _cEmail.VolID, _cEmail, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, callback); }
public void hDeleteVolEmail(sp_Email_DM Email) { sp_VolEmail_BLL VolEmailBll = new sp_VolEmail_BLL(); VolEmailBll.DeleteEmailsContext(Email); }
public void InsertEmailContext(ref sp_Email_DM _cEmail) { DAL.InsertEmailContext(ref _cEmail); }
/// <summary> /// UpdateEmailAddr - Will update a given Email Address record by EmailID /// </summary> /// <param name="_cVolunteer"></param> public void UpdateEmailAddr(sp_Email_DM _cEmail) { using (VolTeerEntities context = new VolTeerEntities()) { var cEmail = context.tblVolEmails.Find(_cEmail.EmailID); if (cEmail != null) { cEmail.EmailAddr = _cEmail.EmailAddr; cEmail.VolID = _cEmail.VolID; cEmail.ActiveFlg = _cEmail.ActiveFlg; context.SaveChanges(); } } }
public void UpdateEmailAddr(sp_Email_DM _cEmail) { System.Web.Caching.Cache cache = HttpRuntime.Cache; sp_Email_DM cacheEmails = (sp_Email_DM)cache[EmailType.VolEmail + "|" + _cEmail.VolID]; if (cacheEmails != null) { cache.Remove(EmailType.VolEmail + "|" + _cEmail.VolID); } cache.Insert(EmailType.VolEmail + "|" + _cEmail.VolID, _cEmail, null, DateTime.Now.AddSeconds(1), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, callback); BLL.UpdateEmailAddr(_cEmail); }
public void TestVolEmailCreate() { sp_Volunteer_BLL vol_bll = new sp_Volunteer_BLL(); sp_Volunteer_DM vol_dm = new sp_Volunteer_DM(); vol_dm.VolFirstName = "createFirst"; vol_dm.VolMiddleName = "createMiddle"; vol_dm.VolLastName = "createLast"; vol_dm.ActiveFlg = true; System.Guid volID = vol_bll.InsertVolunteerContext(ref vol_dm).VolID; vol_dm.VolID = volID; string volEmailAddr = "*****@*****.**"; bool PrimaryFlg = true; bool ActiveFlg = true; sp_VolEmail_BLL volEmail_bll = new sp_VolEmail_BLL(); sp_Email_DM volEmail_dm = new sp_Email_DM(); volEmail_dm.EmailAddr = volEmailAddr; volEmail_dm.VolID = volID; volEmail_dm.ActiveFlg = ActiveFlg; volEmail_dm.PrimaryFlg = PrimaryFlg; volEmail_bll.InsertEmailContext(ref volEmail_dm); int volEmailID = volEmail_dm.EmailID; List<sp_Email_DM> volEmailDMs_selected = volEmail_bll.ListEmails(volEmail_dm); Assert.IsTrue(EmailListContains(volEmailDMs_selected,volEmail_dm)); }
/// <summary> /// rGridEmail_DeleteCommand - Handle the delete command /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rGridEmail_DeleteCommand(object sender, GridCommandEventArgs e) { sp_Email_DM VolEmailDM = new sp_Email_DM(); try { VolEmailDM.VolID = (Guid)currentUser.ProviderUserKey; VolEmailDM.EmailID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmailID"]; VolEmailBLL.DeleteEmailsContext(VolEmailDM); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public List<sp_Email_DM> ListEmails(sp_Email_DM cVolEmail) { return DAL.ListEmails(cVolEmail); }
/// <summary> /// rGridAdress_UpdIns - Handle update/insert in a common procedure /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="iAction"></param> protected void rGridEmail_UpdIns(object sender, GridCommandEventArgs e, int iAction) { try { GridEditableItem eeditedItem = e.Item as GridEditableItem; sp_Email_DM VolEmailDM = new sp_Email_DM(); VolEmailDM.VolID = (Guid)currentUser.ProviderUserKey; if (iAction == (int)RecordAction.Update) { VolEmailDM.EmailID = Convert.ToInt32(eeditedItem.OwnerTableView.DataKeyValues[eeditedItem.ItemIndex]["EmailID"]); } VolEmailDM.ActiveFlg = (eeditedItem.FindControl("chkActive") as CheckBox).Checked; VolEmailDM.PrimaryFlg = (eeditedItem.FindControl("chkPrimaryFlg") as CheckBox).Checked; VolEmailDM.EmailAddr = (eeditedItem.FindControl("rTBEmail") as RadTextBox).Text.ToString(); if (iAction == (int)RecordAction.Update) { VolEmailBLL.UpdateEmailAddr(VolEmailDM); } else if (iAction == (int)RecordAction.Insert) { VolEmailBLL.InsertEmailContext(ref VolEmailDM); } } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } try { HandleScreenLoad(); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public sp_Email_DM ListPrimaryEmail(sp_Email_DM cVolEmail) { return DAL.ListPrimaryEmail(cVolEmail); }
public void DeleteEmailsContext(sp_Email_DM _cEmail) { DAL.DeleteEmailsContext(_cEmail); }
/// <summary> /// SetPrimaryValues - Paint the screen with default values (use non-telerik controls) /// </summary> protected void SetPrimaryValues() { //setup and bind all 3 primary values currentUser = Membership.GetUser(); sp_Vol_Address_DM address_DM = new sp_Vol_Address_DM(); sp_Email_DM email_DM = new sp_Email_DM(); sp_Phone_DM phone_DM = new sp_Phone_DM(); StringBuilder sb = new StringBuilder(); try { //email code email_DM.VolID = (Guid)currentUser.ProviderUserKey; email_DM = VolEmailCache.ListPrimaryEmail(email_DM); if (email_DM != null) { PrimaryEmail.Text = email_DM.EmailAddr; } else { PrimaryEmail.Text = "-- NONE --"; } //phone code phone_DM.VolID = (Guid)currentUser.ProviderUserKey; phone_DM = VolPhoneCache.ListPrimaryPhone(phone_DM); if (phone_DM != null) { PrimaryPhone.Text = phone_DM.PhoneNbr; } else { PrimaryPhone.Text = "-- NONE --"; } //address code address_DM.VolID = (Guid)currentUser.ProviderUserKey; address_DM = VolAddrCash.ListPrimaryAddress(address_DM); sb.Clear(); if (address_DM != null) { sb.Append(address_DM.AddrLine1.ToString()); sb.Append(" "); if (!string.IsNullOrEmpty(address_DM.AddrLine2)) { sb.Append(address_DM.AddrLine2.ToString()); sb.Append(" "); } if (!string.IsNullOrEmpty(address_DM.AddrLine3)) { sb.Append(address_DM.AddrLine3.ToString()); sb.Append(" "); } sb.Append(", "); sb.Append(address_DM.City.ToString()); sb.Append(" "); sb.Append(address_DM.St.ToString()); sb.Append(", "); sb.Append(address_DM.Zip.ToString()); if (!string.IsNullOrEmpty(address_DM.Zip4.ToString())) { sb.Append('-'); sb.Append(address_DM.Zip4.ToString()); } } PrimaryAddress.Text = sb.ToString(); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public void UpdateEmailAddr(sp_Email_DM _cEmail) { DAL.UpdateEmailAddr(_cEmail); }