Ejemplo n.º 1
0
 private bool IsValidUser(string username, string password)
 {
     int roles = 0;
     string firstName = string.Empty;
     FSFPL.DataAccess.StaffDA DA = new FSFPL.DataAccess.StaffDA();
     DA.Authenticate(username, password, ref roles, ref firstName);
     DA = null;
     if (roles > 0)
     {
         HttpCookie cookie = new HttpCookie("FSFPLAdmin");
         cookie.Values.Add("roles", roles.ToString());
         cookie.Values.Add("firstName", firstName);
         Response.Cookies.Add(cookie);
     }
     return (roles > 0);
 }
Ejemplo n.º 2
0
        public static void SendStaffEmail(EmailType emailType, StringBuilder sbEmailBody)
        {
            bool donationEmail = false;
            bool membershipEmail = false;
            bool volunteerEmail = false;
            string toEmail = string.Empty;
            ArrayList emailList = new ArrayList();
            FSFPL.DataAccess.StaffDA DA = new FSFPL.DataAccess.StaffDA();

            DataTable dt = DA.GetStaffEmail();

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["Email"] != null && dr["DonationEmail"] != null)
                {
                    toEmail = (string)dr["Email"];
                    donationEmail = (bool)dr["DonationEmail"];
                    membershipEmail = (bool)dr["MembershipEmail"];
                    volunteerEmail = (bool)dr["VolunteerEmail"];
                    switch (emailType)
                    {
                        case EmailType.Donation:
                            if (donationEmail)
                            {
                                emailList.Add(toEmail);
                            }
                            break;
                        case EmailType.Membership:
                            if (membershipEmail)
                            {
                                emailList.Add(toEmail);
                            }
                            break;
                        case EmailType.Volunteer:
                            if (volunteerEmail)
                            {
                                emailList.Add(toEmail);
                            }
                            break;
                    }
                }
            }

            dt.Dispose();

            if (emailList.Count > 0)
            {
                switch (emailType)
                {
                    case EmailType.BookDonation:
                        _sendStaffEmail(_emailAddress(FSFPL_DONATION_EMAIL), "New Book Donation Pickup Request", emailList, sbEmailBody);
                        break;
                    case EmailType.Donation:
                        _sendStaffEmail(_emailAddress(FSFPL_DONATION_EMAIL), "New FSFPL Donation", emailList, sbEmailBody);
                        break;
                    case EmailType.Membership:
                        _sendStaffEmail(_emailAddress(FSFPL_MEMBERSHIP_EMAIL), "New FSFPL Membership", emailList, sbEmailBody);
                        break;
                    case EmailType.Volunteer:
                        _sendStaffEmail(_emailAddress(FSFPL_VOLUNTEER_EMAIL), "New FSFPL Volunteer", emailList, sbEmailBody);
                        break;
                }
            }
        }