Example #1
0
    //SENDING MAIL to admin
    protected void suggestion_btn_click(object sender, EventArgs e)
    {
        Next_ID       nid   = new Next_ID();
        suggestionBO  s_bo  = new suggestionBO();
        suggestionBAL s_bal = new suggestionBAL();

        try
        {
            s_bo.suggestion_id  = nid.incrementer("suggestion_id", "suggestion");
            s_bo.user_name      = getusername.UserNameFetch(Convert.ToInt32(Session["user_id"]));
            s_bo.userEmail      = getusername.UserEmailFetch(Convert.ToInt32(Session["user_id"]));
            s_bo.subject        = DDLEmailSubject.SelectedValue.ToString();
            s_bo.suggestion_msg = writeEmail.Value;
            writeEmail.Value    = "";

            //Server.HtmlEncode(hid_Email_body.Value.ToString());

            s_bo.date_time = Convert.ToDateTime(DateTime.Now.ToString());

            if (s_bal.suggestion_DAL_insert(s_bo) > 0)
            {
                Response.Write("<script type='text/javascript'> window.onload=function(){document.getElementById('parent').style.display='block';}; </script>");
                //Response.Redirect("~/UserProfile.aspx");
            }
        }
        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("UserProfileSuggestion.aspx", ex.ToString());
            Response.Write("<script>alert('Some Error Occured \n Sorry for inconvenience');</script>");
        }
    }
Example #2
0
 //inserting data into news
 public int news_DAL_insert(newsBO news_bo)
 {
     try
     {
         Next_ID nid = new Next_ID();
         news_bo.news_id = nid.incrementer("news_id", "news");
         s_querry        = "insert into news values(@news_id,@admin_id,@news_title,@news_desc,@date_time_of_post,@news_pic)";
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd = new SqlCommand(s_querry, con);
         cmd.Parameters.AddWithValue("@news_id", news_bo.news_id);
         cmd.Parameters.AddWithValue("@admin_id", news_bo.admin_id);
         cmd.Parameters.AddWithValue("@news_title", news_bo.news_title);
         cmd.Parameters.AddWithValue("@news_desc", news_bo.news_desc);
         cmd.Parameters.AddWithValue("@date_time_of_post", news_bo.date_time_of_post);
         cmd.Parameters.AddWithValue("@news_pic", news_bo.news_pic);
         return(cmd.ExecuteNonQuery());
     }
     catch (Exception)
     {
         throw;
     }
     finally { cmd.Dispose(); con.Close(); con.Dispose(); }
 }
Example #3
0
    //inserting into database
    public int funds_DAL_insert(fundsBO funds_BO)
    {
        try
        {
            Next_ID nid = new Next_ID();
            funds_BO.sl_no = nid.incrementer("sl_no", "funds");
            s_querry       = "insert into funds(sl_no,first_name,last_name,email_id,uknown_user,amount) values(@sl_no,@first_name,@last_name,@email_id,@uknown_user,@amount)";
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            cmd = new SqlCommand(s_querry, con);
            cmd.Parameters.AddWithValue("@sl_no", funds_BO.sl_no);
            cmd.Parameters.AddWithValue("@first_name", funds_BO.first_name);
            cmd.Parameters.AddWithValue("@last_name", funds_BO.last_name);
            cmd.Parameters.AddWithValue("@email_id", funds_BO.email_id);
            cmd.Parameters.AddWithValue("@uknown_user", funds_BO.unknown_user);
            cmd.Parameters.AddWithValue("@amount", funds_BO.amount);

            return(cmd.ExecuteNonQuery());
        }
        catch (Exception)
        {
            throw;
        }
        finally { cmd.Dispose(); con.Close(); con.Dispose(); }
    }
Example #4
0
    protected void send_feedBack(object sender, EventArgs e)
    {
        Next_ID nid = new Next_ID();
        suggestionBAL sBal = new suggestionBAL();
        suggestionBO sBO = new suggestionBO();
        try
        {
            sBO.user_name = sugName.Value;
            sBO.suggestion_id = nid.incrementer("suggestion_id", "suggestion");
            sBO.suggestion_msg = comments.Value;
            sBO.date_time = Convert.ToDateTime(DateTime.Now.ToString());
            sBO.userEmail = txtemail.Value;
            if (sBal.suggestion_DAL_insert(sBO) > 0)
            {
                Response.Write("<script>alert('Thansk for your valuable feedback ');</script>");
                sugName.Value = "";
                comments.Value = "";
                txtemail.Value = "";
            }
        }
        catch (Exception)
        {

            Response.Write("<script>alert('Sorry for inconvenience ');</script>");
        }
    }
    protected void send_feedBack(object sender, EventArgs e)
    {
        Next_ID       nid  = new Next_ID();
        suggestionBAL sBal = new suggestionBAL();
        suggestionBO  sBO  = new suggestionBO();

        try
        {
            sBO.user_name      = sugName.Value.Trim() + suglName.Value.Trim();
            sBO.suggestion_id  = nid.incrementer("suggestion_id", "suggestion");
            sBO.suggestion_msg = comments.Value;
            sBO.date_time      = Convert.ToDateTime(DateTime.Now.ToString());
            sBO.userEmail      = txtemail.Value;
            sBO.subject        = "";


            if (sBal.suggestion_DAL_insert(sBO) > 0)
            {
                Response.Write("<script>alert('Thansk for your valuable feedback ');</script>");
                sugName.Value  = "";
                comments.Value = "";
                txtemail.Value = "";
            }
        }
        catch (Exception ex)
        {
            ErrorReportBAL error = new ErrorReportBAL();
            error.SendErrorReport("ContachUs.aspx", ex.ToString());
            Response.Write("<script>alert('An error occured \n Sorry for inconvenience ');</script>");
        }
    }
    public void UserPostNewBlog(blog_postBO nBlog)
    {
        try
        {
            Next_ID nid = new Next_ID();
            nBlog.blog_id = nid.incrementer("blog_id", "blog_post");

            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }



            int isadmin      = 0;
            int blog_checked = 0;;
            nBlog.date_time_of_post = System.DateTime.Now;


            if (nBlog.is_admin)
            {
                isadmin      = 1;
                blog_checked = 1;
            }
            else
            {
                isadmin      = 0;
                blog_checked = 0;
            }

            String query = "insert into blog_post(blog_id,blog_title,blog_content,poster_id,is_admin,date_time_of_post,blog_checked) values(@bid,@title,@content,@posterid,@isadmin,@datetime,@blog_checked)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@bid", nBlog.blog_id);
            command.Parameters.AddWithValue("@title", nBlog.blog_title.ToString());
            command.Parameters.AddWithValue("@content", nBlog.blog_content.ToString());
            command.Parameters.AddWithValue("@posterid", nBlog.poster_id);
            command.Parameters.AddWithValue("@isadmin", isadmin);
            command.Parameters.AddWithValue("@datetime", nBlog.date_time_of_post.ToString());
            command.Parameters.AddWithValue("@blog_checked", blog_checked);

            command.ExecuteNonQuery();
            command.Dispose();
            newcon.Close();
        }

        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
    public bool UserSignUp(user_infoBO social_login_info)
    {
        try
        {
            if (check_emailId(social_login_info.email_id.ToString()))
            {
                return(true);
            }
            else
            {
                if (newcon.State == ConnectionState.Closed)
                {
                    newcon.Open();
                }

                Next_ID newid = new Next_ID();

                int social = social_login_info.social == true ? 1 : 0;        //getting the bit value for social field in db

                social_login_info.user_id = newid.incrementer("user_id", "user_info");



                social_login_info.join_date = System.DateTime.Now;
                String query = "Insert into user_info(user_id,email_id,first_name,join_date,social_type,social,profile_pic) values(@user_id,@email_id,@first_name,@join_date,@social_type,@social,@profile_pic)";

                command = new SqlCommand(query, newcon);
                command.Parameters.AddWithValue("@user_id", social_login_info.user_id);
                command.Parameters.AddWithValue("@email_id", social_login_info.email_id);
                command.Parameters.AddWithValue("@first_name", social_login_info.first_name);
                command.Parameters.AddWithValue("@social_type", social_login_info.social_type);
                command.Parameters.AddWithValue("@social", social);
                command.Parameters.AddWithValue("@profile_pic", social_login_info.profile_pic);


                command.Parameters.AddWithValue("@join_date", social_login_info.join_date.ToString());

                command.ExecuteNonQuery();
                command.Dispose();

                return(true);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
    public int NewUserRegister(user_infoBO user_info)
    {
        try
        {
            if (!(check_emailId(user_info.email_id)))
            {
                if (newcon.State == ConnectionState.Closed)
                {
                    newcon.Open();
                }

                Next_ID newid = new Next_ID();

                user_info.user_id = newid.incrementer("user_id", "user_info");

                user_info.join_date = System.DateTime.Now;

                String query = "Insert into user_info(user_id,email_id,first_name,last_name,password,country,join_date) values(@user_id,@email_id,@first_name,@last_name,@password,@country,@join_date)";

                command = new SqlCommand(query, newcon);
                command.Parameters.AddWithValue("@user_id", user_info.user_id);
                command.Parameters.AddWithValue("@email_id", user_info.email_id);
                command.Parameters.AddWithValue("@first_name", user_info.first_name);
                command.Parameters.AddWithValue("@last_name", user_info.last_name);
                command.Parameters.AddWithValue("@password", user_info.password);
                //command.Parameters.AddWithValue("@user_type",user_info.user_type);
                command.Parameters.AddWithValue("@country", user_info.country);
                //command.Parameters.AddWithValue("@city", user_info.city);
                command.Parameters.AddWithValue("@join_date", user_info.join_date.ToString());

                command.ExecuteNonQuery();
                command.Dispose();

                return(2);
            }
            else
            {
                return(1);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Example #9
0
    public String NextImageName(String currentimage_name)
    {
        try
        {
            Next_ID generateimageid = new Next_ID();

            int newImageID = generateimageid.incrementer("img_id", "image_slider");    //got now image ID , now change the image name to img_id.jpg

            String[] temp          = currentimage_name.Split('.');
            String   img_extension = temp[1];
            String   newimage_name = newImageID.ToString() + "." + img_extension;  // New name for the image

            return(newimage_name);
        }
        catch
        {
            throw;
        }
    }
    // Admin Events functions

    public void PostNewEvent(eventsBO new_event)                 //post new event
    {
        try
        {
            Next_ID nid = new Next_ID();
            new_event.event_id = nid.incrementer("event_id", "events");

            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }


            String query = "insert into events(event_id,admin_id,event_title,event_desc,event_time,event_place,event_pic,date_time_of_post) values(@eid,@aid,@title,@desc,@etime,@eplace,@epic,@datetime)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@eid", new_event.event_id);
            command.Parameters.AddWithValue("@aid", new_event.admin_id);
            command.Parameters.AddWithValue("@title", new_event.event_title.ToString());
            command.Parameters.AddWithValue("@desc", new_event.event_desc.ToString());
            command.Parameters.AddWithValue("@etime", new_event.event_time);
            command.Parameters.AddWithValue("@eplace", new_event.event_place.ToString());
            command.Parameters.AddWithValue("@epic", new_event.event_pic);
            command.Parameters.AddWithValue("@datetime", new_event.date_time_of_post);

            command.ExecuteNonQuery();
            command.Dispose();
            newcon.Close();
        }

        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
    public void BlogPostComments(blog_commentsBO blogComment)
    {
        try
        {
            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }

            Next_ID id = new Next_ID();

            blogComment.comment_id           = id.incrementer("comment_id", "blog_comments");
            blogComment.date_time_of_comment = System.DateTime.Now;

            String query = "insert into blog_comments values(@comment_id,@blog_id,@poster_id,@is_admin,@comment,@date_time_of_post)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@comment_id", blogComment.comment_id);
            command.Parameters.AddWithValue("@blog_id", blogComment.blog_id);
            command.Parameters.AddWithValue("@poster_id", blogComment.poster_id);
            command.Parameters.AddWithValue("@is_admin", Convert.ToInt32((blogComment.is_admin ? 1 : 0)));
            command.Parameters.AddWithValue("@comment", blogComment.comment.ToString());
            command.Parameters.AddWithValue("@date_time_of_post", blogComment.date_time_of_comment.ToString());

            command.ExecuteNonQuery();

            command.Dispose();
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Example #12
0
    }      //load the image to the slider

    public void SaveNewImage(String image_name)
    {
        try
        {
            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }

            Next_ID generateimageid = new Next_ID();

            image_sliderBO newimage = new image_sliderBO();

            newimage.img_id = generateimageid.incrementer("img_id", "image_slider");

            newimage.img_link = "../Images/sliderImages/" + image_name;

            String query = "insert into image_slider(img_id,img_link) values(@img_id,@img_link)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@img_id", newimage.img_id);
            command.Parameters.AddWithValue("@img_link", newimage.img_link);
            command.ExecuteNonQuery();
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Example #13
0
    public void BlogPostComments(blog_commentsBO blogComment)
    {
        try
        {
            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }

            Next_ID id = new Next_ID();

            blogComment.comment_id = id.incrementer("comment_id","blog_comments");
            blogComment.date_time_of_comment = System.DateTime.Now;

            String query = "insert into blog_comments values(@comment_id,@blog_id,@poster_id,@is_admin,@comment,@date_time_of_post)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@comment_id", blogComment.comment_id);
            command.Parameters.AddWithValue("@blog_id",blogComment.blog_id);
            command.Parameters.AddWithValue("@poster_id",blogComment.poster_id);
            command.Parameters.AddWithValue("@is_admin", Convert.ToInt32((blogComment.is_admin ? 1 : 0)));
            command.Parameters.AddWithValue("@comment",blogComment.comment.ToString());
            command.Parameters.AddWithValue("@date_time_of_post", blogComment.date_time_of_comment.ToString());

            command.ExecuteNonQuery();

            command.Dispose();

        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Example #14
0
    public int NewUserRegister(user_infoBO user_info)
    {
        try
        {

            if (!(check_emailId(user_info.email_id)))
            {

                if (newcon.State == ConnectionState.Closed)
                {
                    newcon.Open();
                }

                Next_ID newid = new Next_ID();

                user_info.user_id = newid.incrementer("user_id", "user_info");

                user_info.join_date = System.DateTime.Now;

                int x = 0;

                if (user_info.user_type == true)
                {
                    x = 1;
                }

                String query = "Insert into user_info(user_id,email_id,first_name,last_name,password,user_type,country,city,join_date) values(@user_id,@email_id,@first_name,@last_name,@password,@user_type,@country,@city,@join_date)";

                command = new SqlCommand(query, newcon);
                command.Parameters.AddWithValue("@user_id", user_info.user_id);
                command.Parameters.AddWithValue("@email_id", user_info.email_id);
                command.Parameters.AddWithValue("@first_name", user_info.first_name);
                command.Parameters.AddWithValue("@last_name", user_info.last_name);
                command.Parameters.AddWithValue("@password", user_info.password);
                command.Parameters.AddWithValue("@user_type", x);
                command.Parameters.AddWithValue("@country", user_info.country);
                command.Parameters.AddWithValue("@city", user_info.city);
                command.Parameters.AddWithValue("@join_date", user_info.join_date.ToString());

                command.ExecuteNonQuery();
                command.Dispose();

                return 2;
            }
            else
            {
               return 1;
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Example #15
0
    //post new event
    // Admin Events functions
    public void PostNewEvent(eventsBO new_event)
    {
        try
        {
            Next_ID nid = new Next_ID();
            new_event.event_id = nid.incrementer("event_id", "events");

            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }

            String query = "insert into events(event_id,admin_id,event_title,event_desc,event_time,event_place,date_time_of_post) values(@eid,@aid,@title,@desc,@etime,@eplace,@datetime)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@eid", new_event.event_id);
            command.Parameters.AddWithValue("@aid",new_event.admin_id);
            command.Parameters.AddWithValue("@title", new_event.event_title.ToString());
            command.Parameters.AddWithValue("@desc",new_event.event_desc.ToString());
            command.Parameters.AddWithValue("@etime",new_event.event_time);
            command.Parameters.AddWithValue("@eplace",new_event.event_place.ToString());
            command.Parameters.AddWithValue("@datetime", new_event.date_time_of_post);

            command.ExecuteNonQuery();
            command.Dispose();
            newcon.Close();
        }

        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }
Example #16
0
    public void AdminPostBlog(blog_postBO nBlog)
    {
        try
        {
            Next_ID nid = new Next_ID();
            nBlog.blog_id = nid.incrementer("blog_id", "blog_post");

            if (newcon.State == ConnectionState.Closed)
            {
                newcon.Open();
            }

            int isadmin = 0;

            nBlog.date_time_of_post = System.DateTime.Now;

            if (nBlog.is_admin)
            {
                isadmin = 1;
            }
            else
            {
                isadmin = 0;
            }

            String query = "insert into blog_post values(@bid,@title,@content,@posterid,@isadmin,@datetime)";
            command = new SqlCommand(query, newcon);

            command.Parameters.AddWithValue("@bid",nBlog.blog_id);
            command.Parameters.AddWithValue("@title", nBlog.blog_title.ToString());
            command.Parameters.AddWithValue("@content", nBlog.blog_content.ToString());
            command.Parameters.AddWithValue("@posterid",nBlog.poster_id);
            command.Parameters.AddWithValue("@isadmin",isadmin);
            command.Parameters.AddWithValue("@datetime", nBlog.date_time_of_post.ToString());

            command.ExecuteNonQuery();
            command.Dispose();
            newcon.Close();
        }

        catch
        {
            throw;
        }
        finally
        {
            if (newcon.State == ConnectionState.Open)
            {
                newcon.Close();
            }
        }
    }