예제 #1
0
    // Post Comment

    public static long Add(Comment_Struct cmt, int Comments)
    {
        // *********************************************************//
        // SCREENING Data Script: Updated in VSK 5.2
        // *********************************************************//
        if (Config.Get_ScreeningOption() == 1)
        {
            // screening, matching and replacing enabled
            // the following script will screen content with matching words e.g "apple" -> "a***e"
            cmt.Comment = DictionaryBLL.Process_Screening(cmt.Comment);
        }
        //// Stored Procedure Version
        //SqlParameter CommentID = new SqlParameter("@CommentID", MySqlDbType.Int64);
        //CommentID.Direction = ParameterDirection.Output;
        //SqlHelper.ExecuteNonQuery(Config.ConnectionString, CommandType.StoredProcedure, "VSK_Comments_Post", CommentID, new SqlParameter("@VideoID", cmt.VideoID), new SqlParameter("@username", cmt.UserName), new SqlParameter("@comments", cmt.Comment), new SqlParameter("@date_added", DateTime.Now), new SqlParameter("@type", cmt.Type), new SqlParameter("@replyid", cmt.ReplyID), new SqlParameter("@profileid", cmt.ProfileID));
        SqlConnection con = new SqlConnection(Config.ConnectionString);
        // generate sql query
        StringBuilder str = new StringBuilder();

        str.Append("Insert Into comments(VideoID,username,_comment,added_date,type,replyid,profileid)values(@VideoID,@UserName,@Comments,@Date_Added,@Type,@ReplyID,@ProfileID);Select SCOPE_IDENTITY();");
        // execute sql query
        SqlCommand cmd = new SqlCommand(str.ToString(), con);

        cmd.CommandType = CommandType.Text;
        cmd.Parameters.Add(new SqlParameter("@VideoID", cmt.VideoID));
        cmd.Parameters.Add(new SqlParameter("@UserName", cmt.UserName));
        cmd.Parameters.Add(new SqlParameter("@Comments", cmt.Comment));
        cmd.Parameters.Add(new SqlParameter("@Type", cmt.Type));
        cmd.Parameters.Add(new SqlParameter("@ReplyID", cmt.ReplyID));
        cmd.Parameters.Add(new SqlParameter("@ProfileID", cmt.ProfileID));
        cmd.Parameters.Add(new SqlParameter("@Date_Added", DateTime.Now));
        if (con.State != ConnectionState.Open)
        {
            con.Open();
        }
        long id = Convert.ToInt64(cmd.ExecuteScalar());

        string level = id.ToString();

        if (cmt.ReplyID > 0)
        {
            long c = cmt.ReplyID - 1; // in order to order replies based on comment id / replies
            level = c + "." + id.ToString();
        }
        // Update Level
        //SqlHelper.ExecuteNonQuery(Config.ConnectionString, CommandType.StoredProcedure, "VSK_Comments_UpdateLevel", CommentID, new SqlParameter("@_CommentID", CommentID.Value), new SqlParameter("@_Level", level));
        SqlHelper.ExecuteNonQuery(Config.ConnectionString, CommandType.Text, "Update comments set level=@Level WHERE CommentID=@CommentID;", new SqlParameter("@CommentID", id), new SqlParameter("@Level", level));
        Comments++;
        if (cmt.ProfileID != "")
        {
            members.Update_Value(cmt.ProfileID, "comments", Comments.ToString());
        }
        else
        {
            Update_Comment_Statistics(cmt.VideoID, cmt.Type, Comments);
        }
        return(id);
    }
예제 #2
0
 private static void ScreenContent(ApplicationDbContext context, JGN_Blogs entity)
 {
     if (Jugnoon.Settings.Configs.GeneralSettings.screen_content == 1)
     {
         entity.title       = DictionaryBLL.Process_Screening(context, UtilityBLL.processNull(entity.title, 0));
         entity.description = DictionaryBLL.Process_Screening(context, UtilityBLL.processNull(entity.description, 0));
         entity.tags        = DictionaryBLL.Process_Screening(context, UtilityBLL.processNull(entity.tags, 0));
     }
 }
        // Note: PlayList Important Terms

        // isEnabled:
        // ........... 0: Disabled PlayList
        // ........... 1: Enable PlayList

        // isapproved:
        // ........... 0: Not approved
        // ........... 1: Approved

        // Privacy:
        // ........... 0: Private
        // ........... 1: Public


        // Videos:
        // Store Statistic for no of videos available in playlist

        public static async Task <bool> Add(ApplicationDbContext context, string userid, string title)
        {
            if (Jugnoon.Settings.Configs.GeneralSettings.screen_content == 1)
            {
                title = DictionaryBLL.Process_Screening(context, title);
            }

            var _entity = new JGN_User_Playlists()
            {
                userid     = userid,
                title      = title,
                created_at = DateTime.Now
            };

            context.Entry(_entity).State = EntityState.Added;
            await context.SaveChangesAsync();

            return(true);
        }
예제 #4
0
        public void ProcessRequest(HttpContext context)
        {
            var json        = new StreamReader(context.Request.InputStream).ReadToEnd();
            var responseMsg = new Dictionary <string, string>();


            bool   isUpdate       = false;
            int    Records        = 0;
            string Keywords       = "";
            string Text           = "";
            string Order          = "";
            int    PageNumnber    = 0;
            var    _dictionaryobj = new DictionaryBLL();
            var    _ld_dictionary = JsonConvert.DeserializeObject <Dictionary_Struct>(json);

            var _ld_dictionary_data = new Dictionary <string, DictionaryObject>();

            if ((context.Request.Params["action"] != null))
            {
                switch (context.Request.Params["action"])
                {
                case "add":
                    // Authentication
                    if (!context.User.Identity.IsAuthenticated)
                    {
                        responseMsg["status"]  = "error";
                        responseMsg["message"] = "Authentication Failed";
                        context.Response.Write(responseMsg);
                        return;
                    }

                    DictionaryBLL.Add(_ld_dictionary.Value, _ld_dictionary.Type);

                    responseMsg["status"]  = "success";
                    responseMsg["message"] = "Operation Commit";
                    context.Response.Write(responseMsg);
                    break;

                case "delete":

                    DictionaryBLL.Delete(_ld_dictionary.ID);
                    responseMsg["status"]  = "success";
                    responseMsg["message"] = "Operation Commit";
                    context.Response.Write(responseMsg);

                    break;

                case "load":

                    DictionaryBLL.Load(_ld_dictionary.Type);
                    responseMsg["status"] = "success";
                    context.Response.Write(responseMsg);

                    break;

                case "return_value":

                    DictionaryBLL.Return_Values(_ld_dictionary.Type);
                    responseMsg["status"] = "success";
                    context.Response.Write(responseMsg);

                    break;

                case "process_screening":
                    if (context.Request.Params["text"] != null)
                    {
                        Text = context.Request.Params["text"].ToString();
                    }
                    DictionaryBLL.Process_Screening(Text);
                    responseMsg["status"] = "success";
                    context.Response.Write(responseMsg);

                    break;

                case "is_match":
                    if (context.Request.Params["text"] != null)
                    {
                        Text = context.Request.Params["text"].ToString();
                    }
                    if (context.Request.Params["keywords"] != null)
                    {
                        Keywords = context.Request.Params["keywords"].ToString();
                    }
                    DictionaryBLL.isMatch(Text, Keywords);
                    responseMsg["status"] = "success";
                    context.Response.Write(responseMsg);

                    break;

                case "validate_search_word":
                    if (context.Request.Params["text"] != null)
                    {
                        Text = context.Request.Params["text"].ToString();
                    }
                    DictionaryBLL.Validate_Search_Word(Text);
                    responseMsg["status"] = "success";
                    context.Response.Write(responseMsg);

                    break;
                }
            }
            else
            {
                // No action found
                responseMsg["status"]  = "error";
                responseMsg["message"] = "No action found";
                context.Response.Write(JsonConvert.SerializeObject(responseMsg));
            }
        }