Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TeamRepository objTeamRepository = new TeamRepository();
            GroupRepository objGroupRepository = new GroupRepository();
            //SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];
           //  Session["groupcheck"]

            User user = (User)Session["LoggedUser"];

            try
            {
                #region for You can use only 30 days as Unpaid User

                //SocioBoard.Domain.User user = (User)Session["LoggedUser"];
                if (user.PaymentStatus.ToLower() == "unpaid")
                {
                    if (!SBUtils.IsUserWorkingDaysValid(user.ExpiryDate))
                    {
                        // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You can use only 30 days as Unpaid User !');", true);

                        Session["GreaterThan30Days"] = "GreaterThan30Days";

                        Response.Redirect("/Settings/Billing.aspx");
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }




            if (user != null)
            {
                  if (user.ActivationStatus == "0" || user.ActivationStatus == null)
                {
                    actdiv.InnerHtml = "<marquee behavior=\"scroll\" direction=\"left\"><span >Your account is not yet activated.Check your E-mail to activate your account.</span><a id=\"resendmail\" uid=\"" + user.Id + "\" href=\"#\">Resend Mail</a></marquee>";
                    if (Request.QueryString["stat"] == "activate")
                    {
                        if (Request.QueryString["id"] != null)
                        {
                            //objUserActivation = objUserActivationRepository.GetUserActivationStatusbyid(Request.QueryString["id"].ToString());
                            if (user.Id.ToString() == Request.QueryString["id"].ToString())
                            {
                                user.Id = user.Id; //Guid.Parse(Request.QueryString["id"]);
                                //objUserActivation.UserId = Guid.Parse(Request.QueryString["id"]);// objUserActivation.UserId;
                                user.ActivationStatus = "1";
                                //UserActivationRepository.Update(objUserActivation);

                                int res = objUserRepository.UpdateActivationStatusByUserId(user);

                                actdiv.Attributes.CssStyle.Add("display", "none");
                                Console.WriteLine("before");
                                #region to check/update user Reference Relation
                                IsUserReferenceActivated(Request.QueryString["id"].ToString());
                                Console.WriteLine("after");
                                #endregion





                            }
                            else
                            {
                                Session["ActivationError"] = "Wrong Activation Link please contact Admin!";
                                //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true);
                                //Response.Redirect("ActivationLink.aspx");


                            }
                        }
                        else
                        {
                            Session["ActivationError"] = "Wrong Activation Link please contact Admin!";
                            //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true);
                            //Response.Redirect("ActivationLink.aspx");
                        }

                    }
                    else
                    {
                        // Response.Redirect("ActivationLink.aspx");
                    }


                }
              
                
                //if (Session["groupcheck"] == null)
                //{
                   
                //    Session["groupcheck"] = groupsselection.SelectedValue;
                //}
                //else
                //{
                //    groupsselection.SelectedValue = Session["groupcheck"].ToString();
                //}
              
               
                
                if (user.ActivationStatus == "1")
                {
                    actdiv.Attributes.CssStyle.Add("display", "none");
                }
            }


            if (!IsPostBack)
            {
                if (user == null)
                    Response.Redirect("/Default.aspx");

                else
                {


                    try
                    {
                        ArrayList totalAccuount = objTeamRepository.getAllAccountUser(user.EmailId,user.Id);
                        if (totalAccuount.Count != 0)
                        {

                            try
                            {
                                foreach (Guid item in totalAccuount)
                                {
                                    Guid GroupIde = (Guid)item;
                                    List<Groups> GetData = objGroupRepository.getAllGroupsDetail(GroupIde);
                                    if (GetData.Count != 0)
                                    {
                                        foreach (var items in GetData)
                                        {
                                            try
                                            {
                                                groupsselection.Items.Add(new ListItem((string)items.GroupName, items.Id.ToString()));
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine(ex.Message);
                                                logger.Error("Error : " + ex.Message);
                                                logger.Error("Error : " + ex.StackTrace);
                                            }
                                        }
                                    }
                                    if (Session["groupcheck"] == null)
                                    {

                                        Session["groupcheck"] = groupsselection.SelectedValue;
                                    }
                                    else
                                    {
                                        groupsselection.SelectedValue = Session["groupcheck"].ToString();
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error("Error : " + ex.Message);
                                logger.Error("Error : " + ex.StackTrace);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error("Error : " + ex.Message);
                        logger.Error("Error : " + ex.StackTrace);
                    }



                    NewMethod(user);

                }



            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
            HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
            HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            HttpContext.Current.Response.Cache.SetNoStore();
            TeamRepository objTeamRepository = new TeamRepository();
            GroupRepository objGroupRepository = new GroupRepository();

            try
            {
                User user = (User)Session["LoggedUser"];
               // SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];

                #region check user Activation

                UserRepository objUserRepository = new UserRepository();

                try
                {
                    if (user != null)
                    {
                        if (user.ActivationStatus == "0" || user.ActivationStatus ==null)
                        {
                            actdiv.InnerHtml = "<marquee behavior=\"scroll\" direction=\"left\"><span >Your account is not yet activated.Check your E-mail to activate your account.</span><a id=\"resendmail\" uid=\""+user.Id+"\" href=\"#\">Resend Mail</a></marquee>";
                            if (Request.QueryString["stat"] == "activate")
                            {
                                if (Request.QueryString["id"] != null)
                                {
                                    //objUserActivation = objUserActivationRepository.GetUserActivationStatusbyid(Request.QueryString["id"].ToString());
                                    if (user.Id.ToString() == Request.QueryString["id"].ToString())
                                    {
                                        user.Id = user.Id; //Guid.Parse(Request.QueryString["id"]);
                                        //objUserActivation.UserId = Guid.Parse(Request.QueryString["id"]);// objUserActivation.UserId;
                                        user.ActivationStatus = "1";
                                        //UserActivationRepository.Update(objUserActivation);

                                        int res = objUserRepository.UpdateActivationStatusByUserId(user);

                                        actdiv.Attributes.CssStyle.Add("display", "none");
                                        Console.WriteLine("before");
                                        #region to check/update user Reference Relation
                                        IsUserReferenceActivated(Request.QueryString["id"].ToString());
                                        Console.WriteLine("after");
                                        #endregion
                                       
                                       
                                       


                                    }
                                    else
                                    {
                                        Session["ActivationError"] = "Wrong Activation Link please contact Admin!";
                                        //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true);
                                        //Response.Redirect("ActivationLink.aspx");


                                    }
                                }
                                else
                                {
                                    Session["ActivationError"] = "Wrong Activation Link please contact Admin!";
                                    //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true);
                                    //Response.Redirect("ActivationLink.aspx");
                                }

                            }
                            else
                            {
                                // Response.Redirect("ActivationLink.aspx");
                            }


                        }

                        if (user.ActivationStatus == "1")
                        {
                            actdiv.Attributes.CssStyle.Add("display", "none");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }
                #endregion

                if (!IsPostBack)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " logout();", true);

                    if (user == null)
                        Response.Redirect("/Default.aspx");
                    else
                    {


                        #region for You can use only 30 days as Unpaid User

                        if (user.PaymentStatus.ToLower() == "unpaid")
                        {
                            if (!SBUtils.IsUserWorkingDaysValid(user.ExpiryDate))
                            {
                               // cmposecontainer.Attributes.Add("display", "none");
                                cmposecontainer.Attributes.CssStyle.Add("display", "none");
                                //topbtn.Attributes.CssStyle.Add("display", "none");
                                cmposecontainer.Attributes.CssStyle.Add("display", "none");
                                searchcontainer.Attributes.CssStyle.Add("display", "none");
                            }
                        }
                        #endregion




                        try
                        {
                            if (Session["IncomingTasks"] != null)
                            {
                                //incom_tasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                                //incomTasks.InnerHtml = Convert.ToString((int)Session["IncomingTasks"]);
                            }
                            else
                            {
                                //TaskRepository taskRepo = new TaskRepository();
                                //ArrayList alst = taskRepo.getAllIncompleteTasksOfUser(user.Id,team.GroupId);
                                //Session["IncomingTasks"] = alst.Count;
                                //incom_tasks.InnerHtml = Convert.ToString(alst.Count);
                                //incomTasks.InnerHtml = Convert.ToString(alst.Count);
                            }
                        }
                        catch (Exception es)
                        {
                            logger.Error(es.Message);
                            Console.WriteLine(es.Message);
                        }
                        try
                        {

                            FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                            int alstfeedfb = objFacebookFeedRepository.countUnreadMessages(user.Id);
                            TwitterMessageRepository objTwitterMessageRepository = new TwitterMessageRepository();
                            int alstMsgtwt = objTwitterMessageRepository.getCountUnreadMessages(user.Id);
                            incom_messages.InnerHtml = (alstfeedfb + alstMsgtwt).ToString();


                            if (Session["CountMessages"] != null)
                            {
                                //incom_messages.InnerHtml = Convert.ToString((int)Session["CountMessages"]);
                                //incomMessages.InnerHtml = Convert.ToString((int)Session["CountMessages"]);
                            }
                            else
                            {
                                //incom_messages.InnerHtml = "0";
                                //incomMessages.InnerHtml = "0";
                            }
                        }
                        catch (Exception sx)
                        {
                            logger.Error(sx.Message);
                            Console.WriteLine(sx.Message);
                        }

                      
//======================================================================================================                                      

                        try
                        {

                            ArrayList totalAccuount = objTeamRepository.getAllAccountUser(user.EmailId,user.Id);
                            if (totalAccuount.Count != 0)
                            {
                                string drodownselectedvalue = string.Empty;
                                try
                                {
                                    foreach (Guid item in totalAccuount)
                                    {
                                        Guid GroupIde = (Guid)item;

                                        List<Groups> GetData = objGroupRepository.getAllGroupsDetail(GroupIde);
                                        if (GetData.Count != 0)
                                        {
                                            string val = string.Empty;
                                            foreach (var items in GetData)
                                            {
                                                try
                                                {
                                                    if (items.GroupName == "Socioboard")
                                                    {
                                                        drodownselectedvalue = items.Id.ToString();
                                                    }
                                                    groupsselection.Items.Add(new ListItem((string)items.GroupName, items.Id.ToString()));
                                                }
                                                catch { }
                                            }

                                        }

                                    }

                                    if (Session["groupcheck"] == null)
                                    {
                                        int i = 0;
                                        groupsselection.SelectedIndex = groupsselection.Items.IndexOf(groupsselection.Items.FindByText("Socioboard"));
                                        //groupsselection.SelectedIndex = groupsselection.Items.IndexOf(groupsselection.Items.FindByValue("Socioboard"));
                                        //ListItem li =  groupsselection.Items.FindByText(drodownselectedvalue);
                                        //li.Selected = true;
                                        Session["groupcheck"] = groupsselection.Items.FindByText("Socioboard").Value;
                                    }
                                    else
                                    {
                                        groupsselection.SelectedIndex = groupsselection.Items.IndexOf(groupsselection.Items.FindByValue((string)Session["groupcheck"]));
                                        //groupsselection.se.SelectedIndex = Session["groupcheck"];
                                    }

                                    //if (Session["groupcheck"] == null)
                                    //{

                                    //    groupsselection.SelectedValue = (drodownselectedvalue);
                                    //    Session["groupcheck"] = groupsselection.SelectedValue;
                                    //}
                                    //else
                                    //{
                                    //    groupsselection.SelectedIndex = Session["groupcheck"];
                                    //}
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }
                            }




                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            logger.Error("Error : " + ex.Message);
                            logger.Error("Error : " + ex.StackTrace);
                        }

//=====================================================================================================================================                                            
                        usernm.InnerHtml = "Hello, " + user.UserName + " ";
                        if (!string.IsNullOrEmpty(user.ProfileUrl))
                        {
                            // Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                            //userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" /></a></a>";
                            userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" />";
                            userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" />";
                            //userinf.InnerHtml = Datetime;
                            //{ 
                                //userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" height=\"100\" width=\"100\"/></a></a>";
                                userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" height=\"100\" width=\"100\"/>";
                                userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\" height=\"100\" width=\"100\"/>";
                            if (user.TimeZone != null)
                            {
                                Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                                //userinf.InnerHtml = Datetime;
                            }
                            if (user.TimeZone == null)
                            {
                                Datetime = DateTime.Now.ToString();
                                //userinf.InnerHtml = Datetime;
                            }
                        }
                        else
                        {
                            //Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                            //userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"../Contents/img/blank_img.png\" alt=\"" + user.UserName + "\"/></a>";
                            userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"../Contents/img/blank_img.png\" alt=\"" + user.UserName + "\"/>";
                            userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"../Contents/img/blank_img.png\" alt=\"" + user.UserName + "\"/>";

                            //userinf.InnerHtml = Datetime;
                            if (user.TimeZone != null)
                            {
                                Datetime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToLongDateString() + " " + TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, user.TimeZone).ToShortTimeString() + " (" + user.TimeZone + ")";
                                //userinf.InnerHtml = Datetime;
                            }
                            if (user.TimeZone == null)
                            {
                                Datetime = DateTime.Now.ToString();
                                //userinf.InnerHtml = Datetime;
                            }
                        }

                        try
                        {

                            GroupRepository grouprepo = new GroupRepository();
                            List<Groups> lstgroups = grouprepo.getAllGroupsCompleteDetails(user.Id);
                            string totgroups = string.Empty;
                            if (lstgroups.Count != 0)
                            {
                                foreach (Groups item in lstgroups)
                                {
                                    totgroups += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\" id=\"group_" + item.Id + "\"><img src=\"../Contents/img/groups_.png\"  alt=\"\"  style=\" margin-right:5px;\"/>" + item.GroupName + "</a></li>";
                                }
                                inviteRedirect.InnerHtml = totgroups;
                            }
                            if (user.AccountType == AccountType.Deluxe.ToString().ToLower())
                                tot_acc = 10;
                            else if (user.AccountType == AccountType.Standard.ToString().ToLower())
                                tot_acc = 20;
                            else if (user.AccountType == AccountType.Premium.ToString().ToLower())
                                tot_acc = 50;
                            profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;

                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                 
                   

                }

                //Team lstDetails = objTeamRepository.getAllGroupsDetails(user.EmailId.ToString(), Guid.Parse(groupsselection.SelectedItem.Value));
                //Session["GroupName"] = lstDetails;


            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                Console.WriteLine(ex.Message);
            }
        }