// Generate Post from general website page content
    private string Generate_General_Post(string source)
    {
        StringBuilder str  = new StringBuilder();
        string        post = UtilityBLL.StripHTML(source);

        if (post != "")
        {
            string image = Return_Post_Image(source);
            if (image != "")
            {
                // post contain image.
                str.Append("<div style=\"float:left; width:" + this.LeftWidth + "%;\">\n");
                str.Append(Process_Image(image, ""));
                str.Append("</div>\n");
                str.Append("<div style=\"float:right; width:" + this.RightWidth + "%;\">\n");
                str.Append(Generate_General_Post_Content(post, source));
                str.Append("</div>\n");
                str.Append("<div class=\"clear\"></div>\n");
            }
            else
            {
                // post without image
                str.Append(Generate_General_Post_Content(post, source));
            }
        }

        return(str.ToString());
    }
Example #2
0
        public static async Task <JGN_Attr_Attributes> Add(ApplicationDbContext context, JGN_Attr_Attributes entity)
        {
            var ent = new JGN_Attr_Attributes()
            {
                title         = UtilityBLL.processNull(entity.title, 0),
                value         = UtilityBLL.processNull(entity.value, 0),
                options       = UtilityBLL.processNull(entity.options, 0),
                sectionid     = entity.sectionid,
                priority      = entity.priority,
                attr_type     = entity.attr_type,
                element_type  = entity.element_type,
                isrequired    = entity.isrequired,
                variable_type = entity.variable_type,
                min           = entity.min,
                max           = entity.max,
                postfix       = UtilityBLL.processNull(entity.postfix, 0),
                prefix        = UtilityBLL.processNull(entity.prefix, 0),
                tooltip       = UtilityBLL.processNull(entity.tooltip, 0),
                url           = UtilityBLL.processNull(entity.url, 0),
                helpblock     = UtilityBLL.processNull(entity.helpblock, 0),
                icon          = entity.icon
            };

            context.Entry(ent).State = EntityState.Added;

            await context.SaveChangesAsync();

            entity.id = ent.id;
            return(entity);
        }
Example #3
0
 public static async Task <bool> Update(ApplicationDbContext context, JGN_Attr_Attributes entity)
 {
     if (entity.id > 0)
     {
         var item = context.JGN_Attr_Attributes
                    .Where(p => p.id == entity.id)
                    .FirstOrDefault();
         if (item != null)
         {
             item.title                = UtilityBLL.processNull(entity.title, 0);
             item.value                = string.Join(",", entity.value);
             item.options              = UtilityBLL.processNull(entity.options, 0);
             item.priority             = (short)entity.priority;
             item.element_type         = entity.element_type;
             item.isrequired           = entity.isrequired;
             item.variable_type        = entity.variable_type;
             item.icon                 = entity.icon;
             item.min                  = entity.min;
             item.max                  = entity.max;
             item.postfix              = UtilityBLL.processNull(entity.postfix, 0);
             item.prefix               = UtilityBLL.processNull(entity.prefix, 0);
             item.tooltip              = UtilityBLL.processNull(entity.tooltip, 0);
             item.url                  = UtilityBLL.processNull(entity.url, 0);
             item.helpblock            = UtilityBLL.processNull(entity.helpblock, 0);
             context.Entry(item).State = EntityState.Modified;
             await context.SaveChangesAsync();
         }
     }
     return(true);
 }
        public static string PrepareUrl(JGN_Videos entity)
        {
            string _title = "";

            if (entity.title == null)
            {
                entity.title = "";
            }
            int maxium_length = Jugnoon.Settings.Configs.GeneralSettings.maximum_dynamic_link_length;

            if (entity.title.Length > maxium_length && maxium_length > 0)
            {
                _title = entity.title.Substring(0, maxium_length);
            }
            else if (entity.title.Length < 3)
            {
                _title = "preview-video";
            }
            else
            {
                _title = entity.title;
            }

            _title = UtilityBLL.ReplaceSpaceWithHyphin_v2(_title.Trim().ToLower());

            return(Config.GetUrl("media/" + entity.id + "/" + _title));
        }
 private void Load_Countries()
 {
     drp_country.DataSource     = UtilityBLL.GetCountries(true);
     drp_country.DataTextField  = "Value";
     drp_country.DataValueField = "Key";
     drp_country.DataBind();
 }
Example #6
0
        public static async Task <ApplicationUser> Update_User_Profile(ApplicationDbContext context, ApplicationUser entity, bool isAdmin = true)
        {
            ApplicationUser user;

            if (entity.Id != null && entity.Id != "")
            {
                user = await context.AspNetusers
                       .Where(p => p.Id == entity.Id)
                       .FirstOrDefaultAsync();
            }
            else
            {
                user = await context.AspNetusers
                       .Where(p => p.UserName == entity.UserName)
                       .FirstOrDefaultAsync();
            }

            if (user != null)
            {
                user.firstname = UtilityBLL.processNull(entity.firstname, 0);
                user.lastname  = UtilityBLL.processNull(entity.lastname, 0);

                context.Entry(user).State = EntityState.Modified;
                context.SaveChanges();

                if (isAdmin)
                {
                    // update settings
                    entity.settings.userid = entity.Id;
                    await UserSettingsBLL.Update(context, entity.settings);
                }
            }

            return(entity);
        }
Example #7
0
        // send mail to admin or author of user
        private void Send_Email(string poster_username, string rusername, string emailaddress, string subject, string content, string url, List <JGN_MailTemplates> lst)
        {
            if (rusername != "guest")
            {
                if (rusername == "admin")
                {
                    // mail send to admin
                    emailaddress = Jugnoon.Settings.Configs.GeneralSettings.admin_mail;
                }

                string msubject = MailProcess.Process2(lst[0].subject, "\\[poster_username\\]", poster_username);
                msubject = MailProcess.Process2(msubject, "\\[username\\]", rusername);
                msubject = MailProcess.Process2(msubject, "\\[subject\\]", subject);
                var str = new StringBuilder();
                str.AppendLine("<a href=\"" + url + "\">" + subject + "</a><br /><br />");
                str.AppendLine(WebUtility.HtmlDecode(UtilityBLL.Process_Content_Text(content)));
                string contents = MailProcess.Process2(lst[0].contents, "\\[poster_username\\]", poster_username);
                contents = MailProcess.Process2(contents, "\\[username\\]", rusername);
                contents = MailProcess.Process2(contents, "\\[content\\]", str.ToString());

                // attach signature
                contents = MailProcess.Prepare_Email_Signature(contents);

                MailProcess.Send_Mail(emailaddress, msubject, contents);
            }
        }
Example #8
0
        public static async Task Update(ApplicationDbContext context, JGN_Blogs entity)
        {
            Validation(entity);
            ScreenContent(context, entity);
            var item = context.JGN_Blogs
                       .Where(p => p.id == entity.id)
                       .FirstOrDefault();

            if (item != null)
            {
                item.title           = UtilityBLL.processNull(entity.title, 0);
                item.description     = UtilityBLL.processNull(entity.description, 0);
                item.tags            = UtilityBLL.processNull(entity.tags, 0);
                item.picture_url     = UtilityBLL.processNull(entity.picture_url, 0);
                item.picture_caption = UtilityBLL.processNull(entity.picture_caption, 0);

                context.Entry(item).State = EntityState.Modified;
                await context.SaveChangesAsync();

                // Content Associated Categories Processing
                CategoryContentsBLL.ProcessAssociatedContentCategories(context, entity.categories,
                                                                       item.id, (byte)CategoryContentsBLL.Types.Blogs, true);
                // update user stats
                await update_stats(context, entity.userid);
            }
        }
        public ActionResult proc()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <JGN_Tags>(json);

            if (data.title.Length < 3)
            {
                return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_invalid_title"].Value }));
            }

            if (UtilityBLL.isLongWordExist(data.title) || UtilityBLL.isLongWordExist(data.title))
            {
                return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_invalid_title"].Value }));
            }

            dynamic CategoryContentType = 1;

            if (data.id > 0)
            {
                // Update Operation
                TagsBLL.Update(_context, data);
            }
            else
            {
                // Add Operation
                TagsBLL.Add(_context, data.title, (TagsBLL.Types)data.type, data.records, data.term);
            }

            return(Ok(new { status = "success", id = data.id, message = SiteConfig.generalLocalizer["_records_processed"].Value }));
        }
Example #10
0
        //********************************************************************************
        // SEND MAIL TO AUTHOR OF TOPIC, ADMIN (MODERATOR) OR ALL USERS WHO POST Comments)
        //*********************************************************************************

        // Mail Logic
        // If user post new topic mail will be sent to user and admin (moderator)
        // If admin approve topic mail will be sent to author (in case of manual review)
        // If normal user post reply, mail will be sent to author and all users who contribute replies and admin
        private void ProcessMail(long tid, long replyid, string username, long groupid, string description, string title)
        {
            try
            {
                string subject = title;
                string content = UtilityBLL.StripHTML(description);
                string url     = Forum_Urls.Prepare_Topic_Url(tid, subject, false);
                if (replyid == 0)
                {
                    // New Topic Posted Mail Will Be Sent To Admin AND Author
                    // send mail to admin
                    var alst = MailTemplateBLL.Get_Template(_context, "FORUMTOPIC").Result;
                    Send_Email(username, "admin", "", subject, content, url, alst);
                    // send mail to author
                    var    tlst                 = MailTemplateBLL.Get_Template(_context, "FORUMTA").Result;
                    string authoremail          = UserBLL.Return_Value_UserId(_context, username, "email");
                    var    authormailpermission = Convert.ToByte(UserSettingsBLL.Get_Field_Value(_context, username, "isemail"));

                    if (authormailpermission == 1)
                    {
                        Send_Email("", username, authoremail, subject, content, url, tlst);
                    }
                }
                else
                {
                    // User Post Reply, Mail will be sent to autho, admin and all users who contribute replies
                    MailTemplateProcess(replyid, subject, content, url, username, groupid);
                }
            }
            catch (Exception ex)
            {
                ErrorLgBLL.Add(_context, "Mail Processing Error", "", ex.Message);
            }
        }
Example #11
0
    protected void btn_post_Click(object sender, EventArgs e)
    {
        StringBuilder str = new StringBuilder();


        // if(txt_term.Text !="" || txt_user.Text !="" || _categories != "" || )
        str.Append("?o=" + drp_order.SelectedValue);
        if (txt_term.Text != "")
        {
            str.Append("&query=" + Server.UrlEncode(UtilityBLL.CleanSearchTerm(txt_term.Text)));
        }
        if (drp_country.SelectedValue != "")
        {
            str.Append("&cnt=" + drp_country.SelectedValue);
        }
        if (drp_gender.SelectedValue != "")
        {
            str.Append("&gender=" + drp_gender.SelectedValue);
        }

        if (chk_onlyphoto.Checked)
        {
            str.Append("&ponly=true");
        }

        Response.Redirect(Config.GetUrl(SearchUrl + "" + str.ToString()), true);
    }
Example #12
0
    //**************************************************************************************
    // Core Engine for generating cached and non cached photo listings
    //**************************************************************************************

    public static List <UserActivity_Struct> Load_Activities(string term, string UserName, int Month, int Year, string order, int records, int datefilter, bool iscache, int PageNumber)
    {
        if (!iscache || Config.GetCacheDuration() == 0)
        {
            return(Fetch_Activities(term, UserName, Month, Year, order, records, datefilter, PageNumber));
        }
        else
        {
            // cache implementation
            StringBuilder cache = new StringBuilder();
            string        lang  = "";

            cache.Append("ft_uactivity_lm_" + lang + UserName + "" + Month + "" + Year + "" + records + "" + PageNumber + "" + datefilter + "" + UtilityBLL.ReplaceSpaceWithHyphin(order.ToLower()));
            if (term != "")
            {
                cache.Append(UtilityBLL.ReplaceSpaceWithHyphin(term.ToLower()));
            }


            if (HttpContext.Current.Cache[cache.ToString()] == null)
            {
                HttpContext.Current.Cache.Add(cache.ToString(), Fetch_Activities(term, UserName, Month, Year, order, records, datefilter, PageNumber), null, DateTime.Now.AddMinutes(Config.GetCacheDuration()), TimeSpan.Zero, CacheItemPriority.High, null);
            }

            List <UserActivity_Struct> _list = (List <UserActivity_Struct>)(HttpContext.Current.Cache[cache.ToString()]);
            return(_list);
        }
    }
Example #13
0
        // GET: wiki
        public async Task <IActionResult> Index(string title)
        {
            if (title == null)
            {
                return(Redirect(Config.GetUrl("glossary")));
            }

            title = UtilityBLL.UppercaseFirst(UtilityBLL.ReplaceHyphinWithSpace(title));

            var model = new WikiModelView();

            model.isAllowed = true;

            var _lst = await WikiBLLC.Fetch_Record(_context, title);

            if (_lst.Count > 0)
            {
                model.Data = new JGN_Wiki()
                {
                    term_complete = _lst[0].term_complete,
                    description   = BBCode.MakeHtml(WebUtility.HtmlDecode(_lst[0].description), true)
                };
            }
            else
            {
                model.isAllowed     = false;
                model.DetailMessage = SiteConfig.generalLocalizer["_no_records"].Value;
            }

            ViewBag.title = title;

            return(View(model));
        }
Example #14
0
        public static async Task <string> generateRSS(ApplicationDbContext context, VideoEntity Entity)
        {
            var str = new StringBuilder();

            str.AppendLine("<rss version=\"2.0\">");
            str.AppendLine("<channel>");
            str.AppendLine("<title>" + Jugnoon.Settings.Configs.GeneralSettings.website_title + "</title>");
            str.AppendLine("<description>" + Jugnoon.Settings.Configs.GeneralSettings.website_description + "</description>");
            str.AppendLine("<link>" + Config.GetUrl() + "</link>");
            str.AppendLine("<guid>" + Config.GetUrl() + "videos/" + "</guid>");
            var _lst = await VideoBLL.LoadItems(context, Entity);

            foreach (var Item in _lst)
            {
                string title_url = VideoUrlConfig.PrepareUrl(Item);
                string body      = WebUtility.HtmlEncode(UtilityBLL.StripHTML_v2(Item.description));
                str.AppendLine("<item>");
                str.AppendLine("<title>" + UtilityBLL.CleanBlogHTML(UtilityBLL.StripHTML(Item.title)) + "</title>");
                str.AppendLine("<link>" + title_url + "</link>");
                str.AppendLine("<guid>" + title_url + "</guid>");
                str.AppendLine("<pubDate>" + String.Format("{0:R}", Item.created_at) + "</pubDate>");
                str.AppendLine("<description>" + body + "</description>");
                str.AppendLine("</item>");
            }
            str.AppendLine("</channel>");
            str.AppendLine("</rss>");

            return(str.ToString());
        }
Example #15
0
    private string Generate_Previous_Last_Links(int TotalPages, string _rooturl)
    {
        StringBuilder str = new StringBuilder();
        string LastNavigationUrl = "";
        string NextNavigationUrl = "";
        int _nextpage = PageNumber + 1;
     
        if (this.isFilter)
        {
            LastNavigationUrl = _rooturl + "" + UtilityBLL.Add_PageNumber(this.Filter_Pagination_Url, TotalPages.ToString());
            NextNavigationUrl = _rooturl + "" + UtilityBLL.Add_PageNumber(this.Filter_Pagination_Url, _nextpage.ToString());
        }
        else
        {
            LastNavigationUrl = _rooturl + "" + UtilityBLL.Add_PageNumber(this.Pagination_Url, TotalPages.ToString());
            NextNavigationUrl = _rooturl + "" + UtilityBLL.Add_PageNumber(this.Pagination_Url, _nextpage.ToString());
        }

        int firstbound = ((TotalPages - 1) * this.PageSize) + 1;
        int lastbound = firstbound + this.PageSize - 1;
        if (lastbound > this.TotalRecords)
        {
            lastbound = this.TotalRecords;
        }
        string ToolTip = showing + " " + firstbound + " - " + lastbound + " " + records + " of " + this.TotalRecords + " " + records;
        // Next Link
        str.Append("<li><a href=\"" + NextNavigationUrl + "\" title=\"" + ToolTip + "\"><i class=\"icon-arrow-right\"></i></a></li>\n");
        // Last Link
        ToolTip = showing + " " + firstbound + " - " + lastbound + " " + records + " of " + this.TotalRecords + " " + records;
        str.Append("<li><a href=\"" + LastNavigationUrl + "\"  title=\"" + ToolTip + "\"><i class=\"icon-forward\"></i></a></li>\n");

        return str.ToString();

    }
Example #16
0
        public static async Task <JGN_Blogs> Add(ApplicationDbContext context, JGN_Blogs entity)
        {
            Validation(entity);
            ScreenContent(context, entity);

            var ent = new JGN_Blogs()
            {
                userid          = entity.userid,
                title           = entity.title,
                description     = entity.description,
                tags            = entity.tags,
                isenabled       = (byte)entity.isenabled,
                isapproved      = (byte)entity.isapproved,
                created_at      = DateTime.Now,
                fetch_url       = UtilityBLL.processNull(entity.fetch_url, 0),
                picture_url     = UtilityBLL.processNull(entity.picture_url, 0),
                cover_url       = UtilityBLL.processNull(entity.cover_url, 0),
                picture_caption = UtilityBLL.processNull(entity.picture_caption, 0),
            };

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

            entity.id = ent.id;

            // Content Associated Categories Processing
            CategoryContentsBLL.ProcessAssociatedContentCategories(context, entity.categories,
                                                                   entity.id, (byte)CategoryContentsBLL.Types.Blogs, false);

            // update user stats
            await update_stats(context, entity.userid);

            return(entity);
        }
Example #17
0
        public static async Task <JGN_Badges> Update(ApplicationDbContext context, JGN_Badges entity)
        {
            entity.icon = await processImage(context, entity.title, entity.icon);

            var item = context.JGN_Badges
                       .Where(p => p.id == entity.id)
                       .FirstOrDefault <JGN_Badges>();

            item.title        = UtilityBLL.processNull(entity.title, 0);
            item.description  = string.Join(",", entity.description);
            item.icon         = UtilityBLL.processNull(entity.icon, 0);
            item.icon_sm      = UtilityBLL.processNull(entity.icon_sm, 0);
            item.icon_lg      = UtilityBLL.processNull(entity.icon_lg, 0);
            item.category_id  = entity.category_id;
            item.type         = entity.type;
            item.icon_css     = entity.icon_css;
            item.priority     = entity.priority;
            item.credits      = entity.credits;
            item.xp           = entity.xp;
            item.price        = entity.priority;
            item.notification = entity.notification;
            item.isdeduct     = entity.isdeduct;
            item.ilevel       = entity.ilevel;
            item.ishide       = entity.ishide;
            item.ismultiple   = entity.ismultiple;

            context.Entry(item).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(entity);
        }
Example #18
0
    public void BindPagination()
    {
        StringBuilder str = new StringBuilder();
        int TotalPages = (int)Math.Ceiling((double)this.TotalRecords / this.PageSize);
        int firstbound = 0;
        int lastbound = 0;
        string _rooturl = Config.GetUrl();
        string ToolTip = "";
        if (this.PageNumber > 1)
        {
            firstbound = 1;
            lastbound = firstbound + this.PageSize - 1;
            ToolTip = showing + " " + firstbound + " - " + lastbound + " " + records + " of " + this.TotalRecords + " " + records;
            // First Link
            string FirstLinkUrl = _rooturl + "" + this.Default_Url;
            str.Append("<li><a href=\"" + FirstLinkUrl + "\" title=\"" + ToolTip + "\"><i class=\"icon-backward\"></i></a></li>\n");
            firstbound = ((TotalPages - 1) * this.PageSize);
            lastbound = firstbound + this.PageSize - 1;
            if (lastbound > this.TotalRecords)
            {
                lastbound = this.TotalRecords;
            }
            ToolTip = showing + " " + firstbound + " - " + lastbound + " " + records + " of " + this.TotalRecords + " " + records;
            // Previous Link Enabled
            string PreviousNavigationUrl = "";
            int _prevpage = PageNumber - 1;
            if (this.isFilter)
            {
                if (this.PageNumber > 2)
                    PreviousNavigationUrl = _rooturl + "" + UtilityBLL.Add_PageNumber(this.Filter_Pagination_Url, _prevpage.ToString());
                else
                    PreviousNavigationUrl = _rooturl + "" + this.Filter_Default_Url;
            }
            else
            {
                if (this.PageNumber > 2)
                    PreviousNavigationUrl = _rooturl + "" + UtilityBLL.Add_PageNumber(this.Pagination_Url, _prevpage.ToString());
                else
                    PreviousNavigationUrl = _rooturl + "" + this.Default_Url;
            }
            str.Append("<li><a href=\"" + PreviousNavigationUrl + "\" title=\"" + ToolTip + "\"><i class=\"icon-arrow-left\"></i></a></li>\n");

            // Normal Links
            str.Append(Generate_Pagination_Links(TotalPages,_rooturl));

            if (this.PageNumber < TotalPages)
            {
                str.Append(Generate_Previous_Last_Links(TotalPages, _rooturl));
            }
        }
        else
        {
            // Normal Links
            str.Append(Generate_Pagination_Links(TotalPages, _rooturl));
            // Next Last Links
            str.Append(Generate_Previous_Last_Links(TotalPages, _rooturl));
        }
        plnks.InnerHtml = "<ul>\n" + str.ToString() + "</ul>\n";
    }
Example #19
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));
     }
 }
Example #20
0
        // GET: blogs/search
        public async Task <IActionResult> search(string term)
        {
            if (term == null)
            {
                return(Redirect("/blogs"));
            }

            var _sanitize = new HtmlSanitizer();

            term = _sanitize.Sanitize(UtilityBLL.ReplaceHyphinWithSpace(term));

            /* ***************************************/
            // Process Page Meta & BreaCrumb
            /* ***************************************/
            var _meta = PageMeta.returnPageMeta(new PageQuery()
            {
                controller = ControllerContext.ActionDescriptor.ControllerName,
                index      = ControllerContext.ActionDescriptor.ActionName,
                pagenumber = 1,
                matchterm  = term
            });

            if (Jugnoon.Settings.Configs.GeneralSettings.store_searches)
            {
                //*********************************************
                // User Search Tracking Script
                //********************************************
                if (!TagsBLL.Validate_Tags(term.Trim()) && !term.Trim().Contains("@"))
                {
                    // check if tag doesn't exist
                    var count_tags = await TagsBLL.Count(_context, new TagEntity()
                    {
                        type      = TagsBLL.Types.General,
                        tag_type  = TagsBLL.TagType.UserSearches,
                        isenabled = EnabledTypes.Enabled
                    });

                    if (count_tags == 0)
                    {
                        TagsBLL.Add(_context, term.Trim(), TagsBLL.Types.General, 0, TagsBLL.TagType.UserSearches, EnabledTypes.Enabled, term.Trim());
                    }
                }
            }

            /* List Initialization */
            var ListEntity = new BlogListViewModel()
            {
                QueryOptions = new BlogEntity()
                {
                    term = term,
                },
                BreadItems = _meta.BreadItems
            };


            return(View(ListEntity));
        }
        // GET: videos/labels
        public IActionResult labels(string term, int?pagenumber)
        {
            if (pagenumber == null)
            {
                pagenumber = 1;
            }

            /* ***************************************/
            // Process Page Meta & BreaCrumb
            /* ***************************************/
            var order = "normal";

            if (term != null && term.Length > 0)
            {
                order = "search";
            }
            var _meta = PageMeta.returnPageMeta(new PageQuery()
            {
                controller = ControllerContext.ActionDescriptor.ControllerName,
                index      = ControllerContext.ActionDescriptor.ActionName,
                order      = order,
                pagenumber = (int)pagenumber
            });

            /* List Initialization */
            var ListEntity = new TagListModelView()
            {
                pagenumber        = (int)pagenumber,
                TotalRecords      = 100,                       // display 100 tags per page
                Type              = (int)TagsBLL.Types.Videos, // represent videos
                Path              = "videos/",
                DefaultUrl        = Config.GetUrl("videos/labels"),
                PaginationUrl     = Config.GetUrl("videos/labels/[p]/"),
                NoRecordFoundText = SiteConfig.generalLocalizer["_no_records"].Value,
                Action            = "/videos/labels", // for search tags
                HeadingTitle      = _meta.title,
                BreadItems        = _meta.BreadItems
            };

            if (term != null && term.Length > 0)
            {
                ListEntity.Term          = UtilityBLL.CleanSearchTerm(WebUtility.UrlDecode(term).Trim());
                ListEntity.DefaultUrl    = Config.GetUrl("videos/labels/search/" + term);
                ListEntity.PaginationUrl = Config.GetUrl("videos/labels/search/" + term + "/[p]");
            }

            /**********************************************/
            // Page Meta Setup
            /**********************************************/
            ViewBag.title       = _meta.title;
            ViewBag.description = _meta.description;

            return(View(ListEntity));
        }
Example #22
0
        public ActionResult general()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();

            if (json == "")
            {
                return(Ok(new { status = "Error", message = SiteConfig.generalLocalizer["_invalid_data"].Value }));
            }
            var data = JsonConvert.DeserializeObject <General>(json);

            _general_options.Update(opt => {
                opt.site_theme          = data.site_theme;
                opt.website_title       = data.website_title;
                opt.website_description = UtilityBLL.processNull(data.website_description, 0);
                opt.page_caption        = UtilityBLL.processNull(data.page_caption, 0);
                opt.website_phone       = UtilityBLL.processNull(data.website_phone, 0);
                opt.admin_mail          = UtilityBLL.processNull(data.admin_mail, 0);
                opt.admin_mail_name     = UtilityBLL.processNull(data.admin_mail_name, 0);
                opt.pagination_links    = data.pagination_links;
                opt.pagination_type     = data.pagination_type;
                opt.screen_content      = data.screen_content;
                opt.content_approval    = data.content_approval;
                if (data.spam_count > 0)
                {
                    opt.spam_count = data.spam_count;
                }

                opt.cache_duration = data.cache_duration;

                if (data.max_cache_pages > 0)
                {
                    opt.max_cache_pages = data.max_cache_pages;
                }

                opt.store_searches              = data.store_searches;
                opt.store_ipaddress             = data.store_ipaddress;
                opt.maximum_dynamic_link_length = data.maximum_dynamic_link_length;
                opt.default_culture             = UtilityBLL.processNull(data.default_culture, 0);
                if (opt.pagesize > 0)
                {
                    opt.pagesize = data.pagesize;
                }
                opt.rating_option   = data.rating_option;
                opt.jwt_private_key = data.jwt_private_key;
                opt.init_wiz        = true; // used to stop installation process after application deployment, don't remove it
            });

            //ApplicationLifetime.StopApplication();

            return(Ok(new
            {
                status = 200
            }));
        }
    protected void btn_save_Click(object sender, EventArgs e)
    {
        string strPath = Server.MapPath(Request.ApplicationPath) + "//contents//member//" + this.UserName + "//photos//";

        // delete old user profile photo if exist
        if (this.PhotoName != "none" || !this.PhotoName.Contains("http"))
        {
            try
            {
                if (File.Exists(strPath + "" + this.PhotoName))
                {
                    File.Delete(strPath + "" + this.PhotoName);
                }

                if (File.Exists(strPath + "thumbs/" + this.PhotoName))
                {
                    File.Delete(strPath + "thumbs/" + this.PhotoName);
                }
            }
            catch (Exception ex)
            {
                //Response.Redirect( Config.GetUrl("user/Profile.aspx?status=derror"));
            }
        }

        // update new photo
        string filename = Guid.NewGuid().ToString().Substring(0, 10) + "" + ph1.PostedFile.FileName.Remove(0, ph1.PostedFile.FileName.LastIndexOf("."));

        if (!UtilityBLL.isImage(ph1.PostedFile.ContentType))
        {
            Response.Redirect(Config.GetUrl("myaccount/Profile.aspx?status=invalidformat"));
            return;
        }

        ph1.PostedFile.SaveAs(strPath + "" + filename);
        ph1.PostedFile.SaveAs(strPath + "thumbs/" + filename);
        string orignalfilename = strPath + "" + filename;
        string thumbfilename   = strPath + "thumbs/" + filename;
        Bitmap mp = Image_Process.CreateThumbnail(orignalfilename, 92);

        if (mp == null)
        {
            Response.Redirect(Config.GetUrl("myaccount/Profile.aspx?status=perror"));
            return;
        }

        mp.Save(thumbfilename);
        Image_Process.SaveJpeg(thumbfilename, mp, 90);
        mp.Dispose();

        members.Update_Value(this.UserName, "PictureName", filename);
        Response.Redirect(Config.GetUrl("myaccount/Profile.aspx?status=pupdated"));
    }
Example #24
0
        private static string GenerateKey(string key, ForumTopicEntity entity)
        {
            var cache = new StringBuilder();

            cache.Append(key + "_" + entity.forumid + "" + entity.userid + "" +
                         entity.month + "" + entity.year + "" + entity.datefilter + "" +
                         entity.replyid + "" + entity.isadult + "" +
                         entity.isresolved + "" + entity.type + "" +
                         entity.islocked + "" + UtilityBLL.ReplaceSpaceWithHyphin(entity.order.ToLower()) + "" + entity.pagenumber);

            return(cache.ToString());
        }
        public static string SanitizeText(string text, bool isCompress = true)
        {
            var    _sanitize = new HtmlSanitizer();
            string _text     = _sanitize.Sanitize(text);

            if (isCompress)
            {
                _text = UtilityBLL.CompressCodeBreak(_text);
            }

            return(_text);
        }
Example #26
0
        public static string GenerateKey(string key, AttrValueEntity entity)
        {
            var str = new StringBuilder();

            str.AppendLine(key + "_" + "" + entity.term + "" + entity.contentid + "" + entity.attr_type + "" + entity.pagenumber + "" + entity.pagesize);
            if (entity.term != "")
            {
                str.AppendLine(UtilityBLL.ReplaceSpaceWithHyphin(entity.term.ToLower()));
            }

            return(str.ToString());
        }
Example #27
0
 public static string RestrictMatchEval(Match match)
 {
     if (match.Groups[1].Success)
     {
         return(UtilityBLL.Restrict_Word(match.ToString()));
     }
     else
     {
         // no match
         return("");
     }
 }
Example #28
0
        public async Task <ActionResult> updateavator()
        {
            var json  = new StreamReader(Request.Body).ReadToEnd();
            var model = JsonConvert.DeserializeObject <ApplicationUser>(json);

            if (model.Id == "")
            {
                return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_no_records"].Value }));
            }

            byte[] image         = Convert.FromBase64String(model.picturename.Replace("data:image/png;base64,", ""));
            string thumbFileName = model.Id.ToString() + ".png";

            // if cloud enabled
            try
            {
                var path = SiteConfig.Environment.ContentRootPath + UtilityBLL.ParseUsername(SystemDirectoryPaths.UserDirectory, model.Id.ToString());
                if (!Directory.Exists(path))
                {
                    Directory_Process.CreateRequiredDirectories(path);
                }

                var filepath = path + "/" + thumbFileName;
                if (System.IO.File.Exists(filepath))
                {
                    System.IO.File.Delete(filepath);
                }

                // local storage
                System.IO.File.WriteAllBytes(filepath, image);

                model.picturename = await Jugnoon.Helper.Aws.UploadPhoto(_context, thumbFileName, path, Configs.AwsSettings.user_photos_directory);

                // cleanup from local if cloud enabled and saved
                if (model.picturename.Contains("http"))
                {
                    if (System.IO.File.Exists(path))
                    {
                        System.IO.File.Delete(path);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLgBLL.Add(_context, "Error: User Picture Failed to Upload", "", ex.Message);
                model.picturename = "";
            }

            UserBLL.Update_Field_Id(_context, model.Id, "picturename", model.picturename);
            model.img_url = UserUrlConfig.ProfilePhoto(model.Id, model.picturename, 0);

            return(Ok(new { status = "success", record = model, message = SiteConfig.generalLocalizer["_record_updated"].Value }));
        }
Example #29
0
    public static string Process_Content_Text(string html)
    {
        // compress code :-> replace \n - <br />
        html = CompressCodeBreak(html);
        // process bbcode
        html = BBCode.MakeHtml(html, true);
        // prepare urls
        html = UtilityBLL.GenerateLink(html, true);
        // html decode at the end
        //html = HttpContext.Current.Server.HtmlDecode(html);

        return(html);
    }
Example #30
0
        public static string GenerateKey(string key, BlogEntity entity)
        {
            var str = new StringBuilder();

            str.AppendLine(key + "_" + entity.isadult + "" + entity.isfeatured + "" +
                           entity.userid + "" + entity.categoryid + "" + entity.categoryname + "" + entity.datefilter + "" + entity.tags + ""
                           + UtilityBLL.ReplaceSpaceWithHyphin(entity.order.ToLower()) + "" + entity.pagenumber + "" + entity.mode + "" + entity.pagesize);
            if (entity.tags != "")
            {
                str.AppendLine(UtilityBLL.ReplaceSpaceWithHyphin(entity.tags.ToLower()));
            }

            return(str.ToString());
        }
    public string GenerateFormAndReturnError(int i, DataRow row, LogDS.ImportFormLogDetailRow logDetailRow)
    {
        SqlTransaction transaction = null;
        string errorInfor = string.Empty;
        try {
            FormTableAdapter TAForm = new FormTableAdapter();
            FormSaleSettlementTableAdapter TAFormSettlement = new FormSaleSettlementTableAdapter();
            FormSalePaymentTableAdapter TASalePayment = new FormSalePaymentTableAdapter();
            FormSalePaymentDetailTableAdapter TASalePaymentDetail = new FormSalePaymentDetailTableAdapter();
            FormSettlementExpenseDetailTableAdapter TAFormSettlementExpenseDetail = new FormSettlementExpenseDetailTableAdapter();

            transaction = TableAdapterHelper.BeginTransaction(TAForm);
            TableAdapterHelper.SetTransaction(TASalePayment, transaction);
            TableAdapterHelper.SetTransaction(TASalePaymentDetail, transaction);

            FormDS.FormDataTable tbForm = new FormDS.FormDataTable();
            FormDS.FormSalePaymentDataTable tbPayment = new FormDS.FormSalePaymentDataTable();
            FormDS.FormSalePaymentDetailDataTable tbPaymentDetail = new FormDS.FormSalePaymentDetailDataTable();
            FormDS.FormRow rowForm = null;
            FormDS.FormSalePaymentRow rowPayment = null;
            FormDS.FormSalePaymentDetailRow rowPaymentDetail = null;

            string settlementFormNo = string.Empty;
            DateTime SubmitDate = DateTime.Now;
            decimal PaymentAmount = 0;
            bool IsValid = true;
            if (CheckData(row) != null) {
                errorInfor = "第" + (i + 1) + "行有错:" + CheckData(row);
                IsValid = false;
            } else {
                settlementFormNo = row[0].ToString().Trim();
                SubmitDate = DateTime.Parse(row[1].ToString());
                PaymentAmount = decimal.Parse(row[2].ToString().Trim());

                logDetailRow.SettlementFormNo = settlementFormNo;
                logDetailRow.PaymentAmount = PaymentAmount;

                FormDS.FormDataTable tbSettlement = TAForm.GetDataByFormNo(settlementFormNo);
                if (tbSettlement.Rows.Count <= 0) {
                    errorInfor = "第" + (i + 1) + "行有错:系统中找不到结案单《" + settlementFormNo + "》";
                    IsValid = false;
                }
                FormDS.FormRow settlementForm = tbSettlement[0];
                FormDS.FormSaleSettlementRow rowSettlement = TAFormSettlement.GetDataByID(settlementForm.FormID)[0];

                if (rowSettlement.PaymentTypeID != 2 && rowSettlement.PaymentTypeID != 5) {
                    errorInfor = "第" + (i + 1) + "行有错:该单据支付方式,不是票扣或者调整因子《" + settlementFormNo + "》";
                    IsValid = false;
                }

                if (rowSettlement.IsClose) {
                    errorInfor = "第" + (i + 1) + "行有错:该单据已标记为支付完成《" + settlementFormNo + "》";
                    IsValid = false;
                }

                if (rowSettlement.PaymentTypeID == 2 && PaymentAmount > rowSettlement.AmountRMB) {
                    errorInfor = "第" + (i + 1) + "行有错:支付金额超过结案金额《" + settlementFormNo + "》";
                    IsValid = false;
                }
                if (IsValid) {
                    //生成单据
                    rowForm = tbForm.NewFormRow();
                    rowPayment = tbPayment.NewFormSalePaymentRow();

                    //生成Form
                    rowForm.SetRejectedFormIDNull();
                    //申请人取结案单申请人
                    rowForm.UserID = settlementForm.UserID;
                    UtilityBLL utility = new UtilityBLL();
                    rowForm.FormNo = utility.GetFormNo(utility.GetFormTypeString((int)SystemEnums.FormType.SalePayment));
                    rowForm.SetProxyUserIDNull();
                    rowForm.SetProxyPositionIDNull();
                    //申请人部门取结案单申请人所在部门
                    rowForm.OrganizationUnitID = settlementForm.OrganizationUnitID;
                    rowForm.PositionID = settlementForm.PositionID;
                    rowForm.FormTypeID = (int)SystemEnums.FormType.SalePayment;
                    rowForm.StatusID = (int)SystemEnums.FormStatus.ApproveCompleted;
                    rowForm.SubmitDate = SubmitDate;
                    rowForm.LastModified = SubmitDate;
                    rowForm.InTurnUserIds = "P";//待改动
                    rowForm.InTurnPositionIds = "P";//待改动
                    rowForm.PageType = (int)SystemEnums.PageType.PaymentCash;
                    rowForm.CostCenterID = settlementForm.CostCenterID;
                    rowForm.ApprovedDate = SubmitDate;
                    //是否创建凭证?
                    rowForm.IsCreateVoucher = false;
                    rowForm.IsExportLock = false;
                    rowForm.IsCompletePayment = false;
                    rowForm.IsInvoiceReturned = false;
                    tbForm.AddFormRow(rowForm);
                    TAForm.Update(rowForm);

                    //生成FormPayment
                    rowPayment.FormSalePaymentID = rowForm.FormID;
                    rowPayment.FormSaleSettlementID = settlementForm.FormID;
                    //生成时,不考虑预付款
                    rowPayment.SetFormSaleApplyIDNull();
                    rowPayment.InvoiceStatusID = (int)SystemEnums.InvoiceStatus.No;
                    rowPayment.PaymentTypeID = rowSettlement.PaymentTypeID;
                    //报销申请单备注
                    rowPayment.Remark = "此单据为自动生成单据。";
                    rowPayment.SetAttachedFileNameNull();
                    rowPayment.SetRealAttachedFileNameNull();
                    //报销金额
                    rowPayment.AmountRMB = PaymentAmount;
                    rowPayment.VatTypeID = 1;
                    rowPayment.AmountBeforeTax = rowPayment.AmountRMB;
                    rowPayment.TaxAmount = 0;
                    rowPayment.IsAdvanced = false;
                    //VendorID设置什么值
                    rowPayment.SetVendorIDNull();
                    tbPayment.AddFormSalePaymentRow(rowPayment);
                    TASalePayment.Update(rowPayment);

                    //生成FormPaymentDetail
                    decimal UsedAmount = 0;
                    FormDS.FormSettlementExpenseDetailDataTable tbSettlementExpenseDetail = TAFormSettlementExpenseDetail.GetDataByFormSaleSettlementID(rowSettlement.FormSaleSettlementID);
                    FormDS.FormSettlementExpenseDetailRow rowSettlementExpenseDetail = null;
                    for (int j = 0; j < tbSettlementExpenseDetail.Rows.Count; j++) {
                        rowSettlementExpenseDetail = (FormDS.FormSettlementExpenseDetailRow)tbSettlementExpenseDetail.Rows[j];
                        rowPaymentDetail = tbPaymentDetail.NewFormSalePaymentDetailRow();

                        rowPaymentDetail.FormSalePaymentID = rowPayment.FormSalePaymentID;
                        rowPaymentDetail.FormSaleApplyID = rowSettlementExpenseDetail.FormSaleApplyID;
                        rowPaymentDetail.FormSaleExpenseDetailID = rowSettlementExpenseDetail.FormSaleExpenseDetailID;
                        rowPaymentDetail.ApplyFormNo = rowSettlementExpenseDetail.ApplyFormNo;
                        rowPaymentDetail.ApplyPeriod = rowSettlementExpenseDetail.ApplyPeriod;
                        rowPaymentDetail.ApplyProjectName = rowSettlementExpenseDetail.ApplyProjectName;
                        rowPaymentDetail.ExpenseItemID = rowSettlementExpenseDetail.ExpenseItemID;
                        if (!rowSettlementExpenseDetail.IsShopNameNull()) {
                            rowPaymentDetail.ShopName = rowSettlementExpenseDetail.ShopName;
                        }
                        rowPaymentDetail.SKUID = rowSettlementExpenseDetail.SKUID;
                        rowPaymentDetail.ApplyAmount = rowSettlementExpenseDetail.ApplyAmount;
                        rowPaymentDetail.ApplyAmountRMB = rowSettlementExpenseDetail.ApplyAmountRMB;
                        rowPaymentDetail.SettlementAmount = rowSettlementExpenseDetail.AmountRMB;
                        rowPaymentDetail.TaxAmount = 0;

                        //待改动
                        if (j == tbSettlementExpenseDetail.Rows.Count - 1) {
                            rowPaymentDetail.AmountRMB = PaymentAmount - UsedAmount;
                            rowPaymentDetail.AmountBeforeTax = rowPaymentDetail.AmountRMB;
                            rowPaymentDetail.TaxAmount = rowPaymentDetail.TaxAmount;
                            rowPaymentDetail.PayedAmount = 0;
                            rowPaymentDetail.RemainAmount = 0;
                            UsedAmount += rowPaymentDetail.AmountRMB;
                        } else {
                            rowPaymentDetail.AmountRMB = decimal.Round((rowSettlementExpenseDetail.AmountRMB / rowSettlement.AmountRMB) * PaymentAmount, 2);
                            rowPaymentDetail.AmountBeforeTax = rowPaymentDetail.AmountRMB;
                            rowPaymentDetail.TaxAmount = 0;
                            rowPaymentDetail.PayedAmount = 0;
                            rowPaymentDetail.RemainAmount = 0;
                            UsedAmount += rowPaymentDetail.AmountRMB;
                        }
                        tbPaymentDetail.AddFormSalePaymentDetailRow(rowPaymentDetail);
                        TASalePaymentDetail.Update(tbPaymentDetail);
                    }
                    logDetailRow.PaymentFormNo = rowForm.FormNo;
                }
            }
            transaction.Commit();
        } catch (Exception e) {
            transaction.Rollback();
            errorInfor = e.Message.ToString();
        } finally {
            transaction.Dispose();
        }
        return errorInfor;
    }