Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["tid"]))
                {
                    Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                    TeamRepository teamRepo = new TeamRepository();
                    Team team = teamRepo.getTeamById(teamid);
                    txtFirstName.Text = team.FirstName;
                    txtLastName.Text = team.LastName;
                    txtEmail.Text = team.EmailId;
                    txtEmail.Enabled = false;

                }
            }
            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (!string.IsNullOrEmpty(Request.QueryString["tid"]))
                    {
                        Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                        TeamRepository teamRepo = new TeamRepository();
                        Team team = teamRepo.getTeamById(teamid);
                        txtFirstName.Text = team.FirstName;
                        txtLastName.Text = team.LastName;
                        txtEmail.Text = team.EmailId;
                        txtEmail.Enabled = false;

                    }
                    if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                    {
                        //DropDownList1.SelectedItem.Text = Request.QueryString["type"].ToString();

                        DropDownList1.SelectedValue = Request.QueryString["type"].ToString();
                    }
                }

                //if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                //{
                //    //DropDownList1.SelectedItem.Text = Request.QueryString["type"].ToString();

                //    DropDownList1.SelectedValue = Request.QueryString["type"].ToString();
                //}

                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                logger.Error("Error : " + ex.Message);
                logger.Error("Error : " + ex.StackTrace);
            }
        }
Exemplo n.º 3
0
        protected void rdbtnteamtask_CheckedChanged(object sender, EventArgs e)
        {
            // IEnumerable<dynamic> task = taskrepo.GetAllTaskbyCustId(custid);

            if (chkincomplete.Checked == true)
            {
                chkincomplete.Checked = false;
            }
            if (CheckBox1.Checked == true)
            {
                CheckBox1.Checked = false;
            }
            if (rdbtnmytask.Checked == true)
            {
                rdbtnteamtask.Checked = false;
            }

            string path = "";
            string strbind = "";
            taskdiv.InnerHtml = "";
            int i = 0;
            string preaddedcomment = "";
            TaskCommentRepository objTaskCmtRepo = new TaskCommentRepository();
            TeamRepository objTeam = new TeamRepository();
            taskdata = taskrepo.getAllTasksOfUser(custid);
            foreach (Tasks item in taskdata)
            {
                //if (item.pic_url == "")
                //    path = "../Contents/Images/blank_img.png";
                //else
                //    path = "../Contents/user_image/" + item.pic_url;
                Team team = objTeam.getMemberById(item.AssignTaskTo, item.UserId);
                string strAssignedTo=string.Empty;
                if (team == null)
                {
                    strAssignedTo = custname;
                }
                else
                    strAssignedTo = team.FirstName;
                imgpath = path;
                i++;
                strbind += "<section class=\"section\" id=\"Section" + item.Id + "\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                                   "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=" + path + " />" +
                                   "</section><section class=\"task-activity third\"><p>" + strAssignedTo + "</p><div>" + item.AssignDate + "</div><input type=\"hidden\" id=\"hdntaskid_" + i + "\" value=" + item.Id + " />" +
                                  "<p>Assigned by " + custname + "</p></section><section class=\"task-message font-13 third\"><a class=\"tip_left\">" + item.TaskMessage + "</a>" +
                                  "</section><section class=\"task-status\"><span id=\"taskcomment\" class=\"ficon task_active\">" +
                                      "<img  onclick=\"getmemberdata('" + item.Id + "');\" src=\"../Contents/Images/task/task_pin.png\" width=\"14\" height=\"17\" alt=\"\" /></span><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                      "<span class=\"ui-sproutmenu-status\">" + item.TaskStatus +
                                      "<img id=\"img_" + item.Id + "_" + item.TaskStatus + "\" class=\"edit_button\" src=\"../Contents/Images/icon_edit.png\" onclick=\"PerformClick(this.id)\" title=\"Edit Status\" />" +
                                      "</span></a></div></section></div>" +
                                      "</section>";

                ArrayList pretask = objTaskCmtRepo.getAllTasksCommentOfUser(item.UserId, item.Id);
                if (pretask != null)
                {
                    preaddedcomment += "<div id=" + item.Id + " style=\"display:none\" >";
                    foreach (TaskComment items in pretask)
                    {
                        preaddedcomment += "<div id=\"task_comment_" + item.Id + "_" + items.Id + "\" class=\"assign_comments\" >" +
                                        "<section><article class=\"task_assign\">" +
                                        "<img src=" + imgpath + " width=\"30\" height=\"30\" alt=\"\"  />  " +
                                            "<article><input id=\"hdncommentsid\" type=\"hidden\" value=" + items.Id + " /><p class=\"msg_article\">" + items.Comment + "</p>" +
                                                "<aside class=\"days_ago\">Assigned to ANagha  by " + items.CommentDate + "</aside>" +
                                            "</article></article></section></div>";
                    }

                    preaddedcomment += "</div>";
                }

            }

            taskdiv.InnerHtml = strbind;
            prevComments.InnerHtml = preaddedcomment;
        }
Exemplo n.º 4
0
        void ProcessRequest()
        {
            User user = (User)Session["LoggedUser"];
            if (Request.QueryString["op"] != null)
            {
                if (Request.QueryString["op"] == "bindMessages")
                {
                    DataSet ds = null;
                    if (Session["MessageDataTable"] == null)
                    {
                        clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages();
                        ds = clsfeedsandmess.bindMessagesIntoDataTable(user);
                        FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                        Session["MessageDataTable"] = ds;
                    }
                    else
                    {
                        ds = (DataSet)Session["MessageDataTable"];
                    }
                    string message = "There is no message !";
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        message = this.BindData(ds.Tables[0]);
                    }
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "inbox_messages")
                {
                    DataSet ds = null;
                    if (Session["InboxMessages"] == null)
                    {
                        clsFeedsAndMessages clsfeedsandmessages = new clsFeedsAndMessages();
                        ds = clsfeedsandmessages.bindSentMessagesToDataTable(user, "");
                        Session["InboxMessages"] = ds;
                    }
                    else
                    {
                        ds = (DataSet)Session["InboxMessages"];
                    }

                    string message = "There is no message !";
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        message = this.BindData(ds.Tables[0]);
                    }
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "bindProfiles")
                {

                    string profiles = string.Empty;
                    int i = 0;
                    profiles += "<ul class=\"options_list\">";

                    /*Binding facebook profiles in Accordian*/
                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                    ArrayList alstfacebookprofiles = facerepo.getOnlyFacebookAccountsOfUser(user.Id);
                    foreach (FacebookAccount item in alstfacebookprofiles)
                    {
                        try
                        {
                            profiles += "<ul><li><a id=\"checkimg_" + i + "\" href=\"#\" onclick=\"checkprofile('" + item.FbUserId + "','message','facebook');\"><img src=\"../Contents/img/admin/fbicon.png\"  width=\"15\" height=\"15\" alt=\"\" >" + item.FbUserName + "</a></li>";
                            i++;
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }

                    }

                    /*Binding TwitterProfiles in Accordian*/
                    TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                    ArrayList alsttwt = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                    foreach (TwitterAccount item in alsttwt)
                    {
                        try
                        {
                            profiles += "<ul><li><a href=\"#\" id=\"checkimg_" + i + "\" onclick=\"checkprofile('" + item.TwitterUserId + "','message','twitter');\"><img src=\"../Contents/img/admin/twittericon.png\"  width=\"15\" height=\"15\" alt=\"\" >" + item.TwitterScreenName + "</a></li>";
                            i++;
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }

                    GooglePlusAccountRepository gpAccRepo = new GooglePlusAccountRepository();
                    ArrayList alstgp = gpAccRepo.getAllGooglePlusAccountsOfUser(user.Id);
                    foreach (GooglePlusAccount item in alstgp)
                    {
                        try
                        {
                            profiles += "<ul><li><a href=\"#\" id=\"checkimg_" + i + "\" onclick=\"checkprofile('" + item.GpUserId + "','message','googleplus');\"><img src=\"../Contents/img/google_plus.png\"  width=\"15\" height=\"15\" alt=\"\" >" + item.GpUserName + "</a></li>";
                            i++;
                        }
                        catch (Exception esx)
                        {
                            logger.Error(esx.Message);
                            Console.WriteLine(esx.Message);
                        }
                    }
                    profiles += "</ul><input type=\"hidden\" id=\"profilecounter\" value=\"" + i + "\">";
                    Response.Write(profiles);
                }
                else if (Request.QueryString["op"] == "changeTaskStatus")
                {
                    Guid taskid = Guid.Parse(Request.QueryString["taskid"]);
                    bool status = bool.Parse(Request.QueryString["status"]);

                    if (status == true)
                        status = false;
                    else
                        status = true;
                    TaskRepository objTaskRepo = new TaskRepository();
                    objTaskRepo.updateTaskStatus(taskid, user.Id, status);

                }
                else if (Request.QueryString["op"] == "savetask")
                {
                    string descritption = Request.QueryString["description"];
                    Guid idtoassign = Guid.Empty;
                    try
                    {
                        if (Request.QueryString["memberid"] != string.Empty)
                        {
                            idtoassign = Guid.Parse(Request.QueryString["memberid"].ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                        // idtoassign = 0;
                    }
                    Tasks objTask = new Tasks();
                    TaskRepository objTaskRepo = new TaskRepository();
                    objTask.AssignDate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                    objTask.AssignTaskTo = idtoassign;
                    objTask.TaskStatus = false;
                    objTask.TaskMessage = descritption;
                    objTask.UserId = user.Id;
                    Guid taskid = Guid.NewGuid();
                    objTask.Id = taskid;
                    objTaskRepo.addTask(objTask);

                    /////////////////
                    string comment = Request.QueryString["comment"];
                    if (!string.IsNullOrEmpty(comment))
                    {
                        string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                        TaskComment objcmt = new TaskComment();
                        TaskCommentRepository objcmtRepo = new TaskCommentRepository();
                        objcmt.Comment = comment;
                        objcmt.CommentDate = DateTime.Now;
                        objcmt.EntryDate = DateTime.Now;
                        objcmt.Id = Guid.NewGuid();
                        objcmt.TaskId = objTask.Id;
                        objcmt.UserId = user.Id;
                        objcmtRepo.addTaskComment(objcmt);
                    }

                }
                else if (Request.QueryString["op"] == "bindteam")
                {
                    TeamRepository objTeam = new TeamRepository();
                    string message = string.Empty;
                    message += "<ul>";
                    IEnumerable<dynamic> result = objTeam.getAllTeamsOfUser(user.Id);

                    if (result != null)
                    {
                        foreach (Team item in result)
                        {

                            message += "<li><a>";
                            message += "<img src=\"../Contents/img/blank_img.png\" alt=\"\" />";
                            message += "<span class=\"name\">" +
                                                     item.FirstName + " " + item.LastName +
                                                 "</span>" +
                                              " <span>" +
                                              "<input id=\"customerid_" + item.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + item.Id + "\">" +
                                              "</span>" +
                                             "</a></li>";
                        }

                        message += "<li><a>";
                        if (string.IsNullOrEmpty(user.ProfileUrl))
                        {

                            message += "<img src=\"../Contents/img/blank_img.png\" alt=\"\" />";
                        }
                        else
                        {
                            message += "<img src=\"" + user.ProfileUrl + "\" alt=\"\" />";
                        }

                        message += "<span class=\"name\">" +
                                 user.UserName +
                              "</span>" +
                           " <span>" +
                           "<input id=\"customerid_" + user.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + user.Id + "\">" +
                           "</span></a></li>";

                    }
                    else
                    {
                        message += "<li><a>";

                        if (string.IsNullOrEmpty(user.ProfileUrl))
                        {

                            message += "<img src=\"../Contents/img/blank_img.png\" alt=\"\" />";
                        }
                        else
                        {
                            message += "<img src=\"" + user.ProfileUrl + "\" alt=\"\" />";
                        }

                        message += "<span class=\"name\">" +
                                            user.UserName +
                                         "</span>" +
                                      " <span>" +
                                      "<input id=\"customerid_" + user.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + user.Id + "\">" +
                                      "</span>" +
                                     "</a></li>";

                    }
                    message += "</ul>";
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "bindarchive")
                {
                    ArchiveMessageRepository objArchiveRepo = new ArchiveMessageRepository();

                    string message = string.Empty;
                    message += "<ul  id=\"message-list\">";
                    List<ArchiveMessage> result = objArchiveRepo.getAllArchiveMessage(user.Id);
                    int sorteddatacount = 0;
                    if (result != null)
                    {
                        foreach (ArchiveMessage item in result)
                        {
                            message += "<li>";
                            sorteddatacount++;
                            if (item.SocialGroup == "twitter")
                            {
                                message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:auto;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" onclick=\"detailsprofile(this.alt);\" src=\"" + item.ImgUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" +
                                             "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" +
                                             "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div  id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.Message + "</p>" +
                                                 "<div class=\"message-list-info\"><span><a href=\"#\" id=\"rowname_" + sorteddatacount + "\" onclick=\"detailsprofile(" + item.ProfileId + ");\">" + item.ProfileId + "</a> " + item.CreatedDateTime + "</span>" +
                                                 "<div class=\"scl\">" +
                                                 "<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img src= title=\"Task\" \"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>";
                            }
                            else if (item.SocialGroup == "facebook")
                            {
                                message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:auto;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" onclick=\"detailsprofile(this.alt);\" src=\"" + item.ImgUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" +
                                            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" +
                                            "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div  id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.Message + "</p>" +
                                                "<div class=\"message-list-info\"><span><a href=\"#\" id=\"rowname_" + sorteddatacount + "\" onclick=\"getFacebookProfiles(" + item.ProfileId + ");\">" + item.ProfileId + "</a> " + item.CreatedDateTime + "</span>" +
                                                "<div class=\"scl\">" +
                                                "<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>";

                            }
                            else if (item.SocialGroup == "googleplus")
                            {
                                message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:auto;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" onclick=\"detailsprofile(this.alt);\" src=\"" + item.ImgUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" +
                                            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" +
                                            "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div  id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.Message + "</p>" +
                                                "<div class=\"message-list-info\"><span><a href=\"#\" id=\"rowname_" + sorteddatacount + "\" onclick=\"detailsprofile(" + item.ProfileId + ");\">" + item.ProfileId + "</a> " + item.CreatedDateTime + "</span>" +
                                                "<div class=\"scl\">" +
                                                "<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a></div></div></div></div></li>";

                            }
                            message += "</li>";
                        }

                    }
                    message += "</ul>";
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "savearchivemsg")
                {
                    User use = (User)Session["LoggedUser"];
                    ArchiveMessage am = new ArchiveMessage();
                    ArchiveMessageRepository objArchiveRepo = new ArchiveMessageRepository();
                    am.UserId = user.Id;
                    am.ImgUrl = Request.QueryString["imgurl"];
                    //am.user_name = Request.QueryString["UserName"];
                    //am.msg = Request.QueryString["Msg"];
                    ////am.sociel_group = Request.QueryString["Network"];
                    //am.createdtime = Request.QueryString["CreatedTime"];

                    System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                    string line = "";
                    line = sr.ReadToEnd();
                    // JObject jo = JObject.Parse("[" + line + "]");
                    // am.UserName = Request.QueryString["UserName"];//Server.UrlDecode((string)jo["UserName"]);
                    //am.Message = Request.QueryString["Msg"];//Server.UrlDecode((string)jo["Msg"]);
                    JObject jo = JObject.Parse(line);
                    am.Message = Server.UrlDecode((string)jo["Msg"]); ;//Server.UrlDecode((string)jo["Msg"]);
                    am.SocialGroup = Request.QueryString["Network"];// Server.UrlDecode((string)jo["Network"]);
                    am.CreatedDateTime = Request.QueryString["CreatedTime"];
                    am.MessageId = Request.QueryString["MessageId"];
                    am.ProfileId = Request.QueryString["ProfileId"];
                    am.UserId = use.Id;

                    // Server.UrlDecode((string)jo["CreatedTime"]);

                    if (am.UserName != string.Empty)
                    {
                        if (!objArchiveRepo.checkArchiveMessageExists(user.Id, am.MessageId))
                        {
                            objArchiveRepo.AddArchiveMessage(am);
                        }
                    }
                }
                else if (Request.QueryString["op"] == "createfacebookcomments")
                {
                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                    string postid = Request.QueryString["replyid"];
                    string message = Request.QueryString["replytext"];
                    string userid = Request.QueryString["userid"];
                    FacebookAccount result = facerepo.getFacebookAccountDetailsById(userid, user.Id);

                    FacebookClient fc = new FacebookClient(result.AccessToken);
                    Dictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("message", message);
                    JsonObject dyn = (JsonObject)fc.Post("/" + postid+ "/comments", parameters);

                }
                else if (Request.QueryString["op"] == "getFacebookComments")
                {
                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                    string postid = Request.QueryString["postid"];
                    string userid = Request.QueryString["userid"];
                    FacebookAccount result = facerepo.getFacebookAccountDetailsById(userid, user.Id);

                    FacebookClient fc = new FacebookClient(result.AccessToken);
                    JsonObject dyn = (JsonObject)fc.Get("/" + postid + "/comments");
                    string mess = string.Empty;
                    dynamic jc = dyn["data"];
                    int iii = 0;
                    foreach (dynamic item in jc)
                    {
                        mess += "<div class=\"messages\"><section><aside><section class=\"js-avatar_tip\" data-sstip_class=\"twt_avatar_tip\">" +
                                "<a class=\"avatar_link view_profile\">" +
                                "<img width=\"54\" height=\"54\" border=\"0\" id=\"" + item["id"] + "\" class=\"avatar\" src=\"http://graph.facebook.com/" + item["from"]["id"] + "/picture?type=small\"><article class=\"message-type-icon\"></article>" +
                                 "</a></section><ul></ul></aside><article><div class=\"\"><a class=\"language\" href=\"\"></a></div>" +
                                 "<div class=\"message_actions\"><a class=\"gear_small\" href=\"#\"><span title=\"Options\" class=\"ficon\">?</span></a></div><div id=\"messagedescription_" + iii + "\" class=\"message-text font-14\">" + item["message"] + "</div><section class=\"bubble-meta\"><article class=\"threefourth text-overflow\"><section class=\"floatleft\"><a class=\"js-avatar_tip view_profile profile_link\" data-sstip_class=\"twt_avatar_tip\"><span id=\"rowname_" + iii + "\">" + item["from"]["name"] + "</span></a>&nbsp;<a data-msg-time=\"1363926699000\" class=\"time\" target=\"_blank\" title=\"View message on Twitter\">" + item["created_time"] + "</a><span class=\"location\">&nbsp;</span></section></article><ul class=\"message-buttons quarter clearfix\"></ul></section></article></section></div>";
                    }
                    Response.Write(mess);

                }
                else if (Request.QueryString["op"] == "twittercomments")
                {

                    Tweet objTwitterMethod = new Tweet();
                    TwitterAccountRepository objTwtAccRepo = new TwitterAccountRepository();
                    try
                    {
                        string messid = Request.QueryString["messid"];
                        string replytext = Request.QueryString["replytext"];
                        string replyid = Request.QueryString["replyid"];
                        string userid = Request.QueryString["userid"];
                        string username = Request.QueryString["username"];
                        string rowid = Request.QueryString["rowid"];
                        TwitterAccount objTwtAcc = objTwtAccRepo.getUserInformation(user.Id, userid);

                        TwitterHelper twthelper = new TwitterHelper();

                        oAuthTwitter OAuthTwt = new oAuthTwitter();
                        OAuthTwt.AccessToken = objTwtAcc.OAuthToken;
                        OAuthTwt.AccessTokenSecret = objTwtAcc.OAuthSecret;
                        OAuthTwt.TwitterScreenName = objTwtAcc.TwitterScreenName;
                        twthelper.SetCofigDetailsForTwitter(OAuthTwt);
                        Tweet twt = new Tweet();
                        JArray post = twt.Post_Statuses_Update(OAuthTwt, replytext);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
                else if (Request.QueryString["op"] == "gpProfile")
                {
                    GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository();
                    GooglePlusAccount objGpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(Request.QueryString["gpid"].ToString(), user.Id);
                    PeopleController obj = new PeopleController();
                    oAuthToken objgpToken = new oAuthToken();
                    JArray objProfile = null;
                    try
                    {
                        string strAccess = objgpToken.GetAccessToken(objGpAcc.RefreshToken);
                        if (!strAccess.StartsWith("["))
                            strAccess = "[" + strAccess + "]";
                        JArray objArray = JArray.Parse(strAccess);
                        foreach (var itemgp in objArray)
                        {
                            objGpAcc.AccessToken = itemgp["access_token"].ToString();
                        }
                        objProfile = obj.GetPeopleProfile(Request.QueryString["gpid"].ToString(), objGpAcc.AccessToken);
                    }
                    catch (Exception Err)
                    {
                        logger.Error(Err.Message);
                        Console.Write(Err.Message.ToString());
                    }
                    string jas = string.Empty;
                      foreach (var item in objProfile)
                    {
                        jas += "<div class=\"modal-small draggable\">";
                        jas += "<div class=\"modal-content\">";
                        jas += "<button type=\"button\" class=\"modal-btn button b-close\">";
                        jas += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>";
                        jas += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>";
                        jas += "<div class=\"modal-body profile-modal\">";
                        jas += "<div class=\"module profile-card component profile-header\">";
                        jas += "<div style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\" class=\"profile-header-inner flex-module clearfix\">";
                        jas += "<div class=\"profile-header-inner-overlay\"></div>";
                        jas += "<a href=\"#\" class=\"profile-picture media-thumbnail js-nav\">";
                        string[] imgurl = item["image"]["url"].ToString().Split('?');
                        jas += "<img src=\"" + imgurl[0] + " alt=\"" + item["name"]["givenName"] + "\" class=\"avatar size73\"></a>";
                        jas += "<div class=\"profile-card-inner\">";
                        jas += "<h1 class=\"fullname editable-group\">";
                        jas += "<a class=\"js-nav\" href=\"#\">" + item["name"]["givenName"] + "</a>";
                        jas += "<a href=\"#\" class=\"verified-link js-tooltip\">";
                        jas += "<span class=\"icon verified verified-large-border\">";
                        jas += "<span class=\"visuallyhidden\"></span></span></a></h1>";
                        jas += "<h2 class=\"username\">";
                        jas += "<a class=\"pretty-link js-nav\" href=\"#\">";
                        jas += "<span class=\"screen-name\"><s></s>" + item["displayName"] + "</span></a></h2>";
                        jas += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\"></p></div>";
                        jas += "<p class=\"location-and-url\">";
                        jas += "<span class=\"location-container editable-group\">";
                        jas += "<span class=\"location profile-field\"></span></span>";
                        jas += "<span class=\"divider hidden\"></span> ";
                        jas += "<span class=\"url editable-group\">  ";
                        jas += "<span class=\"profile-field\">";
                        jas += "<a target=\"_blank\" rel=\"me nofollow\" href=\"" + item["url"] + "\" title=\"#\">" + item["url"] + " </a></span></span></p>";
                        jas += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\">&nbsp;</div><p></p></div></div>";
                        jas += "<div class=\"clearfix\"><div class=\"default-footer\">";
                        jas += "<div class=\"btn-group\"><div class=\"follow_button\"></div></div></div></div>";
                        jas += "<div class=\"profile-social-proof\">";
                        jas += "<div class=\"follow-bar\"></div></div></div>";
                        jas += "<ol class=\"recent-tweets\"><li class=\"\"><div><i class=\"dogear\"></i></div></li></ol>";
                        jas += "<div class=\"go_to_profile\">";
                        jas += "<small><a class=\"view_profile\" target=\"_blank\" href=\""+ item["url"] +"\">Go to full profile →</a></small></div></div>";
                        jas += "<div class=\"loading\"><span class=\"spinner-bigger\"></span></div></div></div>";
                    }
                    Response.Write(jas);
                }
                else if (Request.QueryString["op"] == "updatedstatus")
                {
                    try
                    {
                        TwitterMessageRepository twtmsgRepo = new TwitterMessageRepository();
                        int i = twtmsgRepo.updateMessageStatus(user.Id);
                        FacebookFeedRepository fbfeedRepo = new FacebookFeedRepository();
                        int j = fbfeedRepo.updateMessageStatus(user.Id);

                        if (i > 0 || j > 0)
                        {
                            Session["CountMessages"] = 0;
                            Session["MessageDataTable"] = null;

                            DataSet ds = null;
                            if (Session["MessageDataTable"] == null)
                            {
                                clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages();
                                ds = clsfeedsandmess.bindMessagesIntoDataTable(user);
                                FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                                Session["MessageDataTable"] = ds;
                            }
                            else
                            {
                                ds = (DataSet)Session["MessageDataTable"];
                            }
                        }

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

                    }
                }
            }
        }
Exemplo n.º 5
0
        public string DeleteAllUsersByCreateDate(string date)
        {
            int i = 0;
            int count = 0;
            UserRepository objUserRepository = new UserRepository();
            List<User> lstuser = objUserRepository.GetAllUsersByCreateDate(date);
            ArchiveMessageRepository objArchiveMessageRepository = new ArchiveMessageRepository();
            DiscoverySearchRepository objDiscoverySearchRepository = new DiscoverySearchRepository();
            DraftsRepository objDraftsRepository = new DraftsRepository();
            FacebookAccountRepository objFacebookAccountRepository = new FacebookAccountRepository();
            FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
            FacebookInsightPostStatsRepository objFacebookInsightPostStatsRepository = new FacebookInsightPostStatsRepository();
            FacebookInsightStatsRepository objFacebookInsightStatsRepository = new FacebookInsightStatsRepository();
            FacebookMessageRepository objFacebookMessageRepository = new FacebookMessageRepository();
            FacebookStatsRepository objFacebookStatsRepository = new FacebookStatsRepository();
            GoogleAnalyticsAccountRepository objGoogleAnalyticsAccountRepository = new GoogleAnalyticsAccountRepository();
            GoogleAnalyticsStatsRepository objGoogleAnalyticsStatsRepository = new GoogleAnalyticsStatsRepository();
            GooglePlusAccountRepository objGooglePlusAccountRepository = new GooglePlusAccountRepository();
            GooglePlusActivitiesRepository objGooglePlusActivitiesRepository = new GooglePlusActivitiesRepository();
            GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
            GroupRepository objGroupRepository = new GroupRepository();
            InstagramAccountRepository objInstagramAccountRepository = new InstagramAccountRepository();
            InstagramCommentRepository objInstagramCommentRepository = new InstagramCommentRepository();
            InstagramFeedRepository objInstagramFeedRepository = new InstagramFeedRepository();
            LinkedInAccountRepository objLinkedInAccountRepository = new LinkedInAccountRepository();
            LinkedInFeedRepository objLinkedInFeedRepository = new LinkedInFeedRepository();
            LogRepository objLogRepository = new LogRepository();
            RssFeedsRepository objRssFeedsRepository = new RssFeedsRepository();
            RssReaderRepository objRssReaderRepository = new RssReaderRepository();
            ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
            SocialProfilesRepository objSocialProfilesRepository = new SocialProfilesRepository();
            TaskCommentRepository objTaskCommentRepository = new TaskCommentRepository();
            TaskRepository objTaskRepository = new TaskRepository();
            TeamRepository objTeamRepository = new TeamRepository();
            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
            TwitterAccountRepository objTwitterAccountRepository = new TwitterAccountRepository();
            TwitterDirectMessageRepository objTwitterDirectMessageRepository = new TwitterDirectMessageRepository();
            TwitterFeedRepository objTwitterFeedRepository = new TwitterFeedRepository();
            TwitterMessageRepository objTwitterMessageRepository = new TwitterMessageRepository();
            TwitterStatsRepository objTwitterStatsRepository = new TwitterStatsRepository();
            UserActivationRepository objUserActivationRepository = new UserActivationRepository();
            UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();






            count = lstuser.Count();


            foreach (var item in lstuser)
            {
                i++;
                try
                {

                    if (item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**")
                    {

                    }
                    else
                    {
                        objArchiveMessageRepository.DeleteArchiveMessageByUserid(item.Id);
                        objDiscoverySearchRepository.DeleteDiscoverySearchByUserid(item.Id);
                        objDraftsRepository.DeleteDraftsByUserid(item.Id);
                        objFacebookAccountRepository.DeleteFacebookAccountByUserid(item.Id);
                        objFacebookFeedRepository.DeleteFacebookFeedByUserid(item.Id);
                        objFacebookInsightPostStatsRepository.DeleteFacebookInsightPostStatsByUserid(item.Id);
                        objFacebookInsightStatsRepository.DeleteFacebookInsightStatsByUserid(item.Id);
                        objFacebookMessageRepository.DeleteFacebookMessageByUserid(item.Id);
                        objFacebookStatsRepository.DeleteFacebookStatsByUserid(item.Id);
                        objGoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(item.Id);
                        objGoogleAnalyticsStatsRepository.DeleteGoogleAnalyticsStatsByUserid(item.Id);
                        objGooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(item.Id);
                        objGooglePlusActivitiesRepository.DeleteGooglePlusActivitiesByUserid(item.Id);
                        objGroupProfileRepository.DeleteGroupProfileByUserid(item.Id);
                        objGroupRepository.DeleteGroupsByUserid(item.Id);
                        objInstagramAccountRepository.DeleteInstagramAccountByUserid(item.Id);
                        objInstagramCommentRepository.DeleteInstagramCommentByUserid(item.Id);
                        objInstagramFeedRepository.DeleteInstagramFeedByUserid(item.Id);
                        objLinkedInAccountRepository.DeleteLinkedInAccountByUserid(item.Id);
                        objLinkedInFeedRepository.DeleteLinkedInFeedByUserid(item.Id);
                        objLogRepository.DeleteLogByUserid(item.Id);
                        objRssFeedsRepository.DeleteRssFeedsByUserid(item.Id);
                        objRssReaderRepository.DeleteRssReaderByUserid(item.Id);
                        objScheduledMessageRepository.DeleteScheduledMessageByUserid(item.Id);
                        objSocialProfilesRepository.DeleteSocialProfileByUserid(item.Id);
                        objTaskCommentRepository.DeleteTaskCommentByUserid(item.Id);
                        objTaskRepository.DeleteTasksByUserid(item.Id);
                        objTeamRepository.DeleteTeamByUserid(item.Id);
                        objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(item.Id);
                        objTwitterAccountRepository.DeleteTwitterAccountByUserid(item.Id);
                        objTwitterDirectMessageRepository.DeleteTwitterDirectMessagesByUserid(item.Id);
                        objTwitterFeedRepository.DeleteTwitterFeedByUserid(item.Id);
                        objTwitterMessageRepository.DeleteTwitterMessageByUserid(item.Id);
                        objTwitterStatsRepository.DeleteTwitterStatsByUserid(item.Id);
                        objUserActivationRepository.DeleteUserActivationByUserid(item.Id);
                        objUserPackageRelationRepository.DeleteuserPackageRelationByUserid(item.Id);
                        objUserRepository.DeleteUserByUserid(item.Id);
                    }
                }
                catch (Exception ex)
                {

                    Console.WriteLine(ex.Message);
                }
            }
           return i +" "+count;
        }
Exemplo n.º 6
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User user = new User();
            UserRepository userrepo = new UserRepository();
            UserActivation objUserActivation = new UserActivation();
            Coupon objCoupon = new Coupon();
            CouponRepository objCouponRepository = new CouponRepository();
            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            try
            {

                if (DropDownList1.SelectedValue == "Basic" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium")
                {

                if (TextBox1.Text.Trim() != "")
                {
                    string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString();
                    if (resp != "valid")
                    {
                       // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert(Not valid);", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true);
                        return;
                    }
                }

                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    user.PaymentStatus = "unpaid";
                    //user.AccountType = Request.QueryString["type"];
                    user.AccountType = DropDownList1.SelectedValue.ToString();
                    if (string.IsNullOrEmpty(user.AccountType))
                    {
                        user.AccountType = AccountType.Free.ToString();
                    }
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id = Guid.NewGuid();
                    user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                    user.Password = this.MD5Hash(txtPassword.Text);
                    user.EmailId = txtEmail.Text;
                    user.UserStatus = 1;
                    user.ActivationStatus = "0";
                    if (TextBox1.Text.Trim() != "")
                    {
                        user.CouponCode = TextBox1.Text.Trim().ToString();
                    }

                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);

                        if (TextBox1.Text.Trim() != "")
                        {
                            objCoupon.CouponCode = TextBox1.Text.Trim();
                            List<Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon);
                            objCoupon.Id = lstCoupon[0].Id;
                            objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate;
                            objCoupon.ExpCouponDate = lstCoupon[0].ExpCouponDate;
                            objCoupon.Status = "1";
                            objCouponRepository.SetCouponById(objCoupon);
                        }

                        Session["LoggedUser"] = user;
                        objUserActivation.Id = Guid.NewGuid();
                        objUserActivation.UserId = user.Id;
                        objUserActivation.ActivationStatus = "0";
                        UserActivationRepository.Add(objUserActivation);

                        //add package start

                        UserPackageRelation objUserPackageRelation = new UserPackageRelation();
                        UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                        PackageRepository objPackageRepository = new PackageRepository();

                        Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                        objUserPackageRelation.Id = new Guid();
                        objUserPackageRelation.PackageId = objPackage.Id;
                        objUserPackageRelation.UserId = user.Id;
                        objUserPackageRelation.ModifiedDate = DateTime.Now;
                        objUserPackageRelation.PackageStatus = true;

                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                        //end package

                        SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(),user.Id.ToString());
                        TeamRepository teamRepo = new TeamRepository();
                        Team team = teamRepo.getTeamByEmailId(txtEmail.Text);
                        if (team != null)
                        {
                            Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                            teamRepo.updateTeamStatus(teamid);
                            TeamMemberProfileRepository teamMemRepo = new TeamMemberProfileRepository();
                            List<TeamMemberProfile> lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                            foreach (TeamMemberProfile item in lstteammember)
                            {
                                try
                                {
                                    SocialProfilesRepository socialRepo = new SocialProfilesRepository();
                                    SocialProfile socioprofile = new SocialProfile();
                                    socioprofile.Id = Guid.NewGuid();
                                    socioprofile.ProfileDate = DateTime.Now;
                                    socioprofile.ProfileId = item.ProfileId;
                                    socioprofile.ProfileType = item.ProfileType;
                                    socioprofile.UserId = user.Id;
                                    socialRepo.addNewProfileForUser(socioprofile);

                                    if (item.ProfileType == "facebook")
                                    {
                                        try
                                        {
                                            FacebookAccount fbAccount = new FacebookAccount();
                                            FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                            FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId);
                                            fbAccount.AccessToken = userAccount.AccessToken;
                                            fbAccount.EmailId = userAccount.EmailId;
                                            fbAccount.FbUserId = item.ProfileId;
                                            fbAccount.FbUserName = userAccount.FbUserName;
                                            fbAccount.Friends = userAccount.Friends;
                                            fbAccount.Id = Guid.NewGuid();
                                            fbAccount.IsActive = true;
                                            fbAccount.ProfileUrl = userAccount.ProfileUrl;
                                            fbAccount.Type = userAccount.Type;
                                            fbAccount.UserId = user.Id;
                                            fbAccountRepo.addFacebookUser(fbAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        try
                                        {
                                            TwitterAccount twtAccount = new TwitterAccount();
                                            TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                            TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId);
                                            twtAccount.FollowersCount = twtAcc.FollowersCount;
                                            twtAccount.FollowingCount = twtAcc.FollowingCount;
                                            twtAccount.Id = Guid.NewGuid();
                                            twtAccount.IsActive = true;
                                            twtAccount.OAuthSecret = twtAcc.OAuthSecret;
                                            twtAccount.OAuthToken = twtAcc.OAuthToken;
                                            twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl;
                                            twtAccount.ProfileUrl = twtAcc.ProfileUrl;
                                            twtAccount.TwitterName = twtAcc.TwitterName;
                                            twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                            twtAccount.TwitterUserId = twtAcc.TwitterUserId;
                                            twtAccount.UserId = user.Id;
                                            twtAccRepo.addTwitterkUser(twtAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "instagram")
                                    {
                                        try
                                        {

                                            InstagramAccount insAccount = new InstagramAccount();
                                            InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                            InstagramAccount InsAcc = insAccRepo.getInstagramAccountById(item.ProfileId);
                                            insAccount.AccessToken = InsAcc.AccessToken;
                                            insAccount.FollowedBy = InsAcc.FollowedBy;
                                            insAccount.Followers = InsAcc.Followers;
                                            insAccount.Id = Guid.NewGuid();
                                            insAccount.InstagramId = item.ProfileId;
                                            insAccount.InsUserName = InsAcc.InsUserName;
                                            insAccount.IsActive = true;
                                            insAccount.ProfileUrl = InsAcc.ProfileUrl;
                                            insAccount.TotalImages = InsAcc.TotalImages;
                                            insAccount.UserId = user.Id;
                                            insAccRepo.addInstagramUser(insAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "linkedin")
                                    {
                                        try
                                        {
                                            LinkedInAccount linkAccount = new LinkedInAccount();
                                            LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                            LinkedInAccount linkAcc = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                            linkAccount.Id = Guid.NewGuid();
                                            linkAccount.IsActive = true;
                                            linkAccount.LinkedinUserId = item.ProfileId;
                                            linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                            linkAccount.OAuthSecret = linkAcc.OAuthSecret;
                                            linkAccount.OAuthToken = linkAcc.OAuthToken;
                                            linkAccount.OAuthVerifier = linkAcc.OAuthVerifier;
                                            linkAccount.ProfileImageUrl = linkAcc.ProfileImageUrl;
                                            linkAccount.ProfileUrl = linkAcc.ProfileUrl;
                                            linkAccount.UserId = user.Id;
                                            linkedAccountRepo.addLinkedinUser(linkAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }

                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                }
                            }
                        }
                        lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                        Response.Redirect("~/Home.aspx");
                    }
                    else
                    {
                        lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>";
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
            }
            }

            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                lblerror.Text = "Please Insert Correct Information";
                Console.WriteLine(ex.StackTrace);
                //Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 7
0
        public void ProcessRequest()
        {
           TeamRepository objTeamRepository = new TeamRepository();
           TeamMemberProfileRepository objTeamMemberProfileRepository=new TeamMemberProfileRepository();
           FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository();
           TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
           LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository();
           InstagramAccountRepository instagramrepo = new InstagramAccountRepository();
           GroupProfileRepository groupprofilerepo = new GroupProfileRepository();
           BusinessSettingRepository objbsnsrepo = new BusinessSettingRepository();
           TumblrAccountRepository tumblrrepo = new TumblrAccountRepository();





            User user = (User)Session["LoggedUser"];
            if (Request.QueryString["op"] != null)
            {

                if (Request.QueryString["op"] == "SaveGroupName")
                {
                    string groupName = Request.QueryString["groupname"];
                    GroupRepository grouprepo = new GroupRepository();
                    Groups group = new Groups();
                    group.Id = Guid.NewGuid();
                    group.GroupName = groupName;
                    group.UserId = user.Id;
                    group.EntryDate = DateTime.Now;
                  
                    if (!grouprepo.checkGroupExists(user.Id, groupName))
                    {
                        
                        grouprepo.AddGroup(group);
                        Groups grou = grouprepo.getGroupDetails(user.Id, groupName);
                        Session["GroupName"] = grou;
                    }
                    else
                    {
                        Groups grou = grouprepo.getGroupDetails(user.Id, groupName);
                        Session["GroupName"] = grou;
                    }
                }
                else if (Request.QueryString["op"] == "bindGroupProfiles")
                {
                    string bindprofiles = string.Empty;
                    Guid groupid = Guid.Parse(Request.QueryString["groupId"]);
                    Session["GroupId"] = groupid;
                    GroupProfileRepository groupprofilesrepo = new GroupProfileRepository();
                    List<GroupProfile> lstgroupprofile = groupprofilesrepo.getAllGroupProfiles(user.Id, groupid);
                    foreach (GroupProfile item in lstgroupprofile)
                    {
                        if (item.ProfileType == "facebook")
                        {
                           
                            FacebookAccount account = fbaccountrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id);
                            if (account != null)
                            {
                                bindprofiles += "<div id=\"facebook_" + item.ProfileId + "\" class=\"ws_conct\"> <span class=\"img\"><img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\"><i><img width=\"16\" height=\"16\" src=\"../Contents/img/fb_icon.png\" alt=\"\"></i></span><div class=\"fourfifth\">" +
                                    "<div class=\"location-container\">" + account.FbUserName + "</div><span onclick=\"AddProfileInInviteTeamMember('" + account.FbUserId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }
                        else if (item.ProfileType == "twitter")
                        {
                            TwitterAccount twtaccount = twtaccountrepo.getUserInformation(user.Id, item.ProfileId);
                            string profileimgurl = string.Empty;
                            if (twtaccount != null)
                            {
                            if (twtaccount.ProfileImageUrl == string.Empty)
                            {
                                profileimgurl = "../../Contents/img/blank_img.png";
                            }
                            else
                            {
                                profileimgurl = twtaccount.ProfileImageUrl;
                            }
                          
                                bindprofiles +=
                                       "<div id=\"twitter_" + item.ProfileId + "\" class=\"ws_conct active\"> <span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"><i><img width=\"16\" height=\"16\" src=\"../Contents/img/twticon.png\" alt=\"\"></i></span><div class=\"fourfifth\">" +
                                       "<div class=\"location-container\">" + twtaccount.TwitterScreenName + "</div><span onclick=\"AddProfileInInviteTeamMember('" + twtaccount.TwitterUserId + "','"+groupid+"','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\"  class=\"add remove\">✖</span></div></div>";
                            }
                        }
                        else if (item.ProfileType == "linkedin")
                        {                            
                            LinkedInAccount linkedaccount = linkedaccrepo.getUserInformation(user.Id, item.ProfileId);
                            string profileimgurl = string.Empty;
                            if (linkedaccount != null)
                            {
                                if (linkedaccount.ProfileUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = linkedaccount.ProfileImageUrl;
                                }
                                bindprofiles += "<div id=\"linkedin_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" alt=\"\" src=\"" + profileimgurl + "\" ><i>" +
                                                 "<img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/link_icon.png\"></i></span>" +
                                                 "<div class=\"fourfifth\"><div class=\"location-container\">" + linkedaccount.LinkedinUserName + "</div>" +
                                                 "<span onclick=\"AddProfileInInviteTeamMember('" + linkedaccount.LinkedinUserId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }

                        else if (item.ProfileType == "tumblr")
                        {
                            TumblrAccount tumblraccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId,user.Id);
                            string profileimgurl = string.Empty;
                            if (tumblraccount != null)
                            {
                                if (tumblraccount.tblrProfilePicUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = "http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar"; 
                                }
                                bindprofiles += "<div id=\"tumblr_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" alt=\"\" src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" ><i>" +
                                                 "<img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/tumblr.png\"></i></span>" +
                                                 "<div class=\"fourfifth\"><div class=\"location-container\">" +tumblraccount.tblrUserName + "</div>" +
                                                 "<span onclick=\"AddProfileInInviteTeamMember('" + tumblraccount.tblrUserName + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }



                        else if (item.ProfileType == "instagram")
                        {
                            string profileimgurl = string.Empty;
                            
                            InstagramAccount instaaccount = instagramrepo.getInstagramAccountDetailsById(item.ProfileId, user.Id);
                            if (instaaccount != null)
                            {
                                if (instaaccount.ProfileUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = instaaccount.ProfileUrl;
                                }

                                bindprofiles += "<div id=\"instagram_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"><i>" +
                                                  "<img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/instagram_24X24.png\"></i></span><div class=\"fourfifth\"><div class=\"location-container\">" + instaaccount.InsUserName + "</div>" +
                                    "<span onclick=\"AddProfileInInviteTeamMember('" + instaaccount.InstagramId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }
                   }
                    Response.Write(bindprofiles);

                }
                else if (Request.QueryString["op"] == "deleteGroupName")
                {
                    Guid groupid = Guid.Parse(Request.QueryString["groupId"]);
                 
                    GroupRepository grouprepo = new GroupRepository();
                    grouprepo.DeleteGroup(groupid);                  
                    int count = groupprofilerepo.DeleteAllGroupProfile(groupid);
                    int cnt = objbsnsrepo.DeleteBusinessSettingByUserid(groupid);

                    List<Team> objTeamId = objTeamRepository.getAllDetailsUserEmail(groupid);
                    foreach (Team item in objTeamId)
                    {
                        int deteleTeamMember = objTeamMemberProfileRepository.deleteTeamMember(item.Id);
                        
                    }
                    int deleteTeam = objTeamRepository.deleteGroupRelatedTeam(groupid);

                }
                else if (Request.QueryString["op"] == "addProfilestoGroup")
                {
                    string network = Request.QueryString["network"];
                    string id = Request.QueryString["profileid"];
                    Guid groupid = (Guid)Session["GroupId"];
                    GroupProfile groupprofile = new GroupProfile();
                    groupprofile.EntryDate = DateTime.Now;
                    groupprofile.GroupId = groupid;
                    groupprofile.Id = Guid.NewGuid();
                    groupprofile.ProfileId = id;
                    groupprofile.ProfileType = network;
                    groupprofile.GroupOwnerId = user.Id;

                    GroupProfileRepository grouprepo = new GroupProfileRepository();

                    if (!grouprepo.checkGroupProfileExists(user.Id, groupid, id))
                    {
                        grouprepo.AddGroupProfile(groupprofile);
                    }

                    Response.Write(groupid);

                }
                else if (Request.QueryString["op"] == "deleteGroupProfiles")
                {
                    Guid groupid = (Guid)Session["GroupId"];
                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        GroupProfileRepository grouprepo = new GroupProfileRepository();
                        grouprepo.DeleteGroupProfile(user.Id, profileid, groupid);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    Response.Write(groupid);
                }

                if (Request.QueryString["op"] == "GetInviteMember")
                {
                    string bindprofiles = string.Empty;
                    string profileimgurl = string.Empty;

                    try
                    {
                        string gp = Request.QueryString["groupId"];
                        Guid GroupId = Guid.Parse(gp);
                       // TeamRepository objTeamRepository = new TeamRepository();
                        List<Team> objTeam = objTeamRepository.getAllDetailsUserEmail(GroupId);
                      
                        if (objTeam.Count != 0)
                        {
                            foreach (Team item in objTeam)
                            {
                                UserRepository objUserRepository = new UserRepository();
                                User ObjUserDetails = objUserRepository.getUserInfoByEmail(item.EmailId);
                                if (ObjUserDetails != null)
                                {
                                    if (string.IsNullOrEmpty(ObjUserDetails.ProfileUrl))
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = ObjUserDetails.ProfileUrl;
                                    }

                                    bindprofiles += "<div style=\"float:left; margin-right:18%\"id=\"" + item.Id + "\">" +
                                                 "<div style=\"float:left\"><span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></span>" +
                                                "</div><div style=\"float:left\" class=\"fourfifth\"><div style=\"font-size:small \">" + ObjUserDetails.UserName + "</div> </div><div style=\"float:left;margin-left:3px\" onclick=\"ShowInviteMemberProfileDetails('" + GroupId + "','" + ObjUserDetails.EmailId + "','" + user.Id + "')\"><input class=\"abc\" type=\"radio\" name=\"sex\" value=" + item.Id + "></div>" +
                                                "<span onclick=\"RemoveInviteMemberFromGroup('" + item.Id + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";

                                    //bindprofiles += "<div id=\"" + item.Id + "\" class=\"ws_conct active\"> <span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"><i><img width=\"16\" height=\"16\" src=\"../Contents/img/twticon.png\" alt=\"\"></i></span><div class=\"fourfifth\">" +
                                    //  "<div class=\"location-container\">" + ObjUserDetails.UserName + "</div><span class=\"add remove\" onclick=\"ShowInviteMemberProfileDetails('" + GroupId + "','" + ObjUserDetails.EmailId + "','" + user.Id + "')\"><input class=\"abc\" type=\"radio\" name=\"sex\" value=" + item.Id + "></span><span onclick=\"RemoveInviteMemberFromGroup('" + item.Id + "')\"  class=\"add remove\">✖</span></div></div>";
                                    
                                    
                                    
                                                                                                                                                                                                  
                                }
                            }
                        }

                        Response.Write(bindprofiles);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                }

                if (Request.QueryString["op"] == "RemoveInviteMemberFromGroup")
                {
                    if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
                    {
                        try
                        {
                            string ide = Request.QueryString["Id"];
                            Guid id = Guid.Parse(ide);
                            int deleteTeam = objTeamRepository.deleteinviteteamMember(id);
                            int deleteProfiles = objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamId(id);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);

                        }
                    }
                }

                //modified by hozefa 4-7-2014   
                if (Request.QueryString["op"] == "ShowInviteMemberProfileDetails")
                {
                    string bindprofiles = string.Empty;
                    string gpId = Request.QueryString["groupId"];
                    Guid gpid = Guid.Parse(gpId);
                    string emailId = Request.QueryString["emailid"];
                    string userId = Request.QueryString["userid"];

                    Team teamdata = objTeamRepository.getAllDetails(gpid, emailId);

                    List<TeamMemberProfile> objTeamMemProfile = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(teamdata.Id);
                    try
                    {
                        foreach (TeamMemberProfile item in objTeamMemProfile)
                        {
                            if (item.ProfileType == "facebook")
                            {

                                FacebookAccount account = fbaccountrepo.getFacebookAccountDetailsById(item.ProfileId);
                                if (account != null)
                                {
                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px;margin-top:6px\"  id=\"facebook_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                             "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/fb_icon.png\" alt=\"\"></img></i>" +
                                             "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + account.FbUserName + "</div></div>" +
                                              "<span  onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }
                            else if (item.ProfileType == "twitter")
                            {
                                TwitterAccount twtaccount = twtaccountrepo.getUserInformation(item.ProfileId);
                                string profileimgurl = string.Empty;
                                if (twtaccount != null)
                                {
                                    if (twtaccount.ProfileImageUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = twtaccount.ProfileImageUrl;
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left; width:170px;margin-top:6px\"   id=\"twitter_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                             "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/twticon.png\" alt=\"\"></img></i>" +
                                             "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + twtaccount.TwitterScreenName + "</div></div>" +
                                              "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }

                            else if (item.ProfileType == "linkedin")
                            {

                                LinkedInAccount linkedaccount = linkedaccrepo.getUserInformation(item.ProfileId);
                                string profileimgurl = string.Empty;
                                if (linkedaccount != null)
                                {
                                    if (linkedaccount.ProfileUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = linkedaccount.ProfileImageUrl;
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px;margin-top:6px\"   id=\"linkedin_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                              "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/link_icon.png\" alt=\"\"></img></i>" +
                                              "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + linkedaccount.LinkedinUserName + "</div></div>" +
                                               "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }

                            else if (item.ProfileType == "instagram")
                            {
                                string profileimgurl = string.Empty;

                                InstagramAccount instaaccount = instagramrepo.getInstagramAccountDetailsById(item.ProfileId);
                                if (instaaccount != null)
                                {
                                    if (instaaccount.ProfileUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = instaaccount.ProfileUrl;
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px; margin-top:6px\"   id=\"instagram_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                             "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\"></img></i>" +
                                             "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + instaaccount.InsUserName + "</div></div>" +
                                              "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }



                            else if (item.ProfileType == "tumblr")
                            {
                                string profileimgurl = string.Empty;

                                TumblrAccount tumblraccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId);
                                if (tumblraccount != null)
                                {
                                    if (tumblraccount.tblrProfilePicUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = "http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar";
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px; margin-top:6px\"   id=\"tumblr_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                             "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/tumblr.png\" alt=\"\"></img></i>" +
                                             "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" +tumblraccount.tblrUserName + "</div></div>" +
                                              "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }





                        }
                    }
                    catch (Exception ex)
                    {

                        Console.WriteLine(ex.StackTrace);
                    }

                    Response.Write(bindprofiles);

                }


                if (Request.QueryString["op"] == "RemoveInviteMemberProfileFromTeamMember")
                {
                    string profileId = Request.QueryString["ProfileId"];
                    Guid teamid = Guid.Parse(Request.QueryString["TeamId"]);
                    try
                    {
                        int deleteTeamMembeProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(profileId,teamid);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }                               
                }

                if (Request.QueryString["op"] == "AddProfileInInviteTeamMember")
                {
                    try
                    {
                        string EmailId = string.Empty;
                        string Result = string.Empty;
                        TeamMemberProfile objteam = new TeamMemberProfile();
                        objteam.ProfileId = Request.QueryString["Profileid"];
                        objteam.ProfileType = Request.QueryString["Profiletype"];
                        string GrpId = Request.QueryString["Groupid"];
                        Guid grpid = Guid.Parse(GrpId);

                        TeamRepository objTeamrepo = new TeamRepository();
                        Team team = new Team();
                        Guid id = Guid.NewGuid();
                        objteam.Id = id;
                        string teamid = Request.QueryString["Teamid"];
                        objteam.TeamId = Guid.Parse(teamid);
                        objteam.StatusUpdateDate = DateTime.Now;
                        objteam.Status = 0;
                        team = objTeamrepo.getAllDetailsByTeamID(objteam.TeamId, grpid);
                        EmailId = team.EmailId;
                        try
                        {
                            if (!objTeamMemberProfileRepository.checkTeamMemberProfile(objteam.TeamId, objteam.ProfileId))
                            {
                                objTeamMemberProfileRepository.addNewTeamMember(objteam);
                                Result = "Success";
                            }
                            else
                            {
                                //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Profile Already Added.');", true);
                                Result = "Fail";
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        Response.Write(Result + "_" + EmailId);
                    }
                    catch (Exception ex)
                    {

                        Console.WriteLine(ex.StackTrace);
                    }                  
                }                    
            }
        }
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User user = new User();
            UserRepository userrepo = new UserRepository();
            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            try
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {

                    user.PaymentStatus = "unpaid";
                    user.AccountType = Request.QueryString["type"];
                    if (user.AccountType == string.Empty)
                    {
                        user.AccountType = AccountType.Deluxe.ToString();
                    }
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id = Guid.NewGuid();
                    user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                    user.Password = this.MD5Hash(txtPassword.Text);
                    user.EmailId = txtEmail.Text;
                    user.UserStatus = 1;
                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);
                        SocialSuitePro.Helper.MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text);

                        TeamRepository teamRepo = new TeamRepository();
                        Team team = teamRepo.getTeamByEmailId(txtEmail.Text);
                        if (team != null)
                        {

                            Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                            teamRepo.updateTeamStatus(teamid);

                            TeamMemberProfileRepository teamMemRepo = new TeamMemberProfileRepository();
                            List<TeamMemberProfile> lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                            foreach (TeamMemberProfile item in lstteammember)
                            {
                                try
                                {
                                    SocialProfilesRepository socialRepo = new SocialProfilesRepository();
                                    SocialProfile socioprofile = new SocialProfile();
                                    socioprofile.Id = Guid.NewGuid();
                                    socioprofile.ProfileDate = DateTime.Now;
                                    socioprofile.ProfileId = item.ProfileId;
                                    socioprofile.ProfileType = item.ProfileType;
                                    socioprofile.UserId = user.Id;
                                    socialRepo.addNewProfileForUser(socioprofile);

                                    if (item.ProfileType == "facebook")
                                    {
                                        try
                                        {
                                            FacebookAccount fbAccount = new FacebookAccount();
                                            FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                            FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId);
                                            fbAccount.AccessToken = userAccount.AccessToken;
                                            fbAccount.EmailId = userAccount.EmailId;
                                            fbAccount.FbUserId = item.ProfileId;
                                            fbAccount.FbUserName = userAccount.FbUserName;
                                            fbAccount.Friends = userAccount.Friends;
                                            fbAccount.Id = Guid.NewGuid();
                                            fbAccount.IsActive = true;
                                            fbAccount.ProfileUrl = userAccount.ProfileUrl;
                                            fbAccount.Type = userAccount.Type;
                                            fbAccount.UserId = user.Id;
                                            fbAccountRepo.addFacebookUser(fbAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        try
                                        {
                                            TwitterAccount twtAccount = new TwitterAccount();
                                            TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                            TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId);
                                            twtAccount.FollowersCount = twtAcc.FollowersCount;
                                            twtAccount.FollowingCount = twtAcc.FollowingCount;
                                            twtAccount.Id = Guid.NewGuid();
                                            twtAccount.IsActive = true;
                                            twtAccount.OAuthSecret = twtAcc.OAuthSecret;
                                            twtAccount.OAuthToken = twtAcc.OAuthToken;
                                            twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl;
                                            twtAccount.ProfileUrl = twtAcc.ProfileUrl;
                                            twtAccount.TwitterName = twtAcc.TwitterName;
                                            twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                            twtAccount.TwitterUserId = twtAcc.TwitterUserId;
                                            twtAccount.UserId = user.Id;
                                            twtAccRepo.addTwitterkUser(twtAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "instagram")
                                    {
                                        try
                                        {

                                            InstagramAccount insAccount = new InstagramAccount();
                                            InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                            InstagramAccount InsAcc = insAccRepo.getInstagramAccountById(item.ProfileId);
                                            insAccount.AccessToken = InsAcc.AccessToken;
                                            insAccount.FollowedBy = InsAcc.FollowedBy;
                                            insAccount.Followers = InsAcc.Followers;
                                            insAccount.Id = Guid.NewGuid();
                                            insAccount.InstagramId = item.ProfileId;
                                            insAccount.InsUserName = InsAcc.InsUserName;
                                            insAccount.IsActive = true;
                                            insAccount.ProfileUrl = InsAcc.ProfileUrl;
                                            insAccount.TotalImages = InsAcc.TotalImages;
                                            insAccount.UserId = user.Id;
                                            insAccRepo.addInstagramUser(insAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "linkedin")
                                    {
                                        try
                                        {
                                            LinkedInAccount linkAccount = new LinkedInAccount();
                                            LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                            LinkedInAccount linkAcc = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                            linkAccount.Id = Guid.NewGuid();
                                            linkAccount.IsActive = true;
                                            linkAccount.LinkedinUserId = item.ProfileId;
                                            linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                            linkAccount.OAuthSecret = linkAcc.OAuthSecret;
                                            linkAccount.OAuthToken = linkAcc.OAuthToken;
                                            linkAccount.OAuthVerifier = linkAcc.OAuthVerifier;
                                            linkAccount.ProfileImageUrl = linkAcc.ProfileImageUrl;
                                            linkAccount.ProfileUrl = linkAcc.ProfileUrl;
                                            linkAccount.UserId = user.Id;
                                            linkedAccountRepo.addLinkedinUser(linkAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }

                                    }

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

                            }
                        }

                        lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                    }
                    else
                    {
                        lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>";
                    }
                }

            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                lblerror.Text = "Please Insert Correct Information";
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {


                UserRepository userrepo = new UserRepository();
                Registration regObject = new Registration();
                TeamRepository objTeamRepo = new TeamRepository();
                NewsRepository objNewsRepo = new NewsRepository();
                AdsRepository objAdsRepo = new AdsRepository();
                UserActivation objUserActivation = new UserActivation();
                UserActivationRepository objUserActivationRepository = new UserActivationRepository();
                SocialProfilesRepository objSocioRepo = new SocialProfilesRepository();
                SocioBoard.Domain.User user = (User)Session["LoggedUser"];
                Session["facebooktotalprofiles"] = null;



                if (user.Password == null)
                {

                    Response.Redirect("/Pricing.aspx");
                }



                #region Days remaining
                if (Session["days_remaining"] == null)
                {
                    if (user.PaymentStatus == "unpaid")
                    {
                        int daysremaining = (user.ExpiryDate.Date - DateTime.Now.Date).Days;
                        if (daysremaining < 0)
                        {
                            daysremaining = 0;
                        }
                        Session["days_remaining"] = daysremaining;
                        //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You are using '" + user.AccountType + "' account only '" + daysremaining + "' days is remaining !');", true);
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your trial " + user.AccountType + " account will expire in " + daysremaining + " days, please upgrade to paid plan.');", true);
                    }
                }

                #endregion



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

                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");
                    }
                }

                Session["GreaterThan30Days"] = null;
                #endregion

                if (!IsPostBack)
                {

                    try
                    {
                        if (user == null)
                        {

                            Response.Redirect("Default.aspx");
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);
                    }


                    try
                    {
                        objUserActivation = objUserActivationRepository.GetUserActivationStatus(user.Id.ToString());
                    }
                    catch (Exception ex)
                    {
                        Session["objUserActivationException"] = "objUserActivationException";

                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);


                    }



                    //#region check user Activation

                    //try
                    //{
                    //    if (objUserActivation != null)
                    //    {
                    //        if (objUserActivation.ActivationStatus == "0")
                    //        {
                    //            if (Request.QueryString["stat"] == "activate")
                    //            {
                    //                if (Request.QueryString["id"] != null)
                    //                {
                    //                    //objUserActivation = objUserActivationRepository.GetUserActivationStatusbyid(Request.QueryString["id"].ToString());
                    //                    if (objUserActivation.UserId.ToString() == Request.QueryString["id"].ToString())
                    //                    {
                    //                        objUserActivation.Id = objUserActivation.Id; //Guid.Parse(Request.QueryString["id"]);
                    //                        objUserActivation.UserId = Guid.Parse(Request.QueryString["id"]);// objUserActivation.UserId;
                    //                        objUserActivation.ActivationStatus = "1";
                    //                        UserActivationRepository.Update(objUserActivation);



                    //                    }
                    //                    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");
                    //            }


                    //        }
                    //    }
                    //}
                    //catch (Exception ex)
                    //{
                    //    Console.WriteLine(ex.Message);
                    //    logger.Error(ex.StackTrace);
                    //}
                    //#endregion



                    #region Count Used Accounts
                    try
                    {
                        if (user.AccountType.ToString().ToLower() == AccountType.Deluxe.ToString().ToLower())
                            tot_acc = 20;
                        else if (user.AccountType.ToString().ToLower() == AccountType.Standard.ToString().ToLower())
                            tot_acc = 10;
                        else if (user.AccountType.ToString().ToLower() == AccountType.Premium.ToString().ToLower())
                            tot_acc = 50;
                        else if (user.AccountType.ToString().ToLower() == AccountType.Free.ToString().ToLower())
                            tot_acc = 5;
                        profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;
                        Session["ProfileCount"] = profileCount;
                        Session["TotalAccount"] = tot_acc;
                        usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc;
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    #endregion




                    if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                    {
                        try
                        {
                            userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                            logger.Error(ex.StackTrace);
                        }
                    }

                    acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts";
                    teamMem.InnerHtml = "managing " + user.UserName;
                    try
                    {
                        News nws = objNewsRepo.getNewsForHome();
                        divNews.InnerHtml = nws.NewsDetail;
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    try
                    {
                        ArrayList lstads = objAdsRepo.getAdsForHome();
                        if (lstads.Count < 1)
                        {
                            if (user.PaymentStatus.ToUpper() == "PAID")
                            {

                                bindads.InnerHtml = "<img src=\"../Contents/img/admin/ads.png\"  alt=\"\" >";
                            }
                            else
                            {
                                #region ADS Script
                                bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" +
                                                    "<!-- socioboard -->" +
                                                     "<ins class=\"adsbygoogle\"" +
                                                      "style=\"display:inline-block;width:250px;height:250px\"" +
                                                        "data-ad-client=\"ca-pub-7073257741073458\"" +
                                                    "data-ad-slot=\"9533254693\"></ins>" +
                                                    "<script>" +
                                                "(adsbygoogle = window.adsbygoogle || []).push({});" +
                                                "</script>";
                                #endregion
                            }
                        }


                        foreach (var item in lstads)
                        {
                            Array temp = (Array)item;
                            //imgAds.ImageUrl = temp.GetValue(2).ToString();
                            if (user.PaymentStatus.ToUpper() == "PAID")
                            {

                                bindads.InnerHtml = "<img src=\"" + temp.GetValue(2).ToString() + "\"  alt=\"\" style=\"width:246px;height:331px\">";
                            }
                            else
                            {
                                #region ADS Script
                                bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" +
                                                    "<!-- socioboard -->" +
                                                     "<ins class=\"adsbygoogle\"" +
                                                      "style=\"display:inline-block;width:250px;height:250px\"" +
                                                        "data-ad-client=\"ca-pub-7073257741073458\"" +
                                                    "data-ad-slot=\"9533254693\"></ins>" +
                                                    "<script>" +
                                                "(adsbygoogle = window.adsbygoogle || []).push({});" +
                                                "</script>";
                                #endregion
                            }
                            break;
                            // ads.ImageUrl;
                        }



                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    #region Team Member Count
                    try
                    {

                        GroupRepository grouprepo = new GroupRepository();
                        string groupsofhome = string.Empty;
                        List<Groups> lstgroups = grouprepo.getAllGroups(user.Id);
                        if (lstgroups.Count != 0)
                        {
                            foreach (Groups item in lstgroups)
                            {
                                groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>";
                            }
                            getAllGroupsOnHome.InnerHtml = groupsofhome;
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    #endregion

                    try
                    {
                        string strTeam = string.Empty;
                        List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id);
                        foreach (Team item in team)
                        {
                            strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">" +
                                        "<img width=\"48\" height=\"48\" title=\"" + item.FirstName + "\" alt=\"\" src=\"../Contents/img/blank_img.png\">" +
                                        "</a></div>";
                        }
                        team_member.InnerHtml = strTeam;

                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                    }

                    #region Add Fan Page
                    try
                    {
                        if (Session["fbSocial"] != null)
                        {
                            if (Session["fbSocial"] == "p")
                            {
                                FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];

                                //    string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts";
                                // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"];
                                //    string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token);
                                //    JObject output = objWebRequest.FacebookRequest(strData, "Get");
                                FacebookClient fb = new FacebookClient();
                                fb.AccessToken = objFacebookAccount.AccessToken;
                                dynamic output = fb.Get("/me/accounts");
                                //  JArray data = (JArray)output["data"];
                                DataTable dtFbPage = new DataTable();
                                dtFbPage.Columns.Add("Email");
                                dtFbPage.Columns.Add("PageId");
                                dtFbPage.Columns.Add("PageName");
                                dtFbPage.Columns.Add("status");
                                dtFbPage.Columns.Add("customer_id");
                                string strPageDiv = string.Empty;
                                if (output != null)
                                {
                                    foreach (var item in output["data"])
                                    {
                                        if (item.category.ToString() != "Application")
                                        {
                                            strPageDiv += "<div><a id=\"A1\"  onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>";
                                            fbpage.InnerHtml = strPageDiv;
                                        }
                                    }
                                }
                                else
                                {
                                    strPageDiv += "<div>No Pages Found</div>";
                                }
                                Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true);
                                Session["fbSocial"] = null;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);
                    }
                    #endregion

                    #region InsightsData
                    try
                    {
                        decimal malecount = 0, femalecount = 0, cnt = 0;

                        FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository();
                        double daysSub = (DateTime.Now - user.CreateDate).TotalDays;
                        int userdays = (int)daysSub;
                        ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays);
                        Random rNum = new Random();
                        foreach (var item in arrFbStats)
                        {
                            Array temp = (Array)item;
                            cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString());
                            malecount += int.Parse(temp.GetValue(3).ToString());
                            femalecount += int.Parse(temp.GetValue(4).ToString());
                        }
                        try
                        {
                            decimal mc = (malecount / cnt) * 100;
                            male = Convert.ToInt16(mc);
                        }
                        catch (Exception Err)
                        {
                            Console.Write(Err.StackTrace);
                            logger.Error(Err.StackTrace);
                        }
                        try
                        {
                            decimal fc = (femalecount / cnt) * 100;
                            female = Convert.ToInt16(fc);
                        }
                        catch (Exception Err)
                        {
                            Console.Write(Err.StackTrace);
                            logger.Error(Err.StackTrace);
                        }
                        int twtAccCount = objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count;
                        if (twtAccCount > 1)
                        {
                            twtmale = rNum.Next(100);
                            twtfemale = 100 - twtmale;
                        }
                        else if (twtAccCount == 1)
                        {
                            twtmale = 100;
                            twtfemale = 0;
                        }
                        Session["twtGender"] = twtmale + "," + twtfemale;
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.Message.ToString());
                        logger.Error(Err.StackTrace);
                    }
                    getgrphData();
                    getNewFriends(7);
                    getNewFollowers(7);
                    #endregion



                    #region IncomingMessages
                    try
                    {
                        FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                        int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id);
                        TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository();
                        int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id);
                        Session["CountMessages"] = fbmessagescout + twtcount;

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    #endregion


                }
            }
            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }
        }
Exemplo n.º 10
0
        void ProcessRequest()
        {
            User user = (User)Session["LoggedUser"];
            if (Request.QueryString["op"] != null)
            {
                if (Request.QueryString["op"] == "bindMessages")
                {
                     DataSet ds = null;
                    if (Session["MessageDataTable"] == null)
                    {
                        clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages();
                        ds = clsfeedsandmess.bindMessagesIntoDataTable(user);
                        Session["MessageDataTable"] = ds;

                    }
                    else
                    {
                        ds = (DataSet)Session["MessageDataTable"];
                    }
                        string message = this.BindData(ds.Tables[0]);
                    Response.Write(message);

                }
                else if (Request.QueryString["op"] == "bindProfiles")
                {

                    string profiles = string.Empty;
                    int i = 0;
                    profiles += "<ul class=\"options_list\">";

                    /*Binding facebook profiles in Accordian*/
                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                    ArrayList alstfacebookprofiles = facerepo.getAllFacebookAccountsOfUser(user.Id);
                    foreach (FacebookAccount item in alstfacebookprofiles)
                    {
                        profiles += "<li><a id=\"greencheck_" + i + "\" ><span class=\"network_icon\">" +
                                    "<img src=\"../Contents/Images/fb_icon.png\" width=\"17\" height=\"16\" alt=\"\" /></span>" +
                                 "<span id=\"profileusername_" + i + "\" class=\"user_name\">" + item.FbUserName + "</span><input type=\"hidden\" id=\"fbhidden_" + i + "\" value=\"" + item.FbUserId + "\" /> <span id=\"checkid_" + i + "\" class=\"checkbx_green\">" +
                                     "<img id=\"checkimg_" + i + "\" src=\"../Contents/Images/msg/network_click.png\" width=\"17\" height=\"17\" alt=\"\" onclick=\"checkprofile(this.id,'message','facebook');\" /></span>" +
                             "</a></li> ";
                        i++;
                    }

                    /*Binding TwitterProfiles in Accordian*/
                    TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                    ArrayList alsttwt = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                    foreach (TwitterAccount item in alsttwt)
                    {
                         profiles += "<li><a id=\"greencheck_" + i + "\" ><span class=\"network_icon\">" +
                                      "<img src=\"../Contents/Images/msg/network_twt.png\" width=\"17\" height=\"16\" alt=\"\" /></span>" +
                                   "<span id=\"profileusername_" + i + "\" class=\"user_name\">" + item.TwitterScreenName + "</span> <span id=\"checkid_" + i + "\" class=\"checkbx_green\"><input type=\"hidden\" id=\"twthidden_" + i + "\" value=\"" + item.TwitterUserId+ "\">" +
                                       "<img id=\"checkimg_" + i + "\" src=\"../Contents/Images/msg/network_click.png\" width=\"17\" height=\"17\" alt=\"\"  onclick=\"checkprofile(this.id,'message','twitter');\"/></span>" +
                               "</a></li> ";
                         i++;
                    }

                    profiles += "</ul><input type=\"hidden\" id=\"profilecounter\" value=\"" + i + "\">";
                    Response.Write(profiles);
                }
                else if (Request.QueryString["op"] == "savetask")
                {
                    string descritption = Request.QueryString["description"];
                    Guid idtoassign = Guid.Empty;
                    try
                    {
                        if (Request.QueryString["memberid"] != string.Empty)
                        {
                            idtoassign = Guid.Parse(Request.QueryString["memberid"].ToString());
                        }
                    }
                    catch
                    {
                       // idtoassign = 0;
                    }
                    Tasks objTask = new Tasks();
                    TaskRepository objTaskRepo = new TaskRepository();
                    objTask.AssignDate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                    objTask.AssignTaskTo = idtoassign;
                    objTask.TaskStatus = false;
                    objTask.TaskMessage = descritption;
                    objTask.UserId = user.Id;
                    Guid taskid = Guid.NewGuid();
                    objTask.Id = taskid;
                    objTaskRepo.addTask(objTask);

                    /////////////////
                    string comment = Request.QueryString["comment"];
                    if (!string.IsNullOrEmpty(comment))
                    {
                        string curdate = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString();
                        TaskComment objcmt = new TaskComment();
                        TaskCommentRepository objcmtRepo = new TaskCommentRepository();
                        objcmt.Comment = comment;
                        objcmt.CommentDate = DateTime.Now;
                        objcmt.EntryDate = DateTime.Now;
                        objcmt.Id = Guid.NewGuid();
                        objcmt.TaskId = objTask.Id;
                        objcmt.UserId = user.Id;
                        objcmtRepo.addTaskComment(objcmt);
                    }

                }
                else if (Request.QueryString["op"] == "bindteam")
                {
                    TeamRepository objTeam = new TeamRepository();
                    string message = string.Empty;
                    message += "<ul>";
                    IEnumerable<dynamic> result = objTeam.getAllTeamsOfUser(user.Id);

                    if (result != null)
                    {
                        foreach (Team item in result)
                        {
                            message += "<li><a><img src=\"../Contents/Images/blank_img.png\" alt=\"\" />" +
                                            "<span class=\"name\">" +
                                                item.FirstName + " " + item.LastName+
                                            "</span>" +
                                         " <span>" +
                                         "<input id=\"customerid_" + item.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + item.Id + "\">" +
                                         "</span>" +
                                        "</a></li>";
                        }
                        message += "<li><a><img src=\"../Contents/Images/blank_img.png\" alt=\"\" />" +
                                        "<span class=\"name\">" +
                                           user.UserName +
                                        "</span>" +
                                     " <span>" +
                                     "<input id=\"customerid_" + user.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + user.Id + "\">" +
                                     "</span>" +
                                    "</a></li>";

                    }
                    else
                    {
                        message += "<li><a><img src=\"../Contents/Images/blank_img.png\" alt=\"\" />" +
                                         "<span class=\"name\">" +
                                            user.UserName +
                                         "</span>" +
                                      " <span>" +
                                      "<input id=\"customerid_" + user.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + user.Id + "\">" +
                                      "</span>" +
                                     "</a></li>";

                    }
                    message += "</ul>";
                    Response.Write(message);
                }
            }
        }
Exemplo n.º 11
0
        protected void groupsselection_SelectedIndexChanged(object sender, EventArgs e)
        {
            SocioBoard.Domain.User user = (User)Session["LoggedUser"];
            string GroupNames = string.Empty;         
            TeamRepository objTeamRepository = new TeamRepository();
            Team lstDetails = objTeamRepository.getAllGroupsDetails(user.EmailId.ToString(), Guid.Parse(groupsselection.SelectedValue),user.Id);

            Session["GroupName"] = lstDetails;
            Session["groupcheck"] = groupsselection.SelectedValue;
            NewMethod(user);
        }
Exemplo n.º 12
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);

                }



            }
        }
Exemplo n.º 13
0
        private void NewMethod(User user)
        {
            SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];

            TeamRepository objTeamRepository = new TeamRepository();
            GroupRepository objGroupRepository = new GroupRepository();
            RssFeedsRepository rssFeedsRepo = new RssFeedsRepository();
            List<RssFeeds> lstrssfeeds = rssFeedsRepo.getAllActiveRssFeeds(user.Id);
            TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository();
            ArrayList arrTwtAcc = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id);
          

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

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

            if (lstrssfeeds != null)
            {
                if (lstrssfeeds.Count != 0)
                {
                    //int rssCount = 0;
                    string rssData = string.Empty;
                    rssData += "<h2 class=\"league section-ttl rss_header\">Active RSS Feeds</h2>";
                    foreach (RssFeeds item in lstrssfeeds)
                    {
                        TwitterAccount twtAccount = twtAccountRepo.getUserInformation(item.ProfileScreenName, user.Id);
                        string picurl = string.Empty;


                        if (string.IsNullOrEmpty(twtAccount.ProfileUrl))
                        {
                            picurl = "../Contents/img/blank_img.png";

                        }
                        else
                        {
                            picurl = twtAccount.ProfileUrl;

                        }
                        rssData += " <section id=\"" + item.Id + "\" class=\"publishing\">" +
                                "<section class=\"twothird\">" +
                                    "<article class=\"quarter\">" +
                                        "<div href=\"#\" class=\"avatar_link view_profile\" title=\"\">" +
                                            "<img title=\"" + item.ProfileScreenName + "\" src=\"" + picurl + "\" data-src=\"\" class=\"avatar sm\">" +
                                            "<article class=\"rss_ava_icon\"><span title=\"Twitter\" class=\"icon twitter_16\"></span></article>" +
                                        "</div>" +
                                    "</article>" +
                                    "<article class=\"threefourth\">" +
                                        "<ul>" +
                                            "<li>" + item.FeedUrl + "</li>" +
                                            "<li>Prefix: </li>" +
                                            "<li class=\"freq\" title=\"New items from this feed will be posted at most once every hour\">Max Frequency: " + item.Duration + "</li>" +
                                        "</ul>" +
                                    "</article>" +
                                "</section>" +
                                "<section class=\"third\">" +
                                    "<ul class=\"rss_action_buttons\">" +
                                        "<li onclick=\"pauseFunction('" + item.Id + "');\" class=\"\"><a id=\"pause_" + item.Id + "\" href=\"#\" title=\"Pause\" class=\"small_pause icon pause\"></a></li>" +
                                        "<li onclick=\"deleteRssFunction('" + item.Id + "');\" class=\"show-on-hover\"><a id=\"delete_" + item.Id + "\" href=\"#\" title=\"Delete\" class=\"small_remove icon delete\"></a></li>" +
                                    "</ul>" +
                                "</section>" +
                             "</section>";
                    }


                    rss.InnerHtml = rssData;
                    rss.Style.Add("display", "block");
                    rdata.Style.Add("display", "none");

                }
            }
            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;
                }
            }
            catch (Exception es)
            {
                logger.Error(es.StackTrace);
                Console.WriteLine(es.StackTrace);
            }
            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";
            }
            //usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a>";
            usernm.InnerHtml = "Hello, " + user.UserName + "";
            //usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a>";


            usernm.InnerHtml = "Hello, " + user.UserName + "";
            //usernm.InnerHtml = "Hello, <a href=\"../Settings/PersonalSettings.aspx\"> " + user.UserName + "</a>";
            if (!string.IsNullOrEmpty(user.ProfileUrl))
            {

                //userimg.InnerHtml = "<a href=\"../Settings/PersonalSettings.aspx\"><img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\"/></a>";
                userimg.InnerHtml = "<img id=\"loggeduserimg\" src=\"" + user.ProfileUrl + "\" alt=\"" + user.UserName + "\"/>";
                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
            {
                //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 + "\"/>";
                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.getAllGroups(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;
                }

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

        }
Exemplo n.º 14
0
        protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            User user = (User)Session["LoggedUser"];
            SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];
            if (CheckBox1.Checked)
            {
                if (chkincomplete.Checked == true)
                {
                    chkincomplete.Checked = false;
                    CheckBox1.Checked = true;
                }

                if (rdbtnmytask.Checked == true)
                    rdbtnmytask.Checked = false;

                if (rdbtnteamtask.Checked == true)
                    rdbtnteamtask.Checked = false;

              
                string path = "";
                string strbind = string.Empty;
                taskdiv.InnerHtml = "";
                int i = 0;
                string preaddedcomment = "";

                if (string.IsNullOrEmpty(user.ProfileUrl))
                {
                    path = "../Contents/img/blank_img.png";
                }
                else
                {
                    path = user.ProfileUrl;
                }

                //taskdata = taskrepo.getAllCompleteTasksOfUser(custid, custid);
                taskdata = taskrepo.getAllCompleteTasksOfUser(custid, team.GroupId,custid);
                //foreach (Tasks item in taskrepo.getAllCompleteTasksOfUsers(custid))
                //{
                //    taskdata.Add(item);
                //}
                foreach (Tasks item in taskrepo.getAllCompleteTasksOfUsers(custid,team.GroupId))
                {
                    taskdata.Add(item);
                }
                TaskCommentRepository objTaskCmtRepo = new TaskCommentRepository();
                TeamRepository objTeam = new TeamRepository();
                foreach (Tasks item in taskdata)
                {
                    if (item.TaskStatus == true)
                    {
                        TaskStatus = "Completed";

                    }
                    else
                    {
                        TaskStatus = "Pending";
                    }



                    User objdetails = objUserRepository.getUsersById(item.AssignTaskTo);
                    string strAssignedTo = objdetails.UserName;
                    User objdetail = objUserRepository.getUsersById(item.UserId);
                    string strAssignedBy = objdetail.UserName;
                    imgpath = path;
                    i++;

                    if (user.Id == objdetail.Id)
                    {
                        strbind += "<section class=\"section\" id=\"Section" + item.Id + "\"><div class=\"js-task-cont read\">" +
                                    "<span id=\"taskcomment\" class=\"ficon task_active\">" +
                                              "<img  onclick=\"getmemberdata('" + item.Id + "');\" src=\"../Contents/img/task_pin.png\" width=\"14\" height=\"17\" alt=\"\" /></span>" +
                                   "<section class=\"task-activity third\"><p>" + strAssignedTo + "</p><div>" + item.AssignDate + "</div><input type=\"hidden\" id=\"hdntaskid_" + i + "\" value=" + item.Id + " />" +
                                          "<p>Assigned by " + strAssignedBy + "</p></section>" +
                                    "<section class=\"task-owner\">" +
                                           "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=" + path + " />" +
                                           "</section><section class=\"task-message font-13 third\"><a class=\"tip_left\">" + item.TaskMessage + "</a>" +
                                          "</section><section class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                            "<b>" + TaskStatus + "</b><span class=\"ui-sproutmenu-status\">" +
                                              "<img id=\"img_" + item.Id + "_" + item.TaskStatus + "\" class=\"edit_button\" src=\"../Contents/img/icon_edit.png\" onclick=\"PerformClick(this.id)\" title=\"Edit Status\" />" +
                                              "</span></a></div></section></div>" +
                                              "</section>";
                    }

                    else
                    {
                        strbind += "<section class=\"section\" id=\"Section" + item.Id + "\"><div class=\"js-task-cont read\">" +
                                    "<span id=\"taskcomment\" class=\"ficon task_active\">" +
                                              "<img  onclick=\"getmemberdata('" + item.Id + "');\" src=\"../Contents/img/task_pin.png\" width=\"14\" height=\"17\" alt=\"\" /></span>" +
                                   "<section class=\"task-activity third\"><p>" + strAssignedTo + "</p><div>" + item.AssignDate + "</div><input type=\"hidden\" id=\"hdntaskid_" + i + "\" value=" + item.Id + " />" +
                                          "<p>Assigned by " + strAssignedBy + "</p></section>" +
                                    "<section class=\"task-owner\">" +
                                           "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=" + path + " />" +
                                           "</section><section class=\"task-message font-13 third\"><a class=\"tip_left\">" + item.TaskMessage + "</a>" +
                                          "</section><section class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                            "<b>" + TaskStatus + "</b><span class=\"ui-sproutmenu-status\">" +                            
                                              "</span></a></div></section></div>" +
                                              "</section>";
                    }


                    ArrayList pretask = objTaskCmtRepo.getAllTasksCommentOfUser(item.Id);
                    if (pretask != null)
                    {
                        preaddedcomment += "<div id=" + item.Id + " style=\"display:none\" >";
                        foreach (TaskComment items in pretask)
                        {
                            User details = objUserRepository.getUsersById(items.UserId);
                            string strAssigned = details.UserName;

                            
                            preaddedcomment += "<div id=\"task_comment_" + item.Id + "_" + items.Id + "\" class=\"assign_comments\" >" +
                                            "<section><article class=\"task_assign\">" +
                                            "<img src=" + imgpath + " width=\"30\" height=\"30\" alt=\"\"  />  " +
                                                "<article><input id=\"hdncommentsid\" type=\"hidden\" value=" + items.Id + " /><p class=\"msg_article\">" + items.Comment + "</p>" +
                                                    "<aside class=\"days_ago\"> By " + strAssigned + " at " + items.CommentDate + "</aside>" +
                                                "</article></article></section></div>";
                        }

                        preaddedcomment += "</div>";
                    }


                }

                if (string.IsNullOrEmpty(strbind))
                {
                    strbind = "Sorry no data !";
                }
                taskdiv.InnerHtml = strbind;
                prevComments.InnerHtml = preaddedcomment;
            }
            else
            {
                try
                {
                    bindTeamTask();
                }
                catch (Exception ex)
                {

                    logger.Error(ex.Message);
                }
            }
        }
Exemplo n.º 15
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                User user = new User();
                UserRepository userrepo = new UserRepository();
                UserActivation objUserActivation = new UserActivation();
                Coupon objCoupon = new Coupon();
                CouponRepository objCouponRepository = new CouponRepository();
                Groups groups = new Groups();
                GroupRepository objGroupRepository = new GroupRepository();
                Team teams = new Team();
                TeamRepository objTeamRepository = new TeamRepository();
           

                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                try
                {


                    if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium" || DropDownList1.SelectedValue == "SocioBasic" || DropDownList1.SelectedValue == "SocioStandard" || DropDownList1.SelectedValue == "SocioPremium" || DropDownList1.SelectedValue == "SocioDeluxe")

                   
                    {



                        if (TextBox1.Text.Trim() != "")
                        {
                            string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString();
                            if (resp != "valid")
                            {
                               
                                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true);
                                return;
                            }
                        }




                        if (txtPassword.Text == txtConfirmPassword.Text)
                        {



                            user.PaymentStatus = "unpaid";
                            user.AccountType = DropDownList1.SelectedValue.ToString();
                            if (string.IsNullOrEmpty(user.AccountType))
                            {
                                user.AccountType = AccountType.Free.ToString();
                            }


                            user.CreateDate = DateTime.Now;
                            user.ExpiryDate = DateTime.Now.AddDays(30);
                            user.Id = Guid.NewGuid();
                            user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                            user.Password = this.MD5Hash(txtPassword.Text);
                            user.EmailId = txtEmail.Text;
                            user.UserStatus = 1;
                            user.ActivationStatus = "0";
                                                     
                            if (TextBox1.Text.Trim() != "")
                            {
                                user.CouponCode = TextBox1.Text.Trim().ToString();
                            }


                            if (!userrepo.IsUserExist(user.EmailId))
                            {
                                logger.Error("Before User reg");
                                UserRepository.Add(user);

                               

                                try
                                {
                                    groups.Id = Guid.NewGuid();
                                    groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
                                    groups.UserId = user.Id;
                                    groups.EntryDate = DateTime.Now;
                                    
                                    objGroupRepository.AddGroup(groups);


                                    teams.Id = Guid.NewGuid();
                                    teams.GroupId = groups.Id;
                                    teams.UserId = user.Id;
                                    teams.EmailId = user.EmailId;
                                  
                                    objTeamRepository.addNewTeam(teams);



                                    BusinessSettingRepository busnrepo = new BusinessSettingRepository();
                               
                                    SocioBoard.Domain.BusinessSetting objbsnssetting = new SocioBoard.Domain.BusinessSetting();

                                    if (!busnrepo.checkBusinessExists(user.Id, groups.GroupName))
                                    {
                                        objbsnssetting.Id = Guid.NewGuid();
                                        objbsnssetting.BusinessName = groups.GroupName;
                                        objbsnssetting.GroupId = groups.Id;
                                        objbsnssetting.AssigningTasks = false;
                                        objbsnssetting.AssigningTasks = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.FbPhotoUpload = 0;
                                        objbsnssetting.UserId = user.Id;
                                        objbsnssetting.EntryDate = DateTime.Now;
                                        busnrepo.AddBusinessSetting(objbsnssetting);

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


                                try
                                {
                                    logger.Error("1 Request.QueryString[refid]");
                                    if (Request.QueryString["refid"] != null)
                                    {
                                        logger.Error("3 Request.QueryString[refid]");
                                        User UserValid = null;
                                        if (IsUserValid(Request.QueryString["refid"].ToString(), ref UserValid))
                                        {
                                           
                                            logger.Error("Inside IsUserValid");
                                            user.RefereeStatus = "1";
                                            UpdateUserReference(UserValid);
                                            AddUserRefreeRelation(user, UserValid);
                                          
                                            logger.Error("IsUserValid");
                                        }
                                        else
                                        {
                                            user.RefereeStatus = "0";
                                        }
                                    }
                                    logger.Error("2 Request.QueryString[refid]");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("btnRegister_Click" + ex.Message);
                                    logger.Error("btnRegister_Click" + ex.StackTrace);
                                }
                              


                                if (TextBox1.Text.Trim() != "")
                                {
                                    objCoupon.CouponCode = TextBox1.Text.Trim();
                                    List<Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon);
                                    objCoupon.Id = lstCoupon[0].Id;
                                    objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate;
                                    objCoupon.ExpCouponDate = lstCoupon[0].ExpCouponDate;
                                    objCoupon.Status = "1";
                                    objCouponRepository.SetCouponById(objCoupon);
                                }

                                Session["LoggedUser"] = user;
                                objUserActivation.Id = Guid.NewGuid();
                                objUserActivation.UserId = user.Id;
                                objUserActivation.ActivationStatus = "0";
                                UserActivationRepository.Add(objUserActivation);

                                //add package start

                                UserPackageRelation objUserPackageRelation = new UserPackageRelation();
                                UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                                PackageRepository objPackageRepository = new PackageRepository();

                                try
                                {
                                    Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                                    objUserPackageRelation.Id = Guid.NewGuid();
                                    objUserPackageRelation.PackageId = objPackage.Id;
                                    objUserPackageRelation.UserId = user.Id;
                                    objUserPackageRelation.ModifiedDate = DateTime.Now;
                                    objUserPackageRelation.PackageStatus = true;

                                    objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }

                                //end package

                                SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());
                                TeamRepository teamRepo = new TeamRepository();
                                try
                                {
                                    Team team = teamRepo.getTeamByEmailId(txtEmail.Text);
                                    if (team != null)
                                    {
                                        Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                                        teamRepo.updateTeamStatus(teamid);
                                        TeamMemberProfileRepository teamMemRepo = new TeamMemberProfileRepository();
                                        List<TeamMemberProfile> lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                                        foreach (TeamMemberProfile item in lstteammember)
                                        {
                                            try
                                            {
                                                SocialProfilesRepository socialRepo = new SocialProfilesRepository();
                                                SocialProfile socioprofile = new SocialProfile();
                                                socioprofile.Id = Guid.NewGuid();
                                                socioprofile.ProfileDate = DateTime.Now;
                                                socioprofile.ProfileId = item.ProfileId;
                                                socioprofile.ProfileType = item.ProfileType;
                                                socioprofile.UserId = user.Id;
                                                socialRepo.addNewProfileForUser(socioprofile);

                                                if (item.ProfileType == "facebook")
                                                {
                                                    try
                                                    {
                                                        FacebookAccount fbAccount = new FacebookAccount();
                                                        FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                                        FacebookAccount userAccount = fbAccountRepo.getUserDetails(item.ProfileId);
                                                        fbAccount.AccessToken = userAccount.AccessToken;
                                                        fbAccount.EmailId = userAccount.EmailId;
                                                        fbAccount.FbUserId = item.ProfileId;
                                                        fbAccount.FbUserName = userAccount.FbUserName;
                                                        fbAccount.Friends = userAccount.Friends;
                                                        fbAccount.Id = Guid.NewGuid();
                                                        fbAccount.IsActive = 1;
                                                        fbAccount.ProfileUrl = userAccount.ProfileUrl;
                                                        fbAccount.Type = userAccount.Type;
                                                        fbAccount.UserId = user.Id;
                                                        fbAccountRepo.addFacebookUser(fbAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "twitter")
                                                {
                                                    try
                                                    {
                                                        TwitterAccount twtAccount = new TwitterAccount();
                                                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                                        TwitterAccount twtAcc = twtAccRepo.getUserInfo(item.ProfileId);
                                                        twtAccount.FollowersCount = twtAcc.FollowersCount;
                                                        twtAccount.FollowingCount = twtAcc.FollowingCount;
                                                        twtAccount.Id = Guid.NewGuid();
                                                        twtAccount.IsActive = true;
                                                        twtAccount.OAuthSecret = twtAcc.OAuthSecret;
                                                        twtAccount.OAuthToken = twtAcc.OAuthToken;
                                                        twtAccount.ProfileImageUrl = twtAcc.ProfileImageUrl;
                                                        twtAccount.ProfileUrl = twtAcc.ProfileUrl;
                                                        twtAccount.TwitterName = twtAcc.TwitterName;
                                                        twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                                        twtAccount.TwitterUserId = twtAcc.TwitterUserId;
                                                        twtAccount.UserId = user.Id;
                                                        twtAccRepo.addTwitterkUser(twtAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "instagram")
                                                {
                                                    try
                                                    {

                                                        InstagramAccount insAccount = new InstagramAccount();
                                                        InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                                        InstagramAccount InsAcc = insAccRepo.getInstagramAccountById(item.ProfileId);
                                                        insAccount.AccessToken = InsAcc.AccessToken;
                                                        insAccount.FollowedBy = InsAcc.FollowedBy;
                                                        insAccount.Followers = InsAcc.Followers;
                                                        insAccount.Id = Guid.NewGuid();
                                                        insAccount.InstagramId = item.ProfileId;
                                                        insAccount.InsUserName = InsAcc.InsUserName;
                                                        insAccount.IsActive = true;
                                                        insAccount.ProfileUrl = InsAcc.ProfileUrl;
                                                        insAccount.TotalImages = InsAcc.TotalImages;
                                                        insAccount.UserId = user.Id;
                                                        insAccRepo.addInstagramUser(insAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "linkedin")
                                                {
                                                    try
                                                    {
                                                        LinkedInAccount linkAccount = new LinkedInAccount();
                                                        LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                                        LinkedInAccount linkAcc = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                                        linkAccount.Id = Guid.NewGuid();
                                                        linkAccount.IsActive = true;
                                                        linkAccount.LinkedinUserId = item.ProfileId;
                                                        linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                                        linkAccount.OAuthSecret = linkAcc.OAuthSecret;
                                                        linkAccount.OAuthToken = linkAcc.OAuthToken;
                                                        linkAccount.OAuthVerifier = linkAcc.OAuthVerifier;
                                                        linkAccount.ProfileImageUrl = linkAcc.ProfileImageUrl;
                                                        linkAccount.ProfileUrl = linkAcc.ProfileUrl;
                                                        linkAccount.UserId = user.Id;
                                                        linkedAccountRepo.addLinkedinUser(linkAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }

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

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }

                                #region SetInvitationStatusAfterSuccessfulRegistration
                                try
                                {
                                    if (Request.QueryString["refid"] != null)
                                    {
                                        string refid = Request.QueryString["refid"];

                                        int res = SetInvitationStatusAfterSuccessfulRegistration(refid, txtEmail.Text);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                } 
                                #endregion


                                try
                                {
                                    lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                                    Response.Redirect("~/Home.aspx");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            else
                            {
                                lblerror.Text = "Email Already Exists " + "<a id=\"loginlink\"  href=\"#\">login</a>";
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
                    }
                }

                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    lblerror.Text = "Success!";
                    Console.WriteLine(ex.StackTrace);
                    //Response.Redirect("Home.aspx");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);

                Console.WriteLine(ex.StackTrace);
                //Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

                UserRefRelationRepository objUserRefRelationRepository=new UserRefRelationRepository ();
                UserRepository userrepo = new UserRepository();
                Registration regObject = new Registration();
                TeamRepository objTeamRepo = new TeamRepository();
                NewsRepository objNewsRepo = new NewsRepository();
                AdsRepository objAdsRepo = new AdsRepository();
                UserActivation objUserActivation = new UserActivation();
                UserActivationRepository objUserActivationRepository = new UserActivationRepository();
                SocialProfilesRepository objSocioRepo = new SocialProfilesRepository();
                GroupRepository objGroupRepository = new GroupRepository();
                TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                Team team;

                SocioBoard.Domain.User user = (User)Session["LoggedUser"];

                if (Session["GroupName"] == null)
                {
                    Groups objGroupDetails = objGroupRepository.getGroupDetail(user.Id);
                    team = objTeamRepo.getAllDetails(objGroupDetails.Id, user.EmailId);
                    Session["GroupName"] = team;
                }

                else
                {
                    team = (SocioBoard.Domain.Team)Session["GroupName"];
                }

                Session["facebooktotalprofiles"] = null;

                if (user.Password == null)
                {
                    Response.Redirect("/Pricing.aspx");
                }

                #region Days remaining
                if (Session["days_remaining"] == null )
                {
                    if (user.PaymentStatus == "unpaid" && user.AccountType!="Free")
                    {
                        int daysremaining = (user.ExpiryDate.Date - DateTime.Now.Date).Days;
                        if (daysremaining < 0)
                        {
                            daysremaining = -1;
                        }
                        Session["days_remaining"] = daysremaining;
                        //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You are using '" + user.AccountType + "' account only '" + daysremaining + "' days is remaining !');", true);
                        if (daysremaining <= -1)
                        {
                        }
                        else if (daysremaining == 0)
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your trial " + user.AccountType + " account will expire end of the day, please upgrade to paid plan.');", true);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your trial " + user.AccountType + " account will expire in " + daysremaining + " days, please upgrade to paid plan.');", true);
                        }
                    }
                }

                #endregion

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

                if (user.PaymentStatus.ToLower() == "unpaid" && user.AccountType != "Free")
                {
                    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");
                    }
                }

                Session["GreaterThan30Days"] = null;
                #endregion

                if (!IsPostBack)
                {
                   try
                    {
                        if (user == null)
                        {

                            Response.Redirect("Default.aspx");
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);
                    }

                    try
                    {
                        objUserActivation = objUserActivationRepository.GetUserActivationStatus(user.Id.ToString());
                    }
                    catch (Exception ex)
                    {
                        Session["objUserActivationException"] = "objUserActivationException";

                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);

                    }

                    #region Count Used Accounts
                    try
                    {
                        if (user.AccountType.ToString().ToLower() == AccountType.Deluxe.ToString().ToLower())
                            tot_acc = 50;
                        else if (user.AccountType.ToString().ToLower() == AccountType.Standard.ToString().ToLower())
                            tot_acc = 10;
                        else if (user.AccountType.ToString().ToLower() == AccountType.Premium.ToString().ToLower())
                            tot_acc = 20;
                        else if (user.AccountType.ToString().ToLower() == AccountType.Free.ToString().ToLower())
                            tot_acc = 5;
                        profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;
                        Session["ProfileCount"] = profileCount;
                        Session["TotalAccount"] = tot_acc;

                        try
                        {

                            Groups lstDetail = objGroupRepository.getGroupName(team.GroupId);
                            if (lstDetail.GroupName == "Socioboard")
                            {
                                usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc;
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    #endregion

                    try
                    {
                        Groups lstDetails = objGroupRepository.getGroupName(team.GroupId);
                        if (lstDetails.GroupName != "Socioboard")
                        {
                            expander.Attributes.CssStyle.Add("display", "none");
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                    //this is used to check whether facebok account Already Exist
                    if (Session["alreadyexist"] != null)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Profile is Already Added please add aother Account!');", true);
                        Session["alreadyexist"] = null;
                    }
                      if ( Session["alreadypageexist"] != null)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Page is Already Added please add aother Page!');", true);
                        Session["alreadypageexist"] = null;
                    }

                    if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                    {
                        try
                        {
                            userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                            logger.Error(ex.StackTrace);
                        }
                    }

                    //acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts";
                    teamMem.InnerHtml = "managing " + user.UserName;
                    try
                    {
                        News nws = objNewsRepo.getNewsForHome();
                        //divNews.InnerHtml = nws.NewsDetail;
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    try
                    {
                        ArrayList lstads = objAdsRepo.getAdsForHome();
                        if (lstads.Count < 1)
                        {
                            if (user.PaymentStatus.ToUpper() == "PAID")
                            {

                                bindads.InnerHtml = "<img src=\"../Contents/img/admin/ads.png\"  alt=\"\" >";
                            }
                            else
                            {
                                #region ADS Script
                                bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" +
                                                    "<!-- socioboard -->" +
                                                     "<ins class=\"adsbygoogle\"" +
                                                      "style=\"display:inline-block;width:250px;height:250px\"" +
                                                        "data-ad-client=\"ca-pub-7073257741073458\"" +
                                                    "data-ad-slot=\"9533254693\"></ins>" +
                                                    "<script>" +
                                                "(adsbygoogle = window.adsbygoogle || []).push({});" +
                                                "</script>";
                                #endregion
                            }
                        }

                        foreach (var item in lstads)
                        {
                            Array temp = (Array)item;
                            //imgAds.ImageUrl = temp.GetValue(2).ToString();
                            if (user.PaymentStatus.ToUpper() == "PAID")
                            {

                                bindads.InnerHtml = "<img src=\"" + temp.GetValue(2).ToString() + "\"  alt=\"\" style=\"width:246px;height:331px\">";
                            }
                            else
                            {
                                #region ADS Script
                                bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" +
                                                    "<!-- socioboard -->" +
                                                     "<ins class=\"adsbygoogle\"" +
                                                      "style=\"display:inline-block;width:250px;height:250px\"" +
                                                        "data-ad-client=\"ca-pub-7073257741073458\"" +
                                                    "data-ad-slot=\"9533254693\"></ins>" +
                                                    "<script>" +
                                                "(adsbygoogle = window.adsbygoogle || []).push({});" +
                                                "</script>";
                                #endregion
                            }
                            break;
                            // ads.ImageUrl;
                        }

                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    #region Team Member Count
                    try
                    {

                        GroupRepository grouprepo = new GroupRepository();
                        string groupsofhome = string.Empty;
                        List<Groups> lstgroups = grouprepo.getAllGroups(user.Id);
                        if (lstgroups.Count != 0)
                        {
                            foreach (Groups item in lstgroups)
                            {
                                groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>";
                            }
                            getAllGroupsOnHome.InnerHtml = groupsofhome;
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    #endregion

                    try
                    {
                        string strTeam = string.Empty;
                        List<Team> teams = objTeamRepo.getAllTeamsOfUser(user.Id,team.GroupId,user.EmailId);
                        foreach (Team item in teams)
                        {
                            strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">" +
                                        "<img width=\"48\" height=\"48\" title=\"" + item.FirstName + "\" alt=\"\" src=\"../Contents/img/blank_img.png\">" +
                                        "</a></div>";
                        }
                        team_member.InnerHtml = strTeam;

                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                    }

                    #region Add Fan Page
                    try
                    {
                        if (Session["fbSocial"] != null)
                        {
                            if (Session["fbSocial"] == "p")
                            {
                                FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];

                                //    string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts";
                                // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"];
                                //    string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token);
                                //    JObject output = objWebRequest.FacebookRequest(strData, "Get");
                                FacebookClient fb = new FacebookClient();
                                fb.AccessToken = objFacebookAccount.AccessToken;
                                dynamic output = fb.Get("/me/accounts");
                                //  JArray data = (JArray)output["data"];
                                DataTable dtFbPage = new DataTable();
                                dtFbPage.Columns.Add("Email");
                                dtFbPage.Columns.Add("PageId");
                                dtFbPage.Columns.Add("PageName");
                                dtFbPage.Columns.Add("status");
                                dtFbPage.Columns.Add("customer_id");
                                string strPageDiv = string.Empty;
                                if (output != null)
                                {
                                    foreach (var item in output["data"])
                                    {
                                        if (item.category.ToString() != "Application")
                                        {
                                            strPageDiv += "<div><a id=\"A1\"  onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>";
                                            fbpage.InnerHtml = strPageDiv;
                                        }
                                    }
                                }
                                else
                                {
                                    strPageDiv += "<div>No Pages Found</div>";
                                }
                                Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true);
                                Session["fbSocial"] = null;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        logger.Error(ex.StackTrace);
                    }
                    #endregion

                    #region InsightsData
                    try
                    {
                        decimal malecount = 0, femalecount = 0, cnt = 0;

                        FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository();
                        double daysSub = (DateTime.Now - user.CreateDate).TotalDays;

                        int userdays;
                        if (daysSub > 0 && daysSub <= 1)
                        {
                            userdays = 1;
                        }
                        else
                        {
                            userdays = (int)daysSub;
                        }
                        ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays);
                        //ArrayList arrFbStats = objfbStatsRepo.getTotalFacebookStatsOfUser(user.Id);

                        Random rNum = new Random();
                        foreach (var item in arrFbStats)
                        {
                            Array temp = (Array)item;
                            cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString());
                            malecount += int.Parse(temp.GetValue(3).ToString());
                            femalecount += int.Parse(temp.GetValue(4).ToString());
                        }
                        try
                        {
                            decimal mc = (malecount / cnt) * 100;
                            male = Convert.ToInt16(mc);
                        }
                        catch (Exception Err)
                        {
                            Console.Write(Err.StackTrace);
                            logger.Error(Err.StackTrace);
                        }
                        try
                        {
                            decimal fc = (femalecount / cnt) * 100;
                            female = Convert.ToInt16(fc);
                        }
                        catch (Exception Err)
                        {
                            Console.Write(Err.StackTrace);
                            logger.Error(Err.StackTrace);
                        }
                        int twtAccCount = objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count;
                        if (twtAccCount > 1)
                        {
                            twtmale = rNum.Next(100);
                            twtfemale = 100 - twtmale;
                        }
                        else if (twtAccCount == 1)
                        {
                            twtmale = 100;
                            twtfemale = 0;
                        }
                        Session["twtGender"] = twtmale + "," + twtfemale;
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.Message.ToString());
                        logger.Error(Err.StackTrace);
                    }
                    //getgrphData();
                    // getNewFriends(7);
                  //  getNewFriends();
                  //  getNewFollowers();
                    #endregion

                    #region GetFollower

            try
            {
                String TwtProfileId = string.Empty;

                TwitterStatsRepository objtwtStatsRepo = new TwitterStatsRepository();

                List<TeamMemberProfile> objTeamMemberProfile = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id);
                foreach (TeamMemberProfile item in objTeamMemberProfile)
                {
                    TwtProfileId += item.ProfileId + ',';

                }
                TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1);

                List<TwitterStats> arrTwtStats = objtwtStatsRepo.getAllAccountDetail(TwtProfileId);

                //strTwtArray = "[";
                int NewTweet_Count = 0;
                string TotalFollower = string.Empty;
                foreach (TwitterStats item in arrTwtStats)
                {
                    NewTweet_Count += item.FollowerCount;
                }
                if (NewTweet_Count >= 100000)
                {
                    TotalFollower = (System.Math.Round(((float)NewTweet_Count / 1000000), 2)) + "M";
                }
                else if (NewTweet_Count > 1000 && NewTweet_Count < 100000)
                { TotalFollower = (System.Math.Round(((float)NewTweet_Count / 1000), 2)) + "K"; }
                else
                {
                    TotalFollower = NewTweet_Count.ToString();
                }

                spanNewTweets.InnerHtml = TotalFollower;
            }
            catch (Exception Err)
            {
                Console.Write(Err.Message.ToString());
                logger.Error(Err.StackTrace);
            }

                    #endregion

            #region GetFacebookFanPage

            try
            {
                String FbProfileId = string.Empty;

               FacebookStatsRepository objFacebookStatsRepository = new FacebookStatsRepository();

               List<TeamMemberProfile> objTeamMemberProfile = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id);
                foreach (TeamMemberProfile item in objTeamMemberProfile)
                {
                    FbProfileId += item.ProfileId + ',';

                }
                FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1);

                List<FacebookStats> arrFbStats = objFacebookStatsRepository.getAllAccountDetail(FbProfileId);

                //strTwtArray = "[";
                int NewFbFan_Count = 0;
                string TotalFriends = string.Empty;
                foreach (FacebookStats item in arrFbStats)
                {
                    NewFbFan_Count += item.FanCount;
                }
                if (NewFbFan_Count >= 100000)
                {
                    TotalFriends = (System.Math.Round(((float)NewFbFan_Count / 1000000), 2)) + "M";
                }
                else if (NewFbFan_Count > 1000 && NewFbFan_Count < 100000)
                { TotalFriends = (System.Math.Round(((float)NewFbFan_Count / 1000), 2)) + "K"; }
                else
                {
                    TotalFriends = NewFbFan_Count.ToString();
                }

                spanFbFans.InnerHtml = TotalFriends;

            }
            catch (Exception Err)
            {
                Console.Write(Err.Message.ToString());
                logger.Error(Err.StackTrace);
            }

            #endregion

            #region IncomingMessages
            try
                    {
                        FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                        int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id);
                        TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository();
                        int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id);
                        Session["CountMessages"] = fbmessagescout + twtcount;

                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    #endregion

            #region NewIncomingMessage

            try
            {
                String FbProfileId = string.Empty;
                String TwtProfileId = string.Empty;
                List<TeamMemberProfile> objTeamMemberProfile = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);
                foreach (TeamMemberProfile item in objTeamMemberProfile)
                {
                    try
                    {
                        if (item.ProfileType == "facebook")
                        {
                            FbProfileId += item.ProfileId + ',';
                        }

                        else if (item.ProfileType == "twitter")
                        {
                            TwtProfileId += item.ProfileId + ',';
                        }
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }

                }

                try
                {
                    FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1);

                    TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1);
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                List<FacebookFeed> alstfb = objFacebookFeedRepository.getAllFeedDetail(FbProfileId);
             // FacebookMessageRepository objFacebookMessageRepository = new FacebookMessageRepository();
                TwitterMessageRepository objtwttatsRepo = new TwitterMessageRepository();
             // List<FacebookMessage> alstfb = objFacebookMessageRepository.getAllMessageDetail(FbProfileId);
                List<TwitterMessage> alstTwt = objtwttatsRepo.getAlltwtMessages(TwtProfileId);

              int TotalFbMsgCount = 0;
              int TotalTwtMsgCount = 0;

              try
              {
                   TotalFbMsgCount = alstfb.Count;
                   TotalTwtMsgCount = alstTwt.Count;
              }
              catch (Exception Err)
              {
                  Console.Write(Err.StackTrace);
                  logger.Error(Err.StackTrace);
              }
             spanIncoming.InnerHtml = (TotalFbMsgCount+TotalTwtMsgCount).ToString();

             string profileid = string.Empty;
              ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
              foreach (TeamMemberProfile item in objTeamMemberProfile)
              {
                  profileid += item.ProfileId + ',';
              }

              profileid = profileid.Substring(0, profileid.Length - 1);

              spanSent.InnerHtml = objScheduledMessageRepository.getAllSentMessageDetails(profileid).Count().ToString();

                }

            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
                logger.Error(Err.StackTrace);
            }

            }

               #endregion

             }

            catch (Exception Err)
            {
                Console.Write(Err.StackTrace);
            }
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserRepository userrepo = new UserRepository();
            Registration regObject = new Registration();
            TeamRepository objTeamRepo = new TeamRepository();
            NewsRepository objNewsRepo = new NewsRepository();
            AdsRepository objAdsRepo = new AdsRepository();
            UserActivation objUserActivation=new UserActivation ();
            UserActivationRepository objUserActivationRepository=new UserActivationRepository ();

            SocialProfilesRepository objSocioRepo = new SocialProfilesRepository();
            SocioBoard.Domain.User user = (User)Session["LoggedUser"];
            Session["facebooktotalprofiles"] = null;

            if (!IsPostBack)
            {

                try
                {
                    if (user == null)
                    {
                        Response.Redirect("Default.aspx");
                    }

                    if (Request.QueryString["paymentTransaction"] == "Success")
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Paypall Success", "alert('Your transaction has been Suceeded !');", true);
                    }

                    if (Request.QueryString["paymentTransaction"] == "Cancel")
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Paypall Cancel", "<script type=\"text/javascript\">alert('Your transaction has been cancel !');</script>", true);
                    }

                    if (Request.QueryString["paymentTransaction"] == "Failed")
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Paypall Failed", "alert('Your transaction has been failed !');", true);
                    }

                    #region check user Activation
                    try
                    {
                        objUserActivation = objUserActivationRepository.GetUserActivationStatus(user.Id.ToString());
                        if (objUserActivation.ActivationStatus == "0")
                        {
                            if (Request.QueryString["stat"] == "activate")
                            {
                               // if (Request.QueryString["id"] != null)
                                {
                                    //objUserActivation = objUserActivationRepository.GetUserActivationStatusbyid(Request.QueryString["id"].ToString());
                                   // if (objUserActivation.Id.ToString() == Request.QueryString["id"].ToString())
                                    {
                                        objUserActivation.Id = objUserActivation.Id;//Guid.Parse(Request.QueryString["id"]);
                                        objUserActivation.UserId = objUserActivation.UserId;
                                        objUserActivation.ActivationStatus = "1";
                                        UserActivationRepository.Update(objUserActivation);
                                    }
                                    //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");
                            }

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

                    #region day count
                    chkdate = user.CreateDate;
                    DateTime curDate = DateTime.Now;
                    TimeSpan ts = curDate - chkdate;
                    datediff = ts.TotalDays;

                    if (datediff > 30)
                    {
                        Response.Redirect("Settings/Billing.aspx");
                    }
                    #endregion
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }

                #region Count Used Accounts
                try
                {
                    if (user.AccountType.ToString().ToUpper() == "SMALL BUSINESS".ToUpper())
                        tot_acc = 25;
                    else if (user.AccountType.ToString().ToUpper() == "CORPORATION".ToUpper())
                        tot_acc = 60;
                    else if (user.AccountType.ToString().ToUpper() == "INDIVIDUAL".ToUpper())
                        tot_acc = 10;
                    profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;
                    Session["ProfileCount"] = profileCount;
                    Session["TotalAccount"] = tot_acc;
                    usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

                if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                {
                    try
                    {
                        userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        logger.Error(ex.StackTrace);
                    }
                }

                acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts";
                teamMem.InnerHtml = "managing " + user.UserName;
                try
                {
                    News nws = objNewsRepo.getNewsForHome();
                    divNews.InnerHtml = nws.NewsDetail;
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                try
                {
                    ArrayList lstads = objAdsRepo.getAdsForHome();
                    foreach (var item in lstads)
                    {
                        Array temp = (Array)item;
                        imgAds.ImageUrl = temp.GetValue(2).ToString();
                        break;
                        // ads.ImageUrl;
                    }
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                #region Team Member Count
                try
                {

                    GroupRepository grouprepo = new GroupRepository();
                    string groupsofhome = string.Empty;
                    List<Groups> lstgroups = grouprepo.getAllGroups(user.Id);
                    if (lstgroups.Count != 0)
                    {
                        foreach (Groups item in lstgroups)
                        {
                            groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>";
                        }
                        getAllGroupsOnHome.InnerHtml = groupsofhome;
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

                try
                {
                    string strTeam = string.Empty;
                    List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id);
                    foreach (Team item in team)
                    {
                        strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">" +
                                    "<img width=\"48\" height=\"48\" title=\"" + item.FirstName + "\" alt=\"\" src=\"../Contents/img/blank_img.png\">" +
                                    "</a></div>";
                    }
                    team_member.InnerHtml = strTeam;

                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                }

                #region Add Fan Page
                try
                {
                    if (Session["fbSocial"] != null)
                    {
                        if (Session["fbSocial"] == "p")
                        {
                            FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];

                            //    string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts";
                            // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"];
                            //    string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token);
                            //    JObject output = objWebRequest.FacebookRequest(strData, "Get");
                            FacebookClient fb = new FacebookClient();
                            fb.AccessToken = objFacebookAccount.AccessToken;
                            dynamic output = fb.Get("/me/accounts");
                            //  JArray data = (JArray)output["data"];
                            DataTable dtFbPage = new DataTable();
                            dtFbPage.Columns.Add("Email");
                            dtFbPage.Columns.Add("PageId");
                            dtFbPage.Columns.Add("PageName");
                            dtFbPage.Columns.Add("status");
                            dtFbPage.Columns.Add("customer_id");
                            string strPageDiv = string.Empty;
                            if (output != null)
                            {
                                foreach (var item in output["data"])
                                {
                                    if (item.category.ToString() != "Application")
                                    {
                                        strPageDiv += "<div><a id=\"A1\"  onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>";
                                        fbpage.InnerHtml = strPageDiv;
                                    }
                                }
                            }
                            else
                            {
                                strPageDiv += "<div>No Pages Found</div>";
                            }
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true);
                            Session["fbSocial"] = null;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }
                #endregion

                #region InsightsData
                try
                {
                    decimal malecount = 0, femalecount = 0, cnt = 0;

                    FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository();
                    double daysSub = (DateTime.Now - user.CreateDate).TotalDays;
                    int userdays = (int)daysSub;
                    ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays);
                    Random rNum = new Random();
                    foreach (var item in arrFbStats)
                    {
                        Array temp = (Array)item;
                        cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString());
                        malecount += int.Parse(temp.GetValue(3).ToString());
                        femalecount += int.Parse(temp.GetValue(4).ToString());
                    }
                    try
                    {
                        decimal mc = (malecount / cnt) * 100;
                        male = Convert.ToInt16(mc);
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    try
                    {
                        decimal fc = (femalecount / cnt) * 100;
                        female = Convert.ToInt16(fc);
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    int twtAccCount = objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count;
                    if (twtAccCount > 1)
                    {
                        twtmale = rNum.Next(100);
                        twtfemale = 100 - twtmale;
                    }
                    else if (twtAccCount == 1)
                    {
                        twtmale = 100;
                        twtfemale = 0;
                    }
                    Session["twtGender"] = twtmale + "," + twtfemale;
                }
                catch (Exception Err)
                {
                    Console.Write(Err.Message.ToString());
                    logger.Error(Err.StackTrace);
                }
                getgrphData();
                getNewFriends(7);
                getNewFollowers(7);
                #endregion

                #region IncomingMessages
                try
                {
                    FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                    int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id);
                    TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository();
                    int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id);
                    Session["CountMessages"] = fbmessagescout + twtcount;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

            }
        }
Exemplo n.º 18
0
        protected void btnSendInvite_Click(object sender, EventArgs e)
        {
            int totalchkboxes = Convert.ToInt32(totalaccountscheck.InnerHtml.ToString());
            string[] totalchkboxesArray = new string[totalchkboxes];
            int jj = 0;
            for (int i = 0; i < totalchkboxes; i++)
            {
                if (Page.Request.Form["chkbox_"+i+""] != null)
                {
                    totalchkboxesArray[jj] = Page.Request.Form["chkbox_" + i + ""].ToString();
                    jj++;
                }
            }

            if (!string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtFirstName.Text) && !string.IsNullOrEmpty(txtLastName.Text))
            {
                if (txtEmail.Text != "Enter Email Address" && txtFirstName.Text != "First Name" && txtLastName.Text != "Last Name")
                {
                    if (rbAdmin.Checked || rbUser.Checked)
                    {
                        if (AccessLevel != string.Empty)
                        {
                            TeamRepository teamrepo = new TeamRepository();
                            Team team = new Team();
                            User user = (User)Session["LoggedUser"];
                            team.Id = Guid.NewGuid();
                            team.FirstName = txtFirstName.Text;
                            team.LastName = txtLastName.Text;
                            team.StatusUpdateDate = DateTime.Now;
                            team.UserId = user.Id;
                            team.InviteStatus = 1;
                            team.InviteDate = DateTime.Now;
                            team.AccessLevel = AccessLevel;
                            team.EmailId = txtEmail.Text;

                            if (!teamrepo.checkTeamExists(team.EmailId, team.UserId))
                            {
                                teamrepo.addNewTeam(team);
                            }

                            /*mailsection**/

                            if (totalchkboxesArray.Count() != 0)
                            {
                                TeamMemberProfileRepository teammemberprofilerepo = new TeamMemberProfileRepository();
                                foreach (var item in totalchkboxesArray)
                                {
                                    string[] itemarray = item.Split('_');
                                    TeamMemberProfile teammember = new TeamMemberProfile();
                                    teammember.Id = Guid.NewGuid();
                                    teammember.ProfileId = itemarray[1];
                                    teammember.ProfileType = itemarray[0];
                                    teammember.Status = 1;
                                    teammember.StatusUpdateDate = DateTime.Now;
                                    teammember.TeamId = team.Id;
                                    if (!teammemberprofilerepo.checkTeamMemberProfile(teammember.TeamId, teammember.ProfileId))
                                    {
                                        teammemberprofilerepo.addNewTeamMember(teammember);
                                    }
                                    else
                                    {
                                        teammemberprofilerepo.updateTeamMember(teammember);
                                    }
                                }

                            }

                        }
                        else
                        {

                        }
                    }
                }
            }
        }
Exemplo n.º 19
0
        protected void btnSendInvite_Click(object sender, EventArgs e)
        {
            try
            {
                int totalchkboxes = Convert.ToInt32(totalaccountscheck.InnerHtml.ToString());
                string[] totalchkboxesArray = new string[totalchkboxes];

                int jj = 0;
                for (int i = 0; i < totalchkboxes; i++)
                {
                    if (Page.Request.Form["chkbox_" + i + ""] != null)
                    {
                        totalchkboxesArray[jj] = Page.Request.Form["chkbox_" + i + ""].ToString();
                        jj++;
                    }
                }

                if (jj > 0)
                {
                    if (!string.IsNullOrEmpty(txtEmail.Text) && !string.IsNullOrEmpty(txtFirstName.Text) && !string.IsNullOrEmpty(txtLastName.Text))
                    {
                        if (txtEmail.Text != "Enter Email Address" && txtFirstName.Text != "First Name" && txtLastName.Text != "Last Name")
                        {
                            if (rbAdmin.Checked || rbUser.Checked)
                            {
                                if (rbAdmin.Checked)
                                {
                                    AccessLevel = "admin";
                                }
                                else if (rbUser.Checked)
                                {
                                    AccessLevel = "user";
                                }

                                if (AccessLevel != string.Empty)
                                {
                                    TeamRepository teamrepo = new TeamRepository();
                                    Team team = null;
                                    User user = (User)Session["LoggedUser"];
                                    if (!teamrepo.checkTeamExists(txtEmail.Text, user.Id))
                                    {
                                        team = new Team();
                                        team.Id = Guid.NewGuid();
                                        team.FirstName = txtFirstName.Text;
                                        team.LastName = txtLastName.Text;
                                        team.StatusUpdateDate = DateTime.Now;
                                        team.EmailId = txtEmail.Text;
                                        team.UserId = user.Id;
                                        team.InviteStatus = 1;
                                        team.InviteDate = DateTime.Now;
                                        team.AccessLevel = AccessLevel;
                                        teamrepo.addNewTeam(team);
                                    }
                                    else
                                    {
                                        team = teamrepo.getMemberByEmailId(user.Id, txtEmail.Text);
                                    }
                                    MailSender.SendInvitationEmail(team.FirstName + " " + team.LastName, user.UserName, team.EmailId, team.Id);
                                    if (totalchkboxesArray.Count() != 0)
                                    {
                                        TeamMemberProfileRepository teammemberprofilerepo = new TeamMemberProfileRepository();
                                        foreach (var item in totalchkboxesArray)
                                        {
                                            try
                                            {
                                                if (!string.IsNullOrEmpty(item))
                                                {
                                                    string[] itemarray = item.Split('_');
                                                    TeamMemberProfile teammember = new TeamMemberProfile();
                                                    teammember.Id = Guid.NewGuid();
                                                    teammember.ProfileId = itemarray[1];
                                                    teammember.ProfileType = itemarray[0];
                                                    teammember.Status = 1;
                                                    teammember.StatusUpdateDate = DateTime.Now;
                                                    teammember.TeamId = team.Id;
                                                    if (!teammemberprofilerepo.checkTeamMemberProfile(teammember.TeamId, teammember.ProfileId))
                                                    {
                                                        teammemberprofilerepo.addNewTeamMember(teammember);
                                                    }
                                                    else
                                                    {
                                                        teammemberprofilerepo.updateTeamMember(teammember);
                                                    }
                                                }

                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine(ex.StackTrace);
                                            }
                                        }
                                        Response.Redirect("InviteMember.aspx");
                                    }
                                    txtFirstName.Text = "";
                                    txtLastName.Text = "";
                                    txtEmail.Text = "";
                                    rbAdmin.Checked = false;
                                    rbUser.Checked = false;
                                    Label1.Text = "Invitation Sends";
                                }

                            }
                        }
                    }

                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyFun1", "disp_confirm();", true);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 20
0
        public void ProcessRequest()
        {
            //experimental code selected index changed of dropdown
            if (!string.IsNullOrEmpty(Request.QueryString["groupsselection"]))
            {
                SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];

                string selectedValue = Request.QueryString["groupsselection"];

                TeamRepository objTeamRepository = new TeamRepository();
                Team lstDetails = objTeamRepository.getAllGroupsDetails(user.EmailId.ToString(), Guid.Parse(selectedValue),user.Id);

                Session["GroupName"] = lstDetails;
                Session["groupcheck"] = selectedValue;

                SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];

                Response.Write(selectedValue);

                return;
            }

            SocialProfilesRepository socio = new SocialProfilesRepository();
            List<SocialProfile> alstsocioprofiles = new List<SocialProfile>();
            TeamRepository objTeamRepo = new TeamRepository();

            if (!string.IsNullOrEmpty(Request.QueryString["op"]))
            {

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

                TeamRepository objTeamRepository = new TeamRepository();
                TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                GroupRepository objGroupRepository = new GroupRepository();

                if (Request.QueryString["op"] == "social_connectivity")
                {
                    List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);

                    string profiles = string.Empty;
                    profiles += "<ul class=\"rsidebar-profile\">";
                    foreach (TeamMemberProfile item in allprofiles)
                    {
                        try
                        {
                            if (item.ProfileType == "facebook")
                            {
                                try
                                {
                                    FacebookAccountRepository facerepo = new FacebookAccountRepository();
                                    FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(item.ProfileId);

                                    if (faceaccount != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','" + faceaccount.Type + "','fb');\"></div><a href=\"http://www.facebook.com/" + faceaccount.FbUserId + "\" target=\"_blank\"><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\""+ faceaccount.FbUserName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }
                            else if (item.ProfileType == "youtube")
                            {
                                try
                                {
                                    YoutubeAccountRepository facerepo = new YoutubeAccountRepository();
                                    YoutubeAccount youtube = facerepo.getYoutubeAccountDetailsById(item.ProfileId);

                                    if (youtube != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','youtube','youtube');\"></div><a href=\"https://plus.google.com/" + youtube.Ytuserid + "\" target=\"_blank\"><img src=\"" + youtube.Ytprofileimage + " height=\"48\" width=\"48\" alt=\"\" title=\"" + youtube.Ytusername + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/youtube.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }
                            else if (item.ProfileType == "tumblr")
                            {
                                try
                                {

                                    TumblrAccountRepository tumbrepo = new TumblrAccountRepository();
                                    TumblrAccount tumblraccount = tumbrepo.getTumblrAccountDetailsById(item.ProfileId);

                                    if (tumblraccount != null)
                                    {
                                        //if (tumblraccount!=null)
                                        //{
                                        //    profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','tumblr','tumblr')\"></div><a href=\"http://twitter.com/" + tumblraccount.tblrUserName + "\" target=\"_blank\"><img src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" height=\"48\" width=\"48\" alt=\"\" title=\"" + tumblraccount.tblrUserName + "\" /></a>" +
                                        //                "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                        //}
                                        //else
                                        //{
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','tumblr','tumblr')\"></div><a href=\"http://" + tumblraccount.tblrUserName + ".tumblr.com\"  target=\"_blank\"><img src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" height=\"48\" width=\"48\" alt=\"\" title=\"" + tumblraccount.tblrUserName + "\" /></a>" +
                                                        "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                       // }

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

                            }

                            else if (item.ProfileType == "twitter")
                            {
                                try
                                {
                                    TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                                    SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(item.ProfileId);
                                    if (twtaccount != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','twt','twt')\"></div><a href=\"http://twitter.com/" + twtaccount.TwitterScreenName + "\" target=\"_blank\"><img src=\"" + twtaccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + twtaccount.TwitterScreenName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "linkedin")
                            {
                                try
                                {

                                    LinkedInAccountRepository liRepo = new LinkedInAccountRepository();
                                    string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty;
                                    LinkedInAccount liaccount = liRepo.getUserInformation(item.ProfileId);

                                    if (liaccount != null)
                                    {
                                        if (!string.IsNullOrEmpty(liaccount.ProfileImageUrl))
                                        {
                                            LdPreofilePic = liaccount.ProfileImageUrl;
                                        }
                                        else
                                        {
                                            LdPreofilePic = "../../Contents/img/blank_img.png";
                                        }

                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','linkedin')\"></div><a href=\"" + liaccount.ProfileUrl + "\" target=\"_blank\"><img src=\"" + LdPreofilePic + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + liaccount.LinkedinUserName + "\" /></a>" +
                                                   "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }

                            }

                            else if (item.ProfileType == "instagram")
                            {
                                try
                                {
                                    InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                                    InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId);
                                    string accessToken = string.Empty;
                                    if (objInsAcc != null)
                                    {
                                        profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','instagram')\"></div><a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><img src=\"" + objInsAcc.ProfileUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objInsAcc.InsUserName + "\" /></a>" +
                                                    "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "googleplus")
                            {
                                try
                                {

                                    //GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository();
                                    //GooglePlusAccount objgpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id);
                                    //string accessToken = string.Empty;

                                    //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleplus')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"" + objgpAcc.GpProfileImage + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgpAcc.GpUserName + "\" /></a>" +
                                    //            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";

                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error(ex.Message);
                                }
                            }
                            else if (item.ProfileType == "googleanalytics")
                            {
                                try
                                {

                                    //GoogleAnalyticsAccountRepository objgaAccRepo = new GoogleAnalyticsAccountRepository();
                                    //GoogleAnalyticsAccount objgaAcc = objgaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id,item.ProfileId);
                                    //string accessToken = string.Empty;

                                    //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleanalytics')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"../Contents/img/google_analytics.png\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgaAcc.GaAccountName + "\" /></a>" +
                                    //            "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>";

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

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

                        }
                    } profiles += "</ul>";
                    Response.Write(profiles);
                }
                else if (Request.QueryString["op"] == "woodrafts")
                {
                    string message = string.Empty;
                    try
                    {
                        DraftsRepository draftsRepository = new DraftsRepository();
                        List<Drafts> lstDrafts = draftsRepository.getAllDrafts(team.GroupId);
                        string profurl = string.Empty;
                        if (string.IsNullOrEmpty(user.ProfileUrl))
                        {
                            profurl = "../Contents/img/blank_img.png";
                        }
                        else
                        {
                            profurl = user.ProfileUrl;
                        }
                        if (lstDrafts.Count != 0)
                        {
                            foreach (Drafts item in lstDrafts)
                            {
                                try
                                {
                                    message += "<section class=\"section\" style=\"width:648px;\">" +
                                                                       "<div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                                                            "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"../Contents/img/task_pin.png\">" +
                                                        //  "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\" />" +
                                                            "</section><section class=\"task-activity third\" style=\"width: 19.6%;\"><p>" + user.UserName + "</p><div>" + item.CreatedDate + " </div><p>" +
                                        //"</p></section><section style=\"margin-right: 6px; height: auto; width: 35%;\" class=\"task-message font-13 third\"><a onclick=\"writemessage(this.innerHTML);\" class=\"tip_left\">" + item.Message + "</a></section>" +
                                                             "</p></section><section style=\"margin-right: 6px; height: auto; width: 31%;\" class=\"task-message font-13 third\"><span class=\"tip_left\">" + gethtmlfromstring(item.Message) + "</span></section>" +
                                                                "<div class=\"userpictiny\" style=\"height:70px; margin-top: 0;\"><img alt=\"\" src=\"" + profurl + "\" />" +
                                                             "</div>" +
                                                             "<a class=\"small_remove icon publish_delete\" href=\"#\" style=\"top: 7px; float: right; margin-top: 13px; margin-right: 10px;\" title=\"Delete\" onclick=\"deleteDraftMessage('" + item.Id + "')\"></a>" +
                                                            "<section style=\"margin-top: 18px; width: 45px; margin-right: 17px;\" class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                                                                "<span onclick=\"editDraftsMessage('" + item.Id + "','" + item.Message + "');\" class=\"ui-sproutmenu-status\">" +
                                                            "<img class=\"edit_button\" src=\"../Contents/img/icon_edit.png\" alt=\"\" />" +
                                                            "</span>" +
                                                            "</a></div></section></div></section>";
                                }
                                catch (Exception ex)
                                {

                                    logger.Error(ex.Message);
                                }
                            }
                        }
                        else
                        {
                            message += "<div style=\"margin-left: 2%; margin-top: 3%;\">No Messages in Drafts</div>";
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                    Response.Write(message);
                }
                else if (Request.QueryString["op"] == "savedrafts")
                {
                    try
                    {
                        string message = Request.QueryString["message"];
                        message = Request.Form["messagee"];
                        Drafts d = new Drafts();
                        d.CreatedDate = DateTime.Now;
                        d.Message = message;
                        d.ModifiedDate = DateTime.Now;
                        d.UserId = user.Id;
                        d.GroupId = team.GroupId;
                        d.Id = Guid.NewGuid();
                        DraftsRepository dRepo = new DraftsRepository();
                        if (!dRepo.IsDraftsMessageExist(user.Id, message))
                        {
                            dRepo.AddDrafts(d);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                    Response.Write("added successfully");
                }

                else if (Request.QueryString["op"] == "midsnaps")
                {
                    try
                    {
                        Random rNum = new Random();
                        string loadtype = Request.QueryString["loadtype"];
                        string midsnaps = string.Empty;
                        if (loadtype == "load")
                            profilelimit = 0;

                        if (profilelimit != -1)
                        {
                           // Team lstDetails = objTeamRepository.getAllDetails(team.GroupId, team.EmailId);

                            List<TeamMemberProfile> alst = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);

                          //  ArrayList alst = socio.getLimitProfilesOfUser(user.Id, profilelimit);
                            if (alst.Count == 0)
                                profilelimit = -1;
                            else if (profilelimit == 0)
                                //profilelimit += 2;
                                profilelimit += 6;
                            else
                                profilelimit += 6;
                            midsnaps += "<div class=\"row-fluid\" >";
                            if (loadtype == "load")
                            {
                                AdsRepository objAdsRepo = new AdsRepository();
                                ArrayList lstads = objAdsRepo.getAdsForHome();
                                int i = 0;
                                if (lstads.Count <= 1)
                                {
                                    if (user.PaymentStatus.ToUpper() == "PAID")
                                    {
                                        midsnaps += "";
                                    }
                                }
                                else
                                {
                                    foreach (var item in lstads)
                                    {
                                        Array temp = (Array)item;
                                        i++;
                                        if (temp != null)
                                        {
                                            if (i == 2)
                                            {
                                                if (user.AccountType == "Paid")
                                                {
                                                    midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" +
                                              "<a href=\"#\"><img src=\"" + temp.GetValue(2).ToString() + "\"  alt=\"\" style=\"width:246px;height:331px\"></a></div>";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            foreach (TeamMemberProfile item in alst)
                            {
                                if (item.ProfileType == "facebook")
                                {
                                    try
                                    {
                                        FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                                        FacebookFeedRepository facefeedrepo = new FacebookFeedRepository();
                                        List<FacebookFeed> fbmsgs = facefeedrepo.getAllFacebookUserFeeds(item.ProfileId);
                                        FacebookAccount fbaccount = fbrepo.getFacebookAccountDetailsById(item.ProfileId);
                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                                   "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\"  class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + fbaccount.FbUserName + "\" alt=\"\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\"\">" +
                                                   "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\"></a></div>" +
                                                   "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"useraccname\">" + getsortpofilename(fbaccount.FbUserName) + "</div><div class=\"usercounter\">" +
                                                   "<div class=\"userfoll\">" + fbaccount.Friends;
                                        if (fbaccount.Type == "page")
                                        {
                                            midsnaps += "<span><b style=\"font-size: 13px;\">Fans</b></span>";
                                        }
                                        else
                                        {
                                            midsnaps += "<span><b style=\"font-size: 13px;\">Friends</b></span>";
                                        }
                                        midsnaps += "</div>" +
                                                   "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div><h5>Recent message</h5></div>" +
                                                   "<div class=\"concoteng\"> <ul class=\"mess\">";
                                        if (fbmsgs.Count != 0)
                                        {
                                            int msgcount = 0;
                                            foreach (FacebookFeed child in fbmsgs)
                                            {
                                                string mess = string.Empty;
                                                if (msgcount < 2)
                                                {
                                                    if (child.FeedDescription.Length > 40)
                                                    {
                                                        mess = child.FeedDescription.Substring(0, 39);
                                                        mess = mess + "...........";
                                                    }
                                                    else
                                                    {
                                                        mess = child.FeedDescription;
                                                    }
                                                    midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\"></div>" +
                                                              "<div class=\"messtext\">" + mess + "</div></li>";
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                                msgcount++;
                                            }
                                        }
                                        else
                                        {
                                            midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }

                                        midsnaps += "</ul></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        logger.Error(ex.Message);
                                    }
                                }

                                else if (item.ProfileType == "googleplus")
                                {

                                }
                                else if (item.ProfileType == "twitter")
                                {
                                    TwitterAccountRepository twtrepo = new TwitterAccountRepository();
                                    SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(item.ProfileId);
                                    TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                                    List<TwitterMessage> lsttwtmsgs = twtmsgrepo.getAllTwitterMessagesOfProfile(item.ProfileId);
                                    int tweetcount = 0;

                                    midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                     "<div onclick=\"detailsdiscoverytwitter('" + item.ProfileId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + twtaccount.TwitterScreenName + "\" alt=\"\" src=\"" + twtaccount.ProfileImageUrl + "\">" +
                                     "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\"></a></div>" +
                                     "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"useraccname\">" + getsortpofilename(twtaccount.TwitterScreenName) + "</div><div class=\"usercounter\">" +
                                     "<div class=\"userfoll\">" + twtaccount.FollowersCount + "<span><b style=\"font-size: 13px;\">Followers</b></span></div>" +
                                     "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. tweet <br> Per Day</span></div></div><h5>Recent message</h5></div>" +
                                     "<div class=\"concoteng\"> <ul class=\"mess\">";
                                    try
                                    {
                                        if (lsttwtmsgs.Count == 0)
                                        {
                                            midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }
                                        else
                                        {
                                            foreach (TwitterMessage msg in lsttwtmsgs)
                                            {
                                                if (tweetcount < 2)
                                                {
                                                    try
                                                    {
                                                        string ms = string.Empty;
                                                        if (msg.TwitterMsg.Length > 20)
                                                        {
                                                            ms = msg.TwitterMsg.Substring(0, 20) + "...";

                                                        }
                                                        else
                                                        {
                                                            ms = msg.TwitterMsg;
                                                        }
                                                        midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + msg.FromProfileUrl + "\"></div>" +
                                                        "<div class=\"messtext\">" + ms + "</div></li>";
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);

                                                    }
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                                tweetcount++;
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {

                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                    midsnaps += "</ul></div></div>";
                                }

                                else if (item.ProfileType == "tumblr")
                                {
                                    try
                                    {
                                        string PostCount = string.Empty;
                                        string LikesCount = string.Empty;

                                        TumblrAccountRepository tumblrrepo = new TumblrAccountRepository();
                                        SocioBoard.Domain.TumblrAccount tumblrccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId);
                                        TumblrFeedRepository tumblrfeedrepo = new TumblrFeedRepository();
                                        List<TumblrFeed> lsttumblrmsgs = tumblrfeedrepo.getFeedOfProfile(item.ProfileId);
                                        BlogInfo objBlogInfo = new BlogInfo();
                                        string objData = objBlogInfo.getTumblrUserInfo(tumblrccount.tblrUserName);
                                        //string objFollower = objBlogInfo.getTumblrUserfollower(tumblrccount.tblrUserName);
                                        string[] words = objData.Split('&');

                                        PostCount = words[1].ToString();
                                        LikesCount = words[0].ToString();

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                                    "<a href=\"http://"+ item.ProfileId + ".tumblr.com\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + tumblrccount.tblrUserName + "\" alt=\"\" src=\"http://api.tumblr.com/v2/blog/" + tumblrccount.tblrUserName + ".tumblr.com/avatar\"></a>" +
                                                    "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\"></a></div>" +
                                                    "<a  href=\"http://" + item.ProfileId + ".tumblr.com\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(tumblrccount.tblrUserName) + "</div></a></div>" +
                                                    "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                                    " <div class=\"fb_notifications\">" +
                                                    "<ul class=\"user-stats\"> " +
                                                         "<li><div class=\"photo_stat\">  post</div>  <div class=\"number-stat\">" + PostCount + "</div></li>" +
                                                         "<li><div class=\"photo_stat\">likes</div><div class=\"number-stat\">" + LikesCount + "</div></li>" +
                                                     "</ul></div></div></div></div>";

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

                                else if (item.ProfileType == "youtube")
                                {
                                    try
                                    {

                                        YoutubeAccountRepository ytrepo = new YoutubeAccountRepository();
                                        YoutubeChannelRepository objYoutubeChannelRepository=new YoutubeChannelRepository();
                                        SocioBoard.Domain.YoutubeAccount ytacount = ytrepo.getYoutubeAccountDetailsById(item.ProfileId);
                                        YoutubeChannel objYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(item.ProfileId);

                                        if (string.IsNullOrEmpty(ytacount.Ytprofileimage))
                                        {
                                            ytacount.Ytprofileimage = "../../Contents/img/blank_img.png";
                                        }

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                               "<a href=\"#\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + ytacount.Ytuserid + "\" alt=\"\" src=\"" + ytacount.Ytprofileimage + "\"></a>" +
                                                  "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/youtube.png\" width=\"16\" height=\"16\"></a></div>" +
                                                  "<a href=\"#\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(ytacount.Ytusername) + "</div></a></div>" +
                                                  "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                                  " <div class=\"fb_notifications\">" +
                                                  "<ul class=\"user-stats\"> " +
                                                       "<li><div class=\"photo_stat\">Total View</div>  <div class=\"number-stat\">" + objYoutubeChannel.ViewCount + "</div></li>" +
                                                       "<li><div class=\"photo_stat\">Total Subcriber</div><div class=\"number-stat\">" + objYoutubeChannel.SubscriberCount + "</div></li>" +
                                                       "<li><div class=\"photo_stat\">Total Video</div><div class=\"number-stat\">" + objYoutubeChannel.VideoCount + "</div></li>" +
                                                   "</ul></div></div></div></div>";

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

                                else if (item.ProfileType == "linkedin")
                                {
                                    try
                                    {
                                        string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty;
                                        LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository();
                                        LinkedInFeedRepository objliFeedRepo = new LinkedInFeedRepository();
                                        LinkedInAccount liAccount = objLiRepo.getUserInformation(item.ProfileId);
                                        LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository();
                                        List<LinkedInFeed> alstliaccount = lifeedrepo.getAllLinkedInFeedsOfProfile(item.ProfileId);
                                        if (liAccount != null)
                                        {
                                            LdprofileName = liAccount.LinkedinUserName;
                                            LdPreofilePic = liAccount.ProfileImageUrl;
                                        }

                                        if (string.IsNullOrEmpty(LdPreofilePic))
                                        {
                                            LdPreofilePic = "../../Contents/img/blank_img.png";
                                        }
                                        int linkedinConcount = 0;
                                        try
                                        {
                                            linkedinConcount = liAccount.Connections;
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                        }

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                           "<div class=\"userpictiny\"><a target=\"_blank\" href=\"" + liAccount.ProfileUrl + "\"><img width=\"56\" height=\"56\" title=\"" + LdprofileName + "\" alt=\"\" src=\"" + LdPreofilePic + "\"></a>" +
                                           "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\"></a></div>" +
                                           "<div class=\"useraccname\">" + getsortpofilename(LdprofileName) + "</div><div class=\"usercounter\">" +
                                           "<div class=\"userfoll\">" + linkedinConcount + "<span>Connections</span></div>" +
                                           "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div><h5>Recent message</h5></div>" +
                                           "<div class=\"concoteng\"> <ul class=\"mess\">";
                                        int link = 0;
                                        if (alstliaccount.Count == 0)
                                        {
                                            midsnaps += "<strong>No messages were found within the past 14 days.</strong> \"Messages will be displayed once there is activity in this date range.\"";
                                        }
                                        else
                                        {

                                            try
                                            {

                                                foreach (LinkedInFeed liFeed in alstliaccount)
                                                {
                                                    try
                                                    {
                                                        if (link < 2)
                                                        {
                                                            string ms = string.Empty;
                                                            if (liFeed.Feeds.Length > 20)
                                                            {
                                                                ms = liFeed.Feeds.Substring(0, 20) + "...";

                                                            }
                                                            else
                                                            {
                                                                ms = liFeed.Feeds;
                                                            }
                                                            midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + liFeed.FromPicUrl + "\"></div>" +
                                                           "<div class=\"messtext\">" + ms + "</div></li>";
                                                            link++;
                                                        }
                                                        else
                                                        {
                                                            break;
                                                        }
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                logger.Error(ex.Message);
                                            }

                                        }
                                        midsnaps += "</ul></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                }
                                else if (item.ProfileType == "instagram")
                                {
                                    try
                                    {
                                        InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                                        InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId);

                                        midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" +
                                               "<a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + objInsAcc.InsUserName + "\" alt=\"\" src=\"" + objInsAcc.ProfileUrl + "\"></a>" +
                                               "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\"></a></div>" +
                                               "<a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(objInsAcc.InsUserName) + "</div></a></div>" +
                                               "<div class=\"concoteng\"><div class=\"pillow_fade\">" +
                                               " <div class=\"fb_notifications\">" +
                                               "<ul class=\"user-stats\"> " +
                                                    "<li><div class=\"photo_stat\">  photos</div>  <div class=\"number-stat\">" + objInsAcc.TotalImages + "</div></li>" +
                                                    "<li><div class=\"photo_stat\">following</div><div class=\"number-stat\">" + objInsAcc.Followers + "</div></li>" +
                                                    "<li><div class=\"photo_stat\">followers</div><div class=\"number-stat\">" + objInsAcc.FollowedBy + "</div></li>" +
                                                "</ul></div></div></div></div>";
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.Message);
                                        logger.Error(ex.Message);
                                    }
                                }
                                else if (item.ProfileType == "googleanalytics")
                                {
                                }
                            }
                            midsnaps += "</div>";
                            Response.Write(midsnaps);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }

                else if (Request.QueryString["op"] == "accountdelete")
                {
                    Groups lstDetails = objGroupRepository.getGroupName(team.GroupId);
                    if (lstDetails.GroupName == "Socioboard")
                    {

                        Session["facebooktotalprofiles"] = null;
                        SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
                        string Profiletype = Request.QueryString["profile"];
                        string profileid = Request.QueryString["profileid"];

                        if (Profiletype == "fb")
                        {
                            try
                            {
                                FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);

                                int delacc = fbrepo.deleteFacebookUser(profileid, user.Id);
                                if (delacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);
                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);
                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository();
                                            fbmsgrepo.deleteAllMessagesOfUser(profileid, user.Id);
                                            FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository();
                                            fbfeedrepo.deleteAllFeedsOfUser(profileid, user.Id);
                                            FacebookStatsRepository fbstatsrepo = new FacebookStatsRepository();
                                            fbstatsrepo.deleteFacebookStats(profileid, user.Id);

                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                        }

                                    }
                                }

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

                        else if (Profiletype == "tumblr")
                        {
                            try
                            {
                                TumblrAccountRepository tumblraccountrepo = new TumblrAccountRepository();
                                TumblrFeedRepository objTumblrFeedRepository = new TumblrFeedRepository();
                                int deltwtacc = tumblraccountrepo.deleteTumblrUser(profileid, user.Id);
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                if (deltwtacc > 0)
                                {
                                    try
                                    {
                                        socioprofilerepo.deleteProfile(user.Id, profileid);
                                        objTumblrFeedRepository.DeleteTumblrDataByUserid(user.Id, profileid);
                                        ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                        schedulemsgrepo.deleteMessage(user.Id, profileid);
                                        ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                        int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else if (Profiletype == "youtube")
                        {
                            try
                            {
                                YoutubeAccountRepository youtubeaccountrepo = new YoutubeAccountRepository();
                                YoutubeChannelRepository objYoutubeChannelRepository = new YoutubeChannelRepository();
                                int deltwtacc = youtubeaccountrepo.deleteYoutubeUser(user.Id,profileid);
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                if (deltwtacc > 0)
                                {
                                    socioprofilerepo.deleteProfile(user.Id, profileid);
                                    objYoutubeChannelRepository.DeleteProfileDataByUserid(profileid);

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else if (Profiletype == "twt")
                        {
                            try
                            {
                                TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                                int deltwtacc = twtaccountrepo.deleteTwitterUser(user.Id, profileid);
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                if (deltwtacc > 0)
                                {
                                    socioprofilerepo.deleteProfile(user.Id, profileid);
                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);
                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                                            int d = twtmsgrepo.deleteTwitterMessage(profileid, user.Id);
                                            TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository();
                                            int s = twtfeedrepo.deleteTwitterFeed(profileid, user.Id);
                                            TwitterStatsRepository twtstatsrepo = new TwitterStatsRepository();
                                            int a = twtstatsrepo.deleteTwitterStats(user.Id, profileid);
                                            TwitterDirectMessageRepository twtdirectmsgrepo = new TwitterDirectMessageRepository();
                                            int f = twtdirectmsgrepo.deleteDirectMessage(user.Id, profileid);

                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);

                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                        }

                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        else if (Profiletype == "linkedin")
                        {
                            try
                            {
                                LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                int dellinacc = linkedaccrepo.deleteLinkedinUser(profileid, user.Id);
                                if (dellinacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);

                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            LinkedInFeedRepository linkedfeedrepo = new LinkedInFeedRepository();
                                            int s = linkedfeedrepo.deleteAllFeedsOfUser(profileid, user.Id);
                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);

                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                        }

                                    }

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

                        }
                        else if (Profiletype == "instagram")
                        {
                            try
                            {
                                InstagramAccountRepository insaccrepo = new InstagramAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                int insacc = insaccrepo.deleteInstagramUser(profileid, user.Id);
                                if (insacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);

                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                    if (lstsocioprofile.Count >= 0)
                                    {
                                        try
                                        {
                                            ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository();
                                            schedulemsgrepo.deleteMessage(user.Id, profileid);
                                            ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository();
                                            int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid);

                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                        }

                                    }

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

                            }
                        }
                        else if (Profiletype == "googleplus")
                        {
                            try
                            {
                                GooglePlusAccountRepository googleplusaccrepo = new GooglePlusAccountRepository();
                                int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid);
                                int gplusacc = googleplusaccrepo.deleteGooglePlusUser(profileid, user.Id);
                                if (gplusacc > 0)
                                {

                                    socioprofilerepo.deleteProfile(user.Id, profileid);

                                    List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid);

                                    if (lstsocioprofile.Count >= 0)
                                    {
                                    }

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

                            }
                        }

                        string profiles = string.Empty;
                        profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";

                        /*facebook users binding*/
                        FacebookAccountRepository fbprepo = new FacebookAccountRepository();
                        ArrayList lstfbaccounts = fbprepo.getFacebookAccountsOfUser(user.Id);

                        profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                        if (lstfbaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (FacebookAccount fbacc in lstfbaccounts)
                            {
                                profiles += "<li id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                        /*twitter users binding*/
                        TwitterAccountRepository twtpaccountrepo = new TwitterAccountRepository();
                        ArrayList alsttwtaccounts = twtpaccountrepo.getAllTwitterAccountsOfUser(user.Id);
                        profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                        if (alsttwtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts)
                            {
                                profiles += "<li id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                        /*linkedinuserbinding*/
                        LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                        ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id);
                        profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                        if (alstlinkacc.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {

                            foreach (LinkedInAccount item in alstlinkacc)
                            {
                                string profileurl = string.Empty;

                                if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                {
                                    profileurl = item.ProfileImageUrl;
                                }
                                else
                                {
                                    profileurl = "../../Contents/img/blank_img.png";
                                }
                                profiles += "<li id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";
                        Response.Write(RemainingAccount(user));

                    }
                }

                else if (Request.QueryString["op"] == "MasterCompose")
                {
                    string profiles = string.Empty;
                    string FbprofileId = string.Empty;
                    string TwtprofileId = string.Empty;
                    string TumblrprofileId = string.Empty;
                    string LinkedInprofileId = string.Empty;

                        profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";
                        try
                        {
                            List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allprofiles)
                            {
                                FbprofileId += item.ProfileId + ',';

                            }
                            FbprofileId = FbprofileId.Substring(0, FbprofileId.Length - 1);

                            /*facebook users binding*/
                            FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                            List<FacebookAccount> lstfbaccounts = fbrepo.getAllAccountDetail(FbprofileId);

                            profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                            if (lstfbaccounts.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {
                                foreach (FacebookAccount fbacc in lstfbaccounts)
                                {
                                    profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";

                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                        /*tumbler users binding*/

                        try
                        {
                            List<TeamMemberProfile> allTumblrprofiles = objTeamMemberProfileRepository.getTumblrTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allTumblrprofiles)
                            {
                                TumblrprofileId += item.ProfileId + ',';

                            }
                            TumblrprofileId = TumblrprofileId.Substring(0, TumblrprofileId.Length - 1);

                            TumblrAccountRepository tumblrtaccountrepo = new TumblrAccountRepository();
                            List<TumblrAccount> alsttumblrtaccounts = tumblrtaccountrepo.getAllAccountDetail(TumblrprofileId);
                            profiles += "<div class=\"twitte_text\">TUMBLR</div><div class=\"teitter\"><ul>";

                            if (alsttumblrtaccounts.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {
                                foreach (TumblrAccount item in alsttumblrtaccounts)
                                {
                                    profiles += "<li nwtk='tumb' class=\"getAllNetworkProfile\" id=\"liid_" + item.tblrUserName + "\"   onclick=\"composemessage(this.id,'tumb')\"><a><img id=\"img_" + item.tblrUserName + "\" src=\"../Contents/img/tumblr.png\" alt=\"" + item.tblrAccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.tblrUserName + "\" style=\"display:none;\">http://api.tumblr.com/v2/blog/" + item.tblrProfilePicUrl + ".tumblr.com/avatar</span><span id=\"composename_" + item.tblrUserName + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.tblrUserName + "</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";

                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                        /*twitter users binding*/
                        try
                        {
                            List<TeamMemberProfile> allTwtprofiles = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allTwtprofiles)
                            {
                                TwtprofileId += item.ProfileId + ',';

                            }
                            TwtprofileId = TwtprofileId.Substring(0, TwtprofileId.Length - 1);

                            TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                            List<TwitterAccount> alsttwtaccounts = twtaccountrepo.getAllAccountDetail(TwtprofileId);
                            profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                            if (alsttwtaccounts.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {
                                foreach (TwitterAccount item in alsttwtaccounts)
                                {
                                    profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";

                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                        /*linkedinuserbinding*/

                        try
                        {
                            List<TeamMemberProfile> allLinkedInprofiles = objTeamMemberProfileRepository.getLinkedInTeamMemberProfileData(team.Id);
                            foreach (TeamMemberProfile item in allLinkedInprofiles)
                            {
                                LinkedInprofileId += item.ProfileId + ',';

                            }
                            LinkedInprofileId = LinkedInprofileId.Substring(0, LinkedInprofileId.Length - 1);

                            LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                            List<LinkedInAccount> alstlinkacc = linkaccountrepo.getAllAccountDetail(LinkedInprofileId);
                            profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                            if (alstlinkacc.Count == 0)
                            {
                                profiles += "<li>No Records Found</li>";
                            }
                            else
                            {

                                foreach (LinkedInAccount item in alstlinkacc)
                                {
                                    string profileurl = string.Empty;

                                    if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                    {
                                        profileurl = item.ProfileImageUrl;
                                    }
                                    else
                                    {
                                        profileurl = "../../Contents/img/blank_img.png";
                                    }
                                    profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                                }
                            }
                            profiles += "</ul> </div>";
                        }
                        catch (Exception ex)
                        {

                            logger.Error(ex.Message);

                        }

                    Response.Write(profiles);
                }

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

                else if (Request.QueryString["op"] == "MasterComposesc")
                {
                    string profiles = string.Empty;
                    string FbprofileId = string.Empty;
                    string TwtprofileId = string.Empty;
                    string LinkedInprofileId = string.Empty;
                    string TumblrprofileId = string.Empty;

                    //if (Session["profilesforcomposemessage"] == null)
                    //{
                    profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">";
                    try
                    {
                        List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allprofiles)
                        {
                            FbprofileId += item.ProfileId + ',';

                        }
                        FbprofileId = FbprofileId.Substring(0, FbprofileId.Length - 1);

                        /*facebook users binding*/
                        FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                        List<FacebookAccount> lstfbaccounts = fbrepo.getAllAccountDetail(FbprofileId);

                        profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>";

                        if (lstfbaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (FacebookAccount fbacc in lstfbaccounts)
                            {
                                profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\"   onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    /*tumbler users binding*/

                    try
                    {
                        List<TeamMemberProfile> allTumblrprofiles = objTeamMemberProfileRepository.getTumblrTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allTumblrprofiles)
                        {
                            TumblrprofileId += item.ProfileId + ',';

                        }
                        TumblrprofileId = TumblrprofileId.Substring(0, TumblrprofileId.Length - 1);

                        TumblrAccountRepository tumblrtaccountrepo = new TumblrAccountRepository();
                        List<TumblrAccount> alsttumblrtaccounts = tumblrtaccountrepo.getAllAccountDetail(TumblrprofileId);
                        profiles += "<div class=\"twitte_text\">TUMBLR</div><div class=\"teitter\"><ul>";

                        if (alsttumblrtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (TumblrAccount item in alsttumblrtaccounts)
                            {
                                profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.tblrUserName + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.tblrUserName + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.tblrAccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.tblrUserName + "\" style=\"display:none;\">" + item.tblrProfilePicUrl + "</span><span id=\"composename_" + item.tblrUserName + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.tblrUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    /*twitter users binding*/
                    try
                    {
                        List<TeamMemberProfile> allTwtprofiles = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allTwtprofiles)
                        {
                            TwtprofileId += item.ProfileId + ',';

                        }
                        TwtprofileId = TwtprofileId.Substring(0, TwtprofileId.Length - 1);

                        TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                        List<TwitterAccount> alsttwtaccounts = twtaccountrepo.getAllAccountDetail(TwtprofileId);
                        profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>";

                        if (alsttwtaccounts.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {
                            foreach (TwitterAccount item in alsttwtaccounts)
                            {
                                profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\"   onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    /*linkedinuserbinding*/

                    try
                    {
                        List<TeamMemberProfile> allLinkedInprofiles = objTeamMemberProfileRepository.getLinkedInTeamMemberProfileData(team.Id);
                        foreach (TeamMemberProfile item in allLinkedInprofiles)
                        {
                            LinkedInprofileId += item.ProfileId + ',';

                        }
                        LinkedInprofileId = LinkedInprofileId.Substring(0, LinkedInprofileId.Length - 1);

                        LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository();
                        List<LinkedInAccount> alstlinkacc = linkaccountrepo.getAllAccountDetail(LinkedInprofileId);
                        profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>";

                        if (alstlinkacc.Count == 0)
                        {
                            profiles += "<li>No Records Found</li>";
                        }
                        else
                        {

                            foreach (LinkedInAccount item in alstlinkacc)
                            {
                                string profileurl = string.Empty;

                                if (!string.IsNullOrEmpty(item.ProfileImageUrl))
                                {
                                    profileurl = item.ProfileImageUrl;
                                }
                                else
                                {
                                    profileurl = "../../Contents/img/blank_img.png";
                                }
                                profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\"   onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>";
                            }
                        }
                        profiles += "</ul> </div>";
                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    Response.Write(profiles);
                }

                else if (Request.QueryString["op"] == "sendmessage")
                {
                    string messagecount = string.Empty;
                    string message = Request.QueryString["message"];
                    string time = Request.QueryString["now"];
                    //message = Request.Form["massagee"];
                    var userid = Request.QueryString["userid[]"].Split(',');
                    //var userid = Request.Form["userid[]"].Split(',');
                    var files = Request.Files.Count;
                    var fi = Request.Files["file"];
                    string file = string.Empty;
                    try
                    {

                        if (Request.Files.Count > 0)
                        {
                            if (fi != null)
                            {
                                var path = Server.MapPath("~/Contents/img/upload");

                               // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                                file = path + "/" + fi.FileName;
                                if (!Directory.Exists(path))
                                {
                                    Directory.CreateDirectory(path);
                                }
                                fi.SaveAs(file);
                            }
                        }

                    }
                    catch (Exception ex)
                    {

                        logger.Error(ex.Message);

                    }

                    foreach (var item in userid)
                    {
                        string[] networkingwithid = item.Split('_');
                        if (networkingwithid[0] == "fb")
                        {
                            try
                            {
                               //for (int i = 0; i < 5000; i++)
                               // {

                                    FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository();
                                    FacebookAccount fbaccount = fbaccountrepo.getFacebookAccountDetailsById(networkingwithid[1]);
                                    var args = new Dictionary<string, object>();

                                    args["message"] = message;

                                    if (Request.Files.Count > 0)
                                    {
                                        string strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery;
                                        string strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/");
                                        string filepath = strUrl + "/Contents/img/upload/" + fi.FileName;
                                        args["picture"] = filepath;
                                    }
                                    FacebookClient fc = new FacebookClient(fbaccount.AccessToken);

                                    string facebookpost = string.Empty;
                                    if (fbaccount.Type == "page")
                                    {
                                        facebookpost = fc.Post("/" + fbaccount.FbUserId + "/feed", args).ToString();
                                    }
                                    else
                                    {
                                        facebookpost = fc.Post("/me/feed", args).ToString();
                                    }

                                //}

                            }
                            catch (Exception ex)
                            {

                                logger.Error(ex.Message);

                                Console.WriteLine(ex.Message);
                            }

                        }
                        else if (networkingwithid[0] == "twt")
                        {
                            try
                            {
                                TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                                SocioBoard.Domain.TwitterAccount twtaccount = twtaccountrepo.getUserInformation(networkingwithid[1]);

                                TwitterHelper twthelper = new TwitterHelper();

                                oAuthTwitter OAuthTwt = new oAuthTwitter();
                                OAuthTwt.AccessToken = twtaccount.OAuthToken;
                                OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret;
                                OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName;
                                OAuthTwt.TwitterUserId = twtaccount.TwitterUserId;

                                twthelper.SetCofigDetailsForTwitter(OAuthTwt);

                                #region For Testing
                                // For Testing

                                //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w";
                                //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI";
                                //OAuthTwt.AccessToken = "1453351098-Lz4H7cHKp26pXarF6l9zEwdiHDnwH7D0H4zteH3";
                                //OAuthTwt.AccessTokenSecret = "dGBPxR9wxhQMioIcj5P4Wemxo5EZIZ8wlvDz7i39lSNFg";
                                //OAuthTwt.TwitterScreenName = "";
                                //OAuthTwt.TwitterUserId = "";
                                #endregion

                                Tweet twt = new Tweet();
                                if (Request.Files.Count > 0)
                                {

                                    PhotoUpload ph = new PhotoUpload();
                                    //ph.Tweet(file, message, OAuthTwt);
                                    string res = string.Empty;
                                    ph.NewTweet(file, message, OAuthTwt, ref res);

                                    // for testing

                                    Response.Write(res);
                                    Console.WriteLine(res);
                                }
                                else
                                {
                                    JArray post = twt.Post_Statuses_Update(OAuthTwt, message);
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error(ex.Message);

                            }
                        }
                        else if (networkingwithid[0] == "lin")
                        {
                            try
                            {
                                LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository();
                                LinkedInAccount linkedaccount = linkedinaccrepo.getUserInformation(networkingwithid[1]);
                                oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();

                                Linkedin_oauth.Verifier = linkedaccount.OAuthVerifier;
                                Linkedin_oauth.TokenSecret = linkedaccount.OAuthSecret;
                                Linkedin_oauth.Token = linkedaccount.OAuthToken;
                                Linkedin_oauth.Id = linkedaccount.LinkedinUserId;
                                Linkedin_oauth.FirstName = linkedaccount.LinkedinUserName;
                                SocialStream sociostream = new SocialStream();
                                string res = sociostream.SetStatusUpdate(Linkedin_oauth, message);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                logger.Error(ex.Message);

                            }
                        }
                        else if (networkingwithid[0] == "tumb")
                        {
                            string title = string.Empty;
                            try
                            {
                                TumblrAccountRepository objTumblrAccountRepository = new TumblrAccountRepository();
                                TumblrAccount tumblraccount = objTumblrAccountRepository.getTumblrAccountDetailsById(networkingwithid[1]);

                                PublishedPosts objPublishedPosts = new PublishedPosts();
                                objPublishedPosts.PostData(tumblraccount.tblrAccessToken, tumblraccount.tblrAccessTokenSecret, networkingwithid[1], message, title, "text");

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

                            }
                        }
                        string profiletype="";
                        if(networkingwithid[0] == "fb")
                        {
                        profiletype="facebook";
                        }
                        else if(networkingwithid[0] == "twt")
                        {
                         profiletype="twitter";
                        }
                         else if(networkingwithid[0] == "lin")
                        {
                         profiletype="linkedin";
                        }
                        else if (networkingwithid[0] == "tumb")
                        {
                            profiletype = "tumblr";
                        }

                        ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
                        ScheduledMessage objScheduledMessage = new ScheduledMessage();
                        try
                        {
                            objScheduledMessage.ShareMessage = message;
                            objScheduledMessage.ClientTime = Convert.ToDateTime(time);
                            objScheduledMessage.ScheduleTime = Convert.ToDateTime(time);
                            objScheduledMessage.CreateTime = Convert.ToDateTime(time);
                            objScheduledMessage.Status = true;
                            objScheduledMessage.UserId = user.Id;
                            objScheduledMessage.ProfileType = profiletype;
                            try
                            {   var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload";
                                file = path + "/" + fi.FileName;
                                objScheduledMessage.PicUrl = file;
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.StackTrace);
                            }

                            objScheduledMessage.ProfileId = networkingwithid[1];
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        objScheduledMessageRepository.addNewMessage(objScheduledMessage);
                        messagecount = objScheduledMessageRepository.getAllSentMessagesOfUser(user.Id).Count().ToString();
                    }

                    Response.Write("~"+messagecount);

                }
                else if (Request.QueryString["op"] == "wooqueue_messages")
                {
                    ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                }
                else if (Request.QueryString["op"] == "schedulemessage")
                {

                    var userid = Request.QueryString["users[]"].Split(',');
                    var datearr = Request.QueryString["datearr[]"].Split(',');
                    string message = Request.QueryString["message"];
                    message = Request.Form["messagee"];
                    ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository();
                    string time = Request.QueryString["time"];
                    string clienttime = Request.QueryString["clittime"];

                    foreach (var item in userid)
                    {
                        if (!string.IsNullOrEmpty(item.ToString()))
                        {
                            foreach (var child in datearr)
                            {

                                ScheduledMessage schmessage = new ScheduledMessage();
                                string[] networkingwithid = item.Split('_');

                                if (networkingwithid[0] == "fbscheduler")
                                {
                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "facebook";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    string servertime = this.CompareDateWithclient(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                else if (networkingwithid[0] == "twtscheduler")
                                {

                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "twitter";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                else if (networkingwithid[0] == "linscheduler")
                                {
                                    schmessage.ClientTime = Convert.ToDateTime(clienttime);
                                    schmessage.CreateTime = DateTime.Now;
                                    schmessage.ProfileType = "linkedin";
                                    schmessage.ProfileId = networkingwithid[1];
                                    schmessage.Id = Guid.NewGuid();
                                    schmessage.PicUrl = string.Empty;
                                    string servertime = this.CompareDateWithServer(clienttime, child + " " + time);
                                    schmessage.ScheduleTime = Convert.ToDateTime(servertime);
                                    schmessage.ShareMessage = message;
                                    schmessage.UserId = user.Id;
                                    schmessage.Status = false;

                                }
                                if (!string.IsNullOrEmpty(message))
                                {
                                    if (!schmsgrepo.checkMessageExistsAtTime(user.Id, schmessage.ShareMessage, schmessage.ScheduleTime, schmessage.ProfileId))
                                    {
                                        schmsgrepo.addNewMessage(schmessage);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (Request.QueryString["op"] == "insight")
                {
                    string check = "";
                    FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];
                    FacebookHelper objFbHelper = new FacebookHelper();
                    SocialProfile socioprofile = new SocialProfile();
                    SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
                    FacebookAccountRepository fbrepo = new FacebookAccountRepository();
                    FacebookClient fbClient = new FacebookClient(objFacebookAccount.AccessToken);
                    int fancountPage = 0;
                    dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + Request["id"].ToString() });

                    foreach (var friend in fancount.data)
                    {
                        fancountPage = Convert.ToInt32(friend.fan_count);
                    }
                    objFacebookAccount.Friends = Convert.ToInt32(fancountPage);
                    objFacebookAccount.FbUserId = Request["id"].ToString();
                    objFacebookAccount.FbUserName = Request["name"].ToString();
                    objFacebookAccount.Type = "page";
                    objFacebookAccount.UserId = user.Id;
                    socioprofile.Id = Guid.NewGuid();
                    socioprofile.ProfileDate = DateTime.Now;
                    socioprofile.ProfileId = Request["id"].ToString();
                    socioprofile.ProfileStatus = 1;
                    socioprofile.ProfileType = "facebook";
                    socioprofile.UserId = user.Id;
                    if (!fbrepo.checkFacebookUserExists(objFacebookAccount.FbUserId, user.Id))
                    {
                        fbrepo.addFacebookUser(objFacebookAccount);

                        Groups lstDetails = objGroupRepository.getGroupName(team.GroupId);
                        if (lstDetails.GroupName == "Socioboard")
                        {

                            TeamMemberProfile teammemberprofile = new TeamMemberProfile();
                            teammemberprofile.Id = Guid.NewGuid();
                            teammemberprofile.TeamId = team.Id;
                            teammemberprofile.ProfileId = objFacebookAccount.FbUserId;
                            teammemberprofile.ProfileType = "facebook";
                            teammemberprofile.StatusUpdateDate = DateTime.Now;

                            objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);

                        }

                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }
                    else
                    {
                        check = "exist";
                        Session["alreadypageexist"] = objFacebookAccount;
                        fbrepo.updateFacebookUser(objFacebookAccount);
                        if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                        {
                            socioprofilerepo.addNewProfileForUser(socioprofile);
                        }
                        else
                        {
                            socioprofilerepo.updateSocialProfile(socioprofile);
                        }
                    }

                    //get facebookpagefeeds
                    fbClient = new FacebookClient(objFacebookAccount.AccessToken);
                    FacebookHelper fbhelper = new FacebookHelper();
                    FacebookInsightStatsHelper fbiHelper = new FacebookInsightStatsHelper();
                    var feeds = fbClient.Get("/" + Request["id"].ToString() + "/feed");

                    fbiHelper.getPageImpresion(Request["id"].ToString(), user.Id, 15);
                    fbiHelper.getFanPageLikesByGenderAge(Request["id"].ToString(), user.Id, 15);
                    fbiHelper.getLocation(Request["id"].ToString(), user.Id, 15);
                    //  fbiHelper.getFanPost("459630637383010", user.Id, 10);
                    dynamic profile = fbClient.Get(Request["id"].ToString());
                    fbhelper.getFacebookUserFeeds(feeds, profile);
                    //end facebookpagefeeds

                    string id = "id";
                    string value = Request["id"].ToString();

                    Dictionary<string, string> Did = new Dictionary<string, string>();
                    Did.Add(id, value);

                    dynamic Pageid = Did;

                    // var friendgenderstats=fbClient.Get("me/friends?fields=gender");
                    objFbHelper.getfbFriendsGenderStatsForFanPage(Pageid, user.Id, ref objFacebookAccount);

                    Session["fbSocial"] = null;
                    Response.Write(RemainingAccount(user));
                }
                else if (Request.QueryString["op"] == "countmessages")
                {
                    try
                    {
                        int val = 0;
                        /*facebook*/
                        FacebookAccountRepository fbAccoutsRepo = new FacebookAccountRepository();
                        ArrayList lstfacebookAccounts = fbAccoutsRepo.getAllFacebookAccountsOfUser(user.Id);
                        foreach (FacebookAccount item in lstfacebookAccounts)
                        {
                            try
                            {
                                FacebookClient fb = new FacebookClient(item.AccessToken);
                                dynamic unreadcount = fb.Get("fql", new { q = "SELECT unread_count FROM mailbox_folder WHERE folder_id = 0 AND viewer_id = " + item.FbUserId + "" });
                                foreach (var chile in unreadcount.data)
                                {
                                    var count = chile.unread_count;
                                    int countable = Convert.ToInt32(count.ToString());
                                    val = val + countable;

                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message);
                                Console.WriteLine(ex.Message);
                            }
                        }
                        /*Twitter*/
                        Session["CountMessages"] = val;
                        Response.Write(val);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }

                }

                else if (Request.QueryString["op"] == "recentfollowers")
                {
                    string recentfollowers = string.Empty;
                    #region RecentFollowers
                    Users twtUsers = new Users();
                    TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                    ArrayList lstAccRepo = twtAccRepo.getAllTwitterAccountsOfUser(user.Id);
                    oAuthTwitter oauth = null;
                    foreach (TwitterAccount itemTwt in lstAccRepo)
                    {
                        oauth = new oAuthTwitter();
                        oauth.AccessToken = itemTwt.OAuthToken;
                        oauth.AccessTokenSecret = itemTwt.OAuthSecret;
                        oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                        oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                        oauth.TwitterScreenName = itemTwt.TwitterScreenName;
                        oauth.TwitterUserId = itemTwt.TwitterUserId;
                        JArray jarresponse = twtUsers.Get_Followers_ById(oauth, itemTwt.TwitterUserId);
                        foreach (var item in jarresponse)
                        {
                            int resposecount = 0;
                            if (item["ids"] != null)
                            {
                                foreach (var child in item["ids"])
                                {
                                    if (resposecount < 2)
                                    {
                                        JArray userprofile = twtUsers.Get_Users_LookUp(oauth, child.ToString());

                                        foreach (var items in userprofile)
                                        {
                                            resposecount++;
                                            try
                                            {
                                                recentfollowers += "<li><a href=\"https://twitter.com/" + items["screen_name"] + "\" target=\"_blank\"><img style=\"border:3px solid #FCFCFC;\" title=\"" + items["name"] + "\" width=\"48\" height=\"48\" alt=\"\" src=\"" + items["profile_image_url"] + "\"></a></li>";
                                            }
                                            catch (Exception ex)
                                            {
                                                Console.WriteLine(ex.Message);
                                            }

                                        }
                                    }
                                }
                            }
                        }
                    }

                    Response.Write(recentfollowers);

                    #endregion

                }
                else if (Request.QueryString["op"] == "removefollowers")
                {
                    string removeid = Request.QueryString["removeid"];
                    string userid = Request.QueryString["userid"];
                    Friendship friendship = new Friendship();
                    oAuthTwitter oauth = new oAuthTwitter();
                    TwitterAccountRepository twtaccrepo = new TwitterAccountRepository();
                    TwitterAccount twtAccount = twtaccrepo.getUserInformation(user.Id, userid);
                    oauth.TwitterUserId = twtAccount.TwitterUserId;
                    oauth.TwitterScreenName = twtAccount.TwitterScreenName;
                    oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"];
                    oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
                    oauth.AccessToken = twtAccount.OAuthToken;
                    oauth.AccessTokenSecret = twtAccount.OAuthSecret;
                    JArray responseremove = friendship.Post_Friendship_Destroy(oauth, removeid);

                }
                //for Deleting socialqueue Message

                else if (Request.QueryString["op"] == "deletequeuemsg")
                {
                    try
                    {
                        string res = string.Empty;
                        string messageId = Request.QueryString["messageid"].ToString();
                        Guid userid = user.Id;
                        ScheduledMessageRepository obj = new ScheduledMessageRepository();
                        bool check = obj.deleteScheduleMessage(userid, messageId);
                        if (check == true)
                        {
                            res = "success";
                        }
                        else
                        {

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

                    //for Editing socialqueue Message
                else if (Request.QueryString["op"] == "Editqueuemsg")
                {
                    try
                    {
                        string messageId = Request.QueryString["messageid"].ToString();
                        string newstr = Request.QueryString["newstr"];
                        Guid userid = user.Id;
                        DateTime dt = DateTime.Now;
                        ScheduledMessageRepository obj = new ScheduledMessageRepository();
                        obj.UpdateScheduleMessage(userid, messageId, newstr, dt);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);

                    }
                }

                else if (Request.QueryString["op"] == "wooqueuemessages")
                {
                    string profileid = string.Empty;
                    ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository();
                    List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id);
                    foreach (TeamMemberProfile item in allprofiles)
                    {
                        profileid += item.ProfileId + ',';

                    }
                    profileid = profileid.Substring(0, profileid.Length - 1);

                    List<ScheduledMessage> lstschMsg = schmsgRepo.getAllMessagesDetail(profileid);
                    string schmessages = string.Empty;
                    //string profurl = string.Empty;
                    //if (string.IsNullOrEmpty(user.ProfileUrl))
                    //{
                    string profurls = "../Contents/img/blank_img.png";
                    //}
                    //else
                    //{
                    //    // profurl = "../Contents/img/blank_img.png";
                    //    profurl = user.ProfileUrl;
                    //}
                    if (lstschMsg.Count != 0)
                    {
                        foreach (ScheduledMessage item in lstschMsg)
                            try
                            {
                                UserRepository objUserRepository=new UserRepository();
                                User objuser = objUserRepository.getUsersById(item.UserId);
                                string profurl = string.Empty;
                                if (string.IsNullOrEmpty(objuser.ProfileUrl))
                                {
                                    profurl = "../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    // profurl = "../Contents/img/blank_img.png";
                                    profurl = objuser.ProfileUrl;
                                }

                                {
                                    schmessages += "<section class=\"section\"><div  class=\"js-task-cont read\">" +
                                                             "<section class=\"task-owner\">" +
                                                                 "<img width=\"32\" height=\"32\" border=\"0\" src=\"" + profurl + "\" class=\"avatar\">" +
                                                             "</section>" +
                                                             "<section class=\"task-activity third\">" +
                                                                 "<p>" + objuser.UserName + "</p>" +
                                                                 "<div>" + CompareDateWithServerNew(item.ClientTime, item.CreateTime, item.ScheduleTime) + "</div>" +
                                                                 "<input type=\"hidden\" value=\"#\" id=\"hdntaskid_1\">" +
                                                                 "<p></p>" +
                                                           "</section>" +
                                                           "<section class=\"task-message font-13 third\" style=\"height: auto; width: 31%; margin-right: 9px;\"><a id=\"edit_" + item.Id + "\" onclick=\"Editqueue('" + item.Id + "','" + item.ShareMessage + "');\" class=\"tip_left\">" + gethtmlfromstring(item.ShareMessage) + "</a></section>";

                                    if (item.ProfileType == "facebook")
                                    {
                                        schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                            "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\">" +
                                                            "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                                "<img  alt=\"\" src=\"../Contents/img/facebook.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                        TwitterAccount twtAccount = twtAccRepo.getUserInformation(item.ProfileId);
                                        if (twtAccount != null)
                                        {
                                            schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                            "<img width=\"48\" height=\"48\" src=\"" + twtAccount.ProfileImageUrl + "\" alt=\"\">" +
                                                            "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                                "<img  alt=\"\" src=\"../Contents/img/twitter.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                        }
                                    }
                                    else if (item.ProfileType == "linkedin")
                                    {
                                        LinkedInAccountRepository linkAccRepo = new LinkedInAccountRepository();
                                        LinkedInAccount linkedAccount = linkAccRepo.getUserInformation(item.ProfileId);
                                        if (linkedAccount != null)
                                        {
                                            schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" +
                                                                "<img width=\"48\" height=\"48\" src=\"" + linkedAccount.ProfileImageUrl + "\" alt=\"\">" +
                                                                "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" +
                                                                    "<img  alt=\"\" src=\"../Contents/img/link.png\" style=\"height: 16px;width: 16x;\"></a></div>";
                                        }

                                    }
                                    string status = (item.Status == true) ? "Completed" : "Pending";
                                    schmessages += "<section class=\"task-status\" style=\"width:34px;\"><div class=\"ui_light floating task_status_change\">" +
                                        //"<a href=\"#nogo\" class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" +
                                                    "<a class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" +
                                                   "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" +
                                                  "<div class=\"ui_light floating task_status_change\">" +
                                                           "<span class=\"ui-sproutmenu-status\">" + status + "</span>" +
                                                  "</div>" +
                                              "</section>" +

                                               "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" +
                                                  "<div class=\"ui_light floating task_status_change\">" +
                                                           "<span  class=\"ui-sproutmenu-status\"><img title=\"Delete\" onclick=\"deletequeue(this.id)\" style=\"width:33px;margin-left:60px;margin-top:-10px;\" img src=\"../Contents/img/deleteimage.png\" img id=\"" + item.Id + "\"></span>" +
                                                  "</div>" +
                                              "</section>" +

                                           "</div></section>";
                                }
                            }
                            catch (Exception ex)
                            {
                                 logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                               Response.Write(schmessages);
                            }
                    }
                    else
                    {
                        schmessages = "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" +
                          "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurls + "\">" +
                          "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" +
                          "<a class=\"tip_left\">No Scheduled Messages</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" +
                            //"<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" +
                          "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\">" +
                          "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>";
                    }
                    Response.Write(schmessages);

                }
                else if (Request.QueryString["op"] == "drafts_messages")
                {

                }
                else if (Request.QueryString["op"] == "updatequeue")
                {

                    updatequeue(Request.QueryString["id"], Request.QueryString["status"]);

                }

                else if (Request.QueryString["op"] == "messagechk")
                {
                    SocioBoard.Domain.Messages mstable = new SocioBoard.Domain.Messages();
                    string[] types = Request.QueryString["type[]"].Split(',');
                    DataSet ds = (DataSet)Session["MessageDataTable"];
                    DataSet dss = DataTableGenerator.CreateDataSetForTable(mstable);
                    DataTable dtt = dss.Tables[0];
                    DataView dv = new DataView(dtt);
                    AjaxMessage ajxfed = new AjaxMessage();
                    string message = string.Empty;
                    foreach (var item in types)
                    {
                        try
                        {
                            DataRow[] foundRows = ds.Tables[0].Select("Type = '" + item + "'");
                            foreach (var child in foundRows)
                            {
                                dtt.ImportRow(child);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.Message);
                            Console.WriteLine(ex.Message);
                        }
                    }
                    message = ajxfed.BindData(dtt);
                    Response.Write(message);
                }
            }
        }
Exemplo n.º 21
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            Groups groups = new Groups();
            GroupRepository objGroupRepository = new GroupRepository();
            Team teams = new Team();
            TeamRepository objTeamRepository = new TeamRepository();

            try
            {
                Session["login"] = null;
                Registration regpage = new Registration();
                User user = (User)Session["LoggedUser"];

                if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium")
                {

                    if (TextBox1.Text.Trim() != "")
                    {
                        string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString();
                        if (resp != "valid")
                        {
                            // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert(Not valid);", true);
                            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true);
                            return;
                        }
                    }

                    if (user != null)
                    {
                        user.EmailId = txtEmail.Text;
                        user.UserName = txtFirstName.Text + " " + txtLastName.Text;
                        UserActivation objUserActivation = new UserActivation();
                        UserRepository userrepo = new UserRepository();
                        Coupon objCoupon = new Coupon();
                        CouponRepository objCouponRepository = new CouponRepository();
                        if (userrepo.IsUserExist(user.EmailId))
                        {

                            try
                            {
                                string acctype = string.Empty;
                                if (Request.QueryString["type"] != null)
                                {
                                    if (Request.QueryString["type"] == "INDIVIDUAL" || Request.QueryString["type"] == "CORPORATION" || Request.QueryString["type"] == "SMALL BUSINESS")
                                    {
                                        acctype = Request.QueryString["type"];
                                    }
                                    else
                                    {
                                        acctype = "INDIVIDUAL";
                                    }
                                }
                                else
                                {
                                    acctype = "INDIVIDUAL";
                                }

                                user.AccountType = Request.QueryString["type"];
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.StackTrace);
                                Console.WriteLine(ex.StackTrace);
                            }

                            user.AccountType = DropDownList1.SelectedValue.ToString();
                            if (string.IsNullOrEmpty(user.AccountType))
                            {
                                user.AccountType = AccountType.Free.ToString();
                            }

                            if (string.IsNullOrEmpty(user.Password))
                            {
                                user.Password = regpage.MD5Hash(txtPassword.Text);
                                // userrepo.UpdatePassword(user.EmailId, user.Password, user.Id, user.UserName, user.AccountType);
                                string couponcode = TextBox1.Text.Trim();
                                userrepo.SetUserByUserId(user.EmailId, user.Password, user.Id, user.UserName, user.AccountType, couponcode);

                                try
                                {
                                    if (TextBox1.Text.Trim() != "")
                                    {
                                        objCoupon.CouponCode = TextBox1.Text.Trim();
                                        List<Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon);
                                        objCoupon.Id = lstCoupon[0].Id;
                                        objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate;
                                        objCoupon.ExpCouponDate = lstCoupon[0].ExpCouponDate;
                                        objCoupon.Status = "1";
                                        objCouponRepository.SetCouponById(objCoupon);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }

                                //add userActivation

                                try
                                {
                                    objUserActivation.Id = Guid.NewGuid();
                                    objUserActivation.UserId = user.Id;
                                    objUserActivation.ActivationStatus = "0";
                                    UserActivationRepository.Add(objUserActivation);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }

                                //add package start

                                try
                                {
                                    UserPackageRelation objUserPackageRelation = new UserPackageRelation();
                                    UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                                    PackageRepository objPackageRepository = new PackageRepository();

                                    Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                                    objUserPackageRelation.Id = Guid.NewGuid();
                                    objUserPackageRelation.PackageId = objPackage.Id;
                                    objUserPackageRelation.UserId = user.Id;
                                    objUserPackageRelation.ModifiedDate = DateTime.Now;
                                    objUserPackageRelation.PackageStatus = true;

                                    objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);

                                    //end package

                                    MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());

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

                                try
                                {
                                    groups.Id = Guid.NewGuid();
                                    groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
                                    groups.UserId = user.Id;
                                    groups.EntryDate = DateTime.Now;

                                    objGroupRepository.AddGroup(groups);

                                    teams.Id = Guid.NewGuid();
                                    teams.GroupId = groups.Id;
                                    teams.UserId = user.Id;
                                    teams.EmailId = user.EmailId;
                                    // teams.FirstName = user.UserName;
                                    objTeamRepository.addNewTeam(teams);

                                    BusinessSettingRepository busnrepo = new BusinessSettingRepository();
                                    //SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"];
                                    SocioBoard.Domain.BusinessSetting objbsnssetting = new SocioBoard.Domain.BusinessSetting();

                                    if (!busnrepo.checkBusinessExists(user.Id, groups.GroupName))
                                    {
                                        objbsnssetting.Id = Guid.NewGuid();
                                        objbsnssetting.BusinessName = groups.GroupName;
                                        //objbsnssetting.GroupId = team.GroupId;
                                        objbsnssetting.GroupId = groups.Id;
                                        objbsnssetting.AssigningTasks = false;
                                        objbsnssetting.AssigningTasks = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.FbPhotoUpload = 0;
                                        objbsnssetting.UserId = user.Id;
                                        objbsnssetting.EntryDate = DateTime.Now;
                                        busnrepo.AddBusinessSetting(objbsnssetting);

                                    }

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

                            }
                        }
                        Session["LoggedUser"] = user;

                        Response.Redirect("Home.aspx");
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
                }
            }
            catch (Exception ex)
            {

                logger.Error(ex.StackTrace);
                Console.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Varibles Initialize
            UserRepository userrepo = new UserRepository();
            Registration regObject = new Registration();
            TeamRepository objTeamRepo = new TeamRepository();
            NewsRepository objNewsRepo = new NewsRepository();
            AdsRepository objAdsRepo = new AdsRepository();
            SocialProfilesRepository objSocioRepo = new SocialProfilesRepository();
            #endregion
            SocioBoard.Domain.User user = (User)Session["LoggedUser"];
            if (!IsPostBack)
            {
                try
                {
                   if (user == null)
                        Response.Redirect("Default.aspx");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }

                if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                {
                    try
                    {
                        userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]);

                        User newUser = (User)Session["LoggedUser"];
                        newUser.Id = user.Id;
                        newUser.Password = user.Password;
                        newUser.PaymentStatus = user.PaymentStatus;
                        newUser.ProfileUrl = user.ProfileUrl;
                        newUser.TimeZone = user.TimeZone;
                        newUser.UserName = user.UserName;
                        newUser.UserStatus = user.UserStatus;
                        newUser.AccountType = Request.QueryString["type"];
                        newUser.CreateDate = user.CreateDate;
                        newUser.ExpiryDate = user.ExpiryDate;
                        newUser.EmailId = user.EmailId;
                        Session["LoggedUser"] = null;
                        Session["LoggedUser"] = newUser;
                        user.AccountType  = newUser.AccountType;

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        logger.Error(ex.StackTrace);
                    }
                }
                #region Count Used Accounts
                try
                {

                    PackageRepository packageRepo = new PackageRepository();
                    List<Package> lstPackage = packageRepo.getAllPackage();

                    foreach (Package item in lstPackage)
                    {
                        if (user.AccountType.ToLower() == item.PackageName.ToLower())
                        {
                            tot_acc = item.TotalProfiles;
                            break;
                        }
                    }

                    profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count;
                    Session["ProfileCount"] = profileCount;
                    Session["TotalAccount"] = tot_acc;
                    usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc;
                }
                catch(Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion
                #region News

                acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts";
                teamMem.InnerHtml = "managing " + user.UserName;
                try
                {
                    News nws = objNewsRepo.getNewsForHome();
                    divNews.InnerHtml = nws.NewsDetail;
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                try
                {
                    ArrayList lstads = objAdsRepo.getAdsForHome();
                    foreach (var item in lstads)
                    {
                        Array temp = (Array)item;
                        imgAds.ImageUrl = temp.GetValue(2).ToString();
                        break;
                        // ads.ImageUrl;
                    }
                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                    logger.Error(Err.StackTrace);
                }
                #endregion
                #region Team Member Count
                try
                {

                    GroupRepository grouprepo = new GroupRepository();
                    string groupsofhome = string.Empty;
                    List<Groups> lstgroups = grouprepo.getAllGroups(user.Id);
                    if (lstgroups.Count != 0)
                    {
                        foreach (Groups item in lstgroups)
                        {
                            groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>";
                        }
                        getAllGroupsOnHome.InnerHtml = groupsofhome;
                    }
                }
                catch(Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

                try
                {
                     string strTeam = string.Empty;
                        List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id);
                        foreach (Team item in team)
                        {
                            strTeam +=  "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">"+
                                        "<img width=\"48\" height=\"48\" title=\""+ item.FirstName +"\" alt=\"\" src=\"../Contents/img/blank_img.png\">" +
                                        "</a></div>";
                        }
                        team_member.InnerHtml = strTeam;

                }
                catch (Exception Err)
                {
                    Console.Write(Err.StackTrace);
                }

                #region Add Fan Page
                try
                {
                    if (Session["fbSocial"] != null)
                    {
                        if (Session["fbSocial"] == "p")
                        {
                            FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"];

                            //    string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts";
                            // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"];
                            //    string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token);
                            //    JObject output = objWebRequest.FacebookRequest(strData, "Get");
                            FacebookClient fb = new FacebookClient();
                            fb.AccessToken = objFacebookAccount.AccessToken;
                            dynamic output = fb.Get("/me/accounts");
                            //  JArray data = (JArray)output["data"];
                            DataTable dtFbPage = new DataTable();
                            dtFbPage.Columns.Add("Email");
                            dtFbPage.Columns.Add("PageId");
                            dtFbPage.Columns.Add("PageName");
                            dtFbPage.Columns.Add("status");
                            dtFbPage.Columns.Add("customer_id");
                            string strPageDiv = string.Empty;
                            if (output != null)
                            {
                                foreach (var item in output["data"])
                                {
                                    if (item.category.ToString() != "Application")
                                    {
                                        strPageDiv += "<div><a id=\"A1\"  onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>";
                                        fbpage.InnerHtml = strPageDiv;
                                    }
                                }
                            }
                            else
                            {
                                strPageDiv += "<div>No Pages Found</div>";
                            }
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true);
                            Session["fbSocial"] = null;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    logger.Error(ex.StackTrace);
                }
                #endregion
                #region InsightsData
                try
                {
                    decimal malecount = 0, femalecount = 0, cnt = 0;

                    FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository();
                    double daysSub = (DateTime.Now - user.CreateDate).TotalDays;
                    int userdays = (int)daysSub;
                    ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays);
                    Random rNum = new Random();
                    foreach (var item in arrFbStats)
                    {
                        Array temp = (Array)item;
                        cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString());
                        malecount += int.Parse(temp.GetValue(3).ToString());
                        femalecount += int.Parse(temp.GetValue(4).ToString());
                    }
                    try
                    {
                        decimal mc = (malecount / cnt) * 100;
                        male = Convert.ToInt16(mc);
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    try
                    {
                        decimal fc = (femalecount / cnt) * 100;
                        female = Convert.ToInt16(fc);
                    }
                    catch (Exception Err)
                    {
                        Console.Write(Err.StackTrace);
                        logger.Error(Err.StackTrace);
                    }
                    int twtAccCount=objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count;
                    if (twtAccCount > 1)
                    {
                        twtmale = rNum.Next(100);
                        twtfemale = 100 - twtmale;
                    }
                    else if (twtAccCount == 1)
                    {
                        twtmale = 100;
                        twtfemale = 0;
                    }
                    Session["twtGender"] = twtmale + "," + twtfemale;
                }
                catch (Exception Err)
                {
                    Console.Write(Err.Message.ToString());
                    logger.Error(Err.StackTrace);
                }
                getgrphData();
                getNewFriends(7);
                getNewFollowers(7);
                #endregion
                #region IncomingMessages
                try
                {
                    FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository();
                    int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id);
                    TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository();
                    int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id);
                    Session["CountMessages"] = fbmessagescout + twtcount;
                }
                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                }
                #endregion

            }
        }
Exemplo n.º 23
0
        public void ProcessRequest()
        {
            if (Request.QueryString["op"] == "login")
            {
                try
                {
                    string email = Request.QueryString["username"];
                    string password = Request.QueryString["password"];
                    Registration regpage = new Registration();
                    password = regpage.MD5Hash(password);
                    SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                    UserRepository userrepo = new UserRepository();
                    LoginLogs objLoginLogs = new LoginLogs();
                    LoginLogsRepository objLoginLogsRepository = new LoginLogsRepository();
                    User user = userrepo.GetUserInfo(email, password);
                    if (user == null)
                    {
                        Response.Write("Invalid Email or Password");
                    }
                    else
                    {
                        if (user.UserStatus == 1)
                        {
                            Session["LoggedUser"] = user;
                            // List<User> lstUser = new List<User>();
                            if (Session["LoggedUser"] != null)
                            {
                                //SocioBoard.Domain.User.lstUser.Add((User)Session["LoggedUser"]);
                                //Application["OnlineUsers"] = SocioBoard.Domain.User.lstUser;
                                //objLoginLogs.Id = new Guid();
                                //objLoginLogs.UserId = user.Id;
                                //objLoginLogs.UserName = user.UserName;
                                //objLoginLogs.LoginTime = DateTime.Now.AddHours(11.50);
                                //objLoginLogsRepository.Add(objLoginLogs);
                                Groups objGroups = new Groups();
                                GroupRepository objGroupRepository = new GroupRepository();
                                Team objteam = new Team();
                                TeamRepository objTeamRepository = new TeamRepository();
                                objGroups = objGroupRepository.getGroupDetail(user.Id);
                                if (objGroups == null)
                                {
                                    //================================================================================
                                    //Insert into group

                                    try
                                    {
                                        objGroups = new Groups();
                                        objGroups.Id = Guid.NewGuid();
                                        objGroups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
                                        objGroups.UserId = user.Id;
                                        objGroups.EntryDate = DateTime.Now;
                                        objGroupRepository.AddGroup(objGroups);

                                        objteam.Id = Guid.NewGuid();
                                        objteam.GroupId = objGroups.Id;
                                        objteam.UserId = user.Id;
                                        objteam.EmailId = user.EmailId;
                                        // teams.FirstName = user.UserName;
                                        objTeamRepository.addNewTeam(objteam);

                                        SocialProfile objSocialProfile = new SocialProfile();
                                        SocialProfilesRepository objSocialProfilesRepository = new SocialProfilesRepository();

                                        List<SocialProfile> lstSocialProfile = objSocialProfilesRepository.getAllSocialProfilesOfUser(user.Id);
                                        if (lstSocialProfile != null)
                                        {
                                            if (lstSocialProfile.Count > 0)
                                            {
                                                foreach (SocialProfile item in lstSocialProfile)
                                                {
                                                    try
                                                    {
                                                        TeamMemberProfile objTeamMemberProfile = new TeamMemberProfile();
                                                        TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                                                        objTeamMemberProfile.Id = Guid.NewGuid();
                                                        objTeamMemberProfile.TeamId = objteam.Id;
                                                        objTeamMemberProfile.ProfileId = item.ProfileId;
                                                        objTeamMemberProfile.ProfileType = item.ProfileType;
                                                        objTeamMemberProfile.Status = item.ProfileStatus;
                                                        objTeamMemberProfile.StatusUpdateDate = DateTime.Now;
                                                        objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);
                                                    }

                                                }
                                            }
                                        }



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

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

                                }

                                BusinessSetting objBusinessSetting = new BusinessSetting();
                                BusinessSettingRepository objBusinessSettingRepository = new BusinessSettingRepository();
                                List<BusinessSetting> lstBusinessSetting = objBusinessSettingRepository.GetBusinessSettingByUserId(user.Id);
                                if (lstBusinessSetting.Count == 0)
                                {
                                    try
                                    {
                                        List<Groups> lstGroups = objGroupRepository.getAllGroups(user.Id);
                                        foreach (Groups item in lstGroups)
                                        {
                                            objBusinessSetting = new BusinessSetting();
                                            objBusinessSetting.Id = Guid.NewGuid();
                                            objBusinessSetting.BusinessName = item.GroupName;
                                            //objbsnssetting.GroupId = team.GroupId;
                                            objBusinessSetting.GroupId = item.Id;
                                            objBusinessSetting.AssigningTasks = false;
                                            objBusinessSetting.AssigningTasks = false;
                                            objBusinessSetting.TaskNotification = false;
                                            objBusinessSetting.TaskNotification = false;
                                            objBusinessSetting.FbPhotoUpload = 0;
                                            objBusinessSetting.UserId = user.Id;
                                            objBusinessSetting.EntryDate = DateTime.Now;
                                            objBusinessSettingRepository.AddBusinessSetting(objBusinessSetting);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.StackTrace);
                                    }
                                }

                            }
                            Response.Write("user");
                        }

                        else
                        {
                            Response.Write("You are Blocked by Admin Please contact Admin!");
                        }


                    }
                }
                catch (Exception ex)
                {
                    Response.Write("Error: " + ex.Message);
                    Console.WriteLine(ex.StackTrace);
                    logger.Error(ex.StackTrace);
                }
            }
            else if (Request.QueryString["op"] == "register")
            {
                User user = new User();
                UserActivation objUserActivation = new UserActivation();
                UserRepository userrepo = new UserRepository();
                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                Session["AjaxLogin"] = "******";
                try
                {
                    System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
                    string line = "";
                    line = sr.ReadToEnd();
                    JObject jo = JObject.Parse(line);
                    user.PaymentStatus = "unpaid";
                    if (!string.IsNullOrEmpty(Request.QueryString["type"]))
                    {
                        user.AccountType = Request.QueryString["type"];
                    }
                    else
                    {
                        user.AccountType = "deluxe";
                    }
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id = Guid.NewGuid();
                    user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]);
                    user.EmailId = Server.UrlDecode((string)jo["email"]);
                    user.Password = Server.UrlDecode((string)jo["password"]);
                    user.UserStatus = 1;
                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);
                        Session["LoggedUser"] = user;
                        Response.Write("user");

                        objUserActivation.Id = Guid.NewGuid();
                        objUserActivation.UserId = user.Id;
                        objUserActivation.ActivationStatus = "0";
                        UserActivationRepository.Add(objUserActivation);

                        //add value in userpackage
                        UserPackageRelation objUserPackageRelation = new UserPackageRelation();
                        UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                        PackageRepository objPackageRepository = new PackageRepository();

                        Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                        objUserPackageRelation.Id = new Guid();
                        objUserPackageRelation.PackageId = objPackage.Id;
                        objUserPackageRelation.UserId = user.Id;
                        objUserPackageRelation.PackageStatus = true;

                        objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);


                        SocioBoard.Helper.MailSender.SendEMail(user.UserName, user.Password, user.EmailId, user.AccountType.ToString(), user.Id.ToString());




                        //MailSender.SendEMail(user.UserName, user.Password, user.EmailId);
                        // lblerror.Text = "Registered Successfully !" + "<a href=\"login.aspx\">Login</a>";
                    }
                    else
                    {
                        Response.Write("Email Already Exists !");
                    }
                }


                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);


                    Console.WriteLine(ex.StackTrace);
                }


            }
            else if (Request.QueryString["op"] == "facebooklogin")
            {
                SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");

                string redi = "http://www.facebook.com/dialog/oauth/?scope=publish_stream,read_stream,read_insights,manage_pages,user_checkins,user_photos,read_mailbox,manage_notifications,read_page_mailboxes,email,user_videos,offline_access&client_id=" + ConfigurationManager.AppSettings["ClientId"] + "&redirect_uri=" + ConfigurationManager.AppSettings["RedirectUrl"] + "&response_type=code";
                Session["login"] = "******";
                Response.Write(redi);



            }
            else if (Request.QueryString["op"] == "googlepluslogin")
            {
                Session["login"] = "******";
                oAuthToken objToken = new oAuthToken();
                Response.Write(objToken.GetAutherizationLink("https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/plus.me+https://www.googleapis.com/auth/plus.login"));
            }
            else if (Request.QueryString["op"] == "removeuser")
            {
                try
                {
                    if (Session["LoggedUser"] != null)
                    {
                        SocioBoard.Domain.User.lstUser.Remove((User)Session["LoggedUser"]);
                    }
                }
                catch (Exception Err)
                {
                    logger.Error(Err.StackTrace);
                    Response.Write(Err.StackTrace);
                }
            }


        }
Exemplo n.º 24
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);
            }
        }