Example #1
0
        private string CompressedCSS(string InString)
        {
            var compressor = new Yahoo.Yui.Compressor.CssCompressor
            {
                RemoveComments = true
            };

            // Read full script file
            string _Decrypted = new IntellidateR1.EncryptDecrypt().Decrypt(InString.Split('-')[0]);

            string[] _CSSPath = _Decrypted.Split(',');

            string _CssContent = "";
            string _RootFolder = Server.MapPath("~").ToString();

            foreach (var EachCss in _CSSPath)
            {
                _CssContent = _CssContent + "\n" + File.ReadAllText(_RootFolder + "\\" + EachCss + ".css");
            }

            if (ConfigurationManager.AppSettings["StaticDebug"].ToString() == "Y")
            {
                return(_CssContent);
            }

            string _CompleteCss = _CssContent;

            return(compressor.Compress(_CompleteCss));
        }
Example #2
0
        private string CompressedJS(string InString)
        {
            try
            {
                var compressor = new Yahoo.Yui.Compressor.JavaScriptCompressor
                {
                    Encoding              = UTF8Encoding.UTF8,
                    DisableOptimizations  = false,
                    ObfuscateJavascript   = true,
                    PreserveAllSemicolons = true,
                    IgnoreEval            = false
                };

                // Read full script file
                string   _Decrypted   = new IntellidateR1.EncryptDecrypt().Decrypt(InString.Split('-')[0]);
                string[] _ScriptsPath = _Decrypted.Split(',');

                string _JsContent  = "";
                string _RootFolder = Server.MapPath("~").ToString();

                foreach (var EachScript in _ScriptsPath)
                {
                    if (EachScript.ToUpper().EndsWith("MIN"))
                    {
                        _JsContent = _JsContent + "\n" + File.ReadAllText(_RootFolder + "\\" + EachScript + ".js");
                    }
                    else
                    {
                        if (ConfigurationManager.AppSettings["StaticDebug"].ToString() == "Y")
                        {
                            _JsContent = _JsContent + "\n" + File.ReadAllText(_RootFolder + "\\" + EachScript + ".js");
                        }
                        else
                        {
                            try
                            {
                                _JsContent = _JsContent + "\n" + compressor.Compress(File.ReadAllText(_RootFolder + "\\" + EachScript + ".js"));
                            }
                            catch (Exception)
                            {
                                _JsContent = _JsContent + "\n" + File.ReadAllText(_RootFolder + "\\" + EachScript + ".js");
                            }
                        }
                    }
                }

                return(_JsContent);
            }
            catch (Exception)
            {
                return("");
            }
        }
        public List <ViewedProfileClass> GetProfileViewes(ProfileView [] _ObjProfiles)
        {
            try
            {
                List <ViewedProfileClass> _lstUserProfiles = new List <ViewedProfileClass>();
                int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                ViewedProfileClass _ObjViewedProfile;
                ProfileView[]      _ProfileViews = _ObjProfiles.GroupBy(x => x.UserRefID).Select(y => y.First()).ToArray();
                string             SitePath      = ConfigurationManager.AppSettings["SitePath"].ToString();
                foreach (var item in _ProfileViews)
                {
                    _ObjViewedProfile            = new ViewedProfileClass();
                    _ObjViewedProfile.TotalViews = _ObjProfiles.Count().ToString();
                    var _OtherUserDetails = new IntellidateR1.User().GetUserDetails(item.UserRefID);
                    _ObjViewedProfile.LoginName = _OtherUserDetails.LoginName;
                    string _MutualPercentage = new PhilosophyMatch().GetOverallMatchPercentage(_UserID, item.UserRefID).ToString();
                    if (_OtherUserDetails.IsUserOnline)
                    {
                        _ObjViewedProfile.OnlinePhoto = SitePath + "web/images/glassy_button_green.png";
                    }
                    else
                    {
                        //imgOtherUser_Online.Src = SitePath + "web/images/glassy_button_grey.png";
                    }
                    if (_OtherUserDetails.ProfilePhoto != null)
                    {
                        string PhotoPath   = ConfigurationManager.AppSettings["PhotosFolder"].ToString() + _OtherUserDetails.ProfilePhoto.PhotoPath;
                        string EncriptData = new IntellidateR1.EncryptDecrypt().Encrypt(PhotoPath + "&120&120");
                        _ObjViewedProfile.UserPhoto = SitePath + "web/PhotoView?ImagePath=" + EncriptData;
                    }
                    _ObjViewedProfile.Matchp      = _MutualPercentage;
                    _ObjViewedProfile.MatchpPhoto = SitePath + "web/Percentage?v=" + _MutualPercentage;

                    int _EachViewCount = _ObjProfiles.Where(x => x.UserRefID == item.UserRefID).Count();

                    if (_EachViewCount == 1)
                    {
                        _ObjViewedProfile.EachViewCountText = "1 time";
                    }
                    else if (_EachViewCount == 2)
                    {
                        _ObjViewedProfile.EachViewCountText = "2 times";
                    }
                    else
                    {
                        _ObjViewedProfile.EachViewCountText = "3 or more times";
                    }
                    _ObjViewedProfile.LastOnline = "";
                    if (_OtherUserDetails.IsUserOnline)
                    {
                        _ObjViewedProfile.OnlinePhoto = SitePath + "web/images/glassy_button_green.png";
                    }
                    else
                    {
                        _ObjViewedProfile.OnlinePhoto = "";
                    }
                    _lstUserProfiles.Add(_ObjViewedProfile);
                }
                return(_lstUserProfiles);
            }
            catch (Exception)
            {
                return(null);
            }
        }