Ejemplo n.º 1
0
        public bool RegisterUID(string value)
        {
            AdminCreds admin         = new AdminCreds();
            UIDdetails obj           = JsonConvert.DeserializeObject <UIDdetails>(value);
            var        cloudinaryURL = storeUID(obj);

            if (!String.IsNullOrEmpty(cloudinaryURL))
            {
                string user_id         = JsonConvert.SerializeObject(obj);
                string encoded_user_id = Convert.ToBase64String(Encoding.UTF8.GetBytes(obj.uid));
                string councelorEmail  = "*****@*****.**";
                string emailSubject    = "Verification for UID: " + obj.uid;
                string emailbody       = "<table align='center' cellspacing='0' style='border:none!important;margin: none !important;' width='auto'>" +
                                         "<tr><td colspan='2' bgcolor='#016648' style='text-align: center; padding-top: 10px;'> <img style='border: 2px solid white; border-radius: 5px; width: 130px;' src='https://cdn0.vox-cdn.com/thumbor/nxgcGlGlYmGUiZZzGWDm2nve4Bk=/0x0:547x365/1310x873/cdn0.vox-cdn.com/uploads/chorus_image/image/33573117/Rocky_The_Bull.0.jpg'></td></tr>" +
                                         "<tr><td colspan='2' bgcolor='#016648' style='color: white; font-size: 300%; padding: 10px; text-align:center;'><span style='width: 100%;'>Bulls Allowed to Booze</span></td></tr>" +
                                         "<tr><td style='padding: 5px;'> Hello Councelor, </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'> Please verify the following UID details: </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'> UID: </td><td style='padding: 5px; text-align: center;'>" + obj.uid + "</td></tr>" +
                                         "<tr><td style='padding: 5px;'> Given Name: </td><td style='padding: 5px; text-align: center;'>" + obj.given_name + "</td></tr>" +
                                         "<tr><td style='padding: 5px;'> Last Name: </td><td style='padding: 5px; text-align: center;'>" + obj.last_name + "</td></tr>" +
                                         "<tr><td style='padding: 5px;'> Date of Birth: </td><td style='padding: 5px; text-align: center;'>" + obj.date_of_birth + "</td></tr>" +
                                         "<tr><td style='padding: 5px;'> Photo: </td><td style='padding: 5px; text-align: center;'><img src = '" + cloudinaryURL + "' /></td></tr>" +
                                         "<tr><td style='padding: 5px;'> Click link to Validate / Invalidate: </td><td style='padding: 5px; text-align: center;'><a href='http://localhost:55880/Verify.aspx?id=" + HttpUtility.UrlEncode(encoded_user_id) + "'>Validate / Invalidate</a></td></tr>" +
                                         "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'>Thanks,</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td style='padding: 5px;'>Team Bulls Allowed to Booze</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                         "<tr><td colspan='2' bgcolor='#016648' style='padding:5px;'></td></tr>" +
                                         "</table> ";
                bool checkSendEmail = SendEmail(admin.email, admin.password, councelorEmail, emailSubject, emailbody, true);
                if (checkSendEmail == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public bool VerifyUID(string id, bool isverified, string comment)
        {
            bool       data_updated;
            AdminCreds admin = new AdminCreds();

            string        connectionconfig = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
            SqlConnection con = new SqlConnection(connectionconfig);

            con.Open();

            string user_email      = "";
            string user_given_name = "";

            SqlCommand cmd = new SqlCommand("SELECT given_name,email from register WHERE uid=@uid", con);

            cmd.Parameters.AddWithValue("@uid", id);
            using (SqlDataReader reader = cmd.ExecuteReader())
            {
                // Check is the reader has any rows at all before starting to read.
                if (reader.HasRows)
                {
                    // Read advances to the next row.
                    while (reader.Read())
                    {
                        user_email      = reader.GetString(reader.GetOrdinal("email"));
                        user_given_name = reader.GetString(reader.GetOrdinal("given_name"));
                    }
                }
            }


            if (isverified)
            {
                cmd = new SqlCommand("UPDATE register SET uid_verified = @isverified WHERE uid = @uid", con);
                cmd.Parameters.AddWithValue("@isverified", isverified);
                cmd.Parameters.AddWithValue("@uid", id);
                int result = cmd.ExecuteNonQuery();

                if (result > 0)
                {
                    string emailbody = "<table align='center' cellspacing='0' style='border:none!important;margin: none !important;' width='auto'>" +
                                       "<tr><td colspan='2' bgcolor='#016648' style='text-align: center; padding-top: 10px;'> <img style='border: 2px solid white; border-radius: 5px; width: 130px;' src='https://cdn0.vox-cdn.com/thumbor/nxgcGlGlYmGUiZZzGWDm2nve4Bk=/0x0:547x365/1310x873/cdn0.vox-cdn.com/uploads/chorus_image/image/33573117/Rocky_The_Bull.0.jpg'></td></tr>" +
                                       "<tr><td colspan='2' bgcolor='#016648' style='color: white; font-size: 300%; padding: 10px; text-align:center;'><span style='width: 100%;'>Bulls Allowed to Booze</span></td></tr>" +
                                       "<tr><td style='padding: 5px;'> Hello " + user_given_name + ", </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> You have been Successfully Registered and Verified as a Bull allowed to Booze.</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'>Thanks,</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'>Team Bulls Allowed to Booze</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td colspan='2' bgcolor='#016648' style='padding:5px;'></td></tr>" +
                                       "</table> ";
                    SendEmail(admin.email, admin.password, user_email, "Registration Successfull!", emailbody, true);
                    data_updated = true;
                }
                else
                {
                    data_updated = false;
                }
            }
            else
            {
                cmd = new SqlCommand("Delete from register WHERE uid=@uid", con);
                cmd.Parameters.AddWithValue("@uid", id);
                if (cmd.ExecuteNonQuery() == 1)
                {
                    string emailbody = "<table align='center' cellspacing='0' style='border:none!important;margin: none !important;' width='auto'>" +
                                       "<tr><td colspan='2' bgcolor='#016648' style='text-align: center; padding-top: 10px;'> <img style='border: 2px solid white; border-radius: 5px; width: 130px;' src='https://cdn0.vox-cdn.com/thumbor/nxgcGlGlYmGUiZZzGWDm2nve4Bk=/0x0:547x365/1310x873/cdn0.vox-cdn.com/uploads/chorus_image/image/33573117/Rocky_The_Bull.0.jpg'></td></tr>" +
                                       "<tr><td colspan='2' bgcolor='#016648' style='color: white; font-size: 300%; padding: 10px; text-align:center; '><span style='width: 100%;'>Bulls Allowed to Booze</span></td></tr>" +
                                       "<tr><td style='padding: 5px;'> Hello Gopalkirshna, </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> Your Registeration to Bulls Allowed to booze has failed.</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> <h4>Reason: " + comment + "</h4></td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> Please register again with the changes as per the reason.</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'> </td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'>Thanks,</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td style='padding: 5px;'>Team Bulls Allowed to Booze</td><td style='padding: 5px; text-align: center;'> </td></tr>" +
                                       "<tr><td colspan='2' bgcolor='#016648' style='padding:5px;'></td></tr>" +
                                       "</table> ";
                    SendEmail(admin.email, admin.password, user_email, "Registration failed!", emailbody, true);
                    data_updated = true;
                }
                else
                {
                    data_updated = false;
                }
            }

            con.Close();
            return(data_updated);
        }