Ejemplo n.º 1
0
    protected void lstNotification_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        HiddenField hdnReqID     = (HiddenField)e.Item.FindControl("hdnReqID");
        HiddenField hdnPkId      = (HiddenField)e.Item.FindControl("hdnPkId");
        HiddenField hdnTableName = (HiddenField)e.Item.FindControl("hdnTableName");
        Label       lblEmailId   = (Label)e.Item.FindControl("lblEmailId");
        //Label lblDescription = (Label)e.Item.FindControl("lblDescription");
        Label       lblUserType          = (Label)e.Item.FindControl("lblUserType");
        Label       lblGroupName         = (Label)e.Item.FindControl("lblGroupName");
        HiddenField hdnrequserid         = (HiddenField)e.Item.FindControl("hdnrequserid");
        HiddenField hdnRegistrationId    = (HiddenField)e.Item.FindControl("hdnRegID");
        HiddenField hdnintUserTypeId     = (HiddenField)e.Item.FindControl("hdnintUserTypeId");
        LinkButton  lnkConfirm           = (LinkButton)e.Item.FindControl("lnkConfirm");
        LinkButton  lnkCancel            = (LinkButton)e.Item.FindControl("lnkCancel");
        HiddenField hdnIsAccept          = (HiddenField)e.Item.FindControl("hdnIsAccept");
        HiddenField hdnStrRecommendation = (HiddenField)e.Item.FindControl("hdnStrRecommendation");
        HiddenField hdnShareInvitee      = (HiddenField)e.Item.FindControl("hdnShareInvitee");

        hdnEmailId.Value          = lblEmailId.Text;
        ViewState["lblGroupName"] = lblGroupName.Text;

        if (e.CommandName == "Details")
        {
            if (hdnRegistrationId.Value != Convert.ToString(ViewState["UserID"]))
            {
                Response.Redirect("Notifications_Details_2.aspx");
            }
        }

        if (e.CommandName == "ShareDetails")
        {
            if (hdnTableName.Value == "Scrl_GrpShareUserStatusTbl")
            {
                Response.Redirect(hdnStrRecommendation.Value);
                return;
            }

            if (hdnRegistrationId.Value != Convert.ToString(ViewState["UserID"]))
            {
                Response.Redirect("Group-Profile.aspx?GrpId=" + hdnrequserid.Value);
            }
        }

        if (e.CommandName == "QAShareDetails")
        {
            if (hdnRegistrationId.Value != Convert.ToString(ViewState["UserID"]))
            {
                Response.Redirect(hdnStrRecommendation.Value);
            }
        }
        if (e.CommandName == "BlogShareDetails")
        {
            if (hdnRegistrationId.Value != Convert.ToString(ViewState["UserID"]))
            {
                Response.Redirect(hdnStrRecommendation.Value);
            }
        }

        if (e.CommandName == "Confirm")
        {
            if (hdnTableName.Value == "Scrl_UserRequestInvitationTbl")
            {
                objRegistration.intRequestInvitaionId = Convert.ToInt32(hdnPkId.Value);
                objRegistration.AddedBy   = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRegistration.IpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRegistration.IpAddress == null)
                {
                    objRegistration.IpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRegistrationDB.AddEditDel_Request(objRegistration, DA_Registrationdetails.RegistrationDetails.Update);
                SendMail(e.CommandName, hdnTableName.Value);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "starScripts", "CallUserMethod();", true);
            }

            else if (hdnTableName.Value == "Scrl_UserGroupJoiningTbl")
            {
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDO.intAddedBy       = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.isAccepted       = 1;
                objGrpJoinDO.strIpAddress     = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objGrpJoinDO.strIpAddress == null)
                {
                    objGrpJoinDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Update);
                SendMail(e.CommandName, hdnTableName.Value);
            }

            else if (hdnTableName.Value == "Scrl_UserRecommendationTbl")
            {
                objRecmndDO.intRecommendationId = Convert.ToInt32(hdnPkId.Value);
                objRecmndDO.intAddedBy          = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRecmndDO.strIpAddress        = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRecmndDO.strIpAddress == null)
                {
                    objRecmndDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRecmndDA.Scrl_AddEditDelRecommendations(objRecmndDO, DA_Scrl_UserRecommendation.Scrl_UserRecommendation.Update);
                SendMail(e.CommandName, hdnTableName.Value);
                if (lblmaster.InnerText == "Home")
                {
                    Response.Redirect("Home.aspx");
                }
            }
            else if (hdnTableName.Value == "Scrl_OrgEndorsement")
            {
                objRecmndDO.intOrgEndorseId = Convert.ToInt32(hdnPkId.Value);
                objRecmndDO.intAddedBy      = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRecmndDO.strIpAddress    = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRecmndDO.strIpAddress == null)
                {
                    objRecmndDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRecmndDA.Scrl_AddEditDelOrganization(objRecmndDO, DA_Scrl_UserRecommendation.Scrl_OrgMessage.UpdateEnodorsement);
            }
            else if (hdnTableName.Value == "Scrl_OrgnisationGroupJoiningTbl")
            {
                if (objGrpJoinDO.strIpAddress == null)
                {
                    objGrpJoinDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDO.intRequestJoinId  = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDO.intAddedBy        = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.intRegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.isAccepted        = 1;
                objGrpJoinDA.AddEditDel_Scrl_OrgnisationGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_OrgnisationGroupJoin.Update);
            }
            else if (hdnTableName.Value == "Scrl_RequestGroupJoin")
            {
                objgrp.intAddedBy = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objgrp.inGroupId  = Convert.ToInt32(hdnShareInvitee.Value);
                DataSet ds = new DataSet();
                ds = objgrpDB.GetDataSet(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetOtherGroupDetailsByGroupId);

                if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "A")
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "0")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "1")
                        {
                            objGrpJoinDO.isAccepted = 2;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "2")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }
                    }
                    else
                    {
                        if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "A")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }
                    }
                }

                else if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "R")
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "0")
                        {
                            objGrpJoinDO.isAccepted = 1;
                            return;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "1")
                        {
                            objGrpJoinDO.isAccepted = 2;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "2")
                        {
                            objGrpJoinDO.isAccepted = 0;
                        }
                    }
                }

                objGrpJoinDO.isAccepted       = 1;
                objGrpJoinDO.inGroupId        = Convert.ToInt32(hdnShareInvitee.Value);
                objGrpJoinDO.intInvitedUserId = Convert.ToInt32(hdnRegistrationId.Value);
                string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (ip == null)
                {
                    ip = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDO.strIpAddress = ip;

                objGrpJoinDO.intAddedBy        = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.intRegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
                DataTable dtt = objGrpJoinDA.GetDataTable(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.GetDataFrom);
                if (dtt.Rows.Count == 0)
                {
                    objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Insert);
                    objGrpJoinDO.intInvitedUserId  = Convert.ToInt32(Session["ExternalUserId"].ToString());
                    objGrpJoinDO.intAddedBy        = Convert.ToInt32(Session["ExternalUserId"].ToString());
                    objGrpJoinDO.intRegistrationId = Convert.ToInt32(hdnRegistrationId.Value);
                }
                else
                {
                    objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Insert);
                }
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.UpdateGroupMember);

                SendMail(e.CommandName, hdnTableName.Value);
            }
            BindAllRequest();
            BindNotificationRequest();
            BindTopNotifcations();

            if (lblmaster.InnerText == "All Notifications")
            {
                Response.Redirect("Notifications_Details_2.aspx");
            }
        }

        if (e.CommandName == "Delete")
        {
            if (hdnTableName.Value == "Scrl_UserRequestInvitationTbl")
            {
                objRegistration.intRequestInvitaionId = Convert.ToInt32(hdnPkId.Value);
                objRegistration.AddedBy   = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRegistration.IpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRegistration.IpAddress == null)
                {
                    objRegistration.IpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRegistrationDB.AddEditDel_Request(objRegistration, DA_Registrationdetails.RegistrationDetails.Delete);
                SendMail(e.CommandName, hdnTableName.Value);
            }
            else if (hdnTableName.Value == "Scrl_UserGroupJoiningTbl")
            {
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDO.intAddedBy       = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.isAccepted       = 2;
                objGrpJoinDO.strIpAddress     = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objGrpJoinDO.strIpAddress == null)
                {
                    objGrpJoinDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Update);
                SendMail(e.CommandName, hdnTableName.Value);
            }
            else if (hdnTableName.Value == "Scrl_UserRecommendationTbl")
            {
                objRecmndDO.intRecommendationId = Convert.ToInt32(hdnPkId.Value);
                objRecmndDO.intAddedBy          = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRecmndDO.strIpAddress        = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRecmndDO.strIpAddress == null)
                {
                    objRecmndDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRecmndDA.Scrl_AddEditDelRecommendations(objRecmndDO, DA_Scrl_UserRecommendation.Scrl_UserRecommendation.Delete);
                SendMail(e.CommandName, hdnTableName.Value);
            }
            else if (hdnTableName.Value == "Scrl_OrgEndorsement")
            {
                objRecmndDO.intRecommendationId = Convert.ToInt32(hdnPkId.Value);
                objRecmndDO.intAddedBy          = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRecmndDO.strIpAddress        = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRecmndDO.strIpAddress == null)
                {
                    objRecmndDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRecmndDA.Scrl_AddEditDelRecommendations(objRecmndDO, DA_Scrl_UserRecommendation.Scrl_UserRecommendation.Delete);
            }
            else if (hdnTableName.Value == "Scrl_RequestGroupJoin")
            {
                objGrpJoinDO.intAddedBy   = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objGrpJoinDO.strIpAddress == null)
                {
                    objGrpJoinDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.DeleteGroupMember);
                SendMail(e.CommandName, hdnTableName.Value);
            }

            BindNotificationRequest();
            BindTopNotifcations();

            if (lblmaster.InnerText == "All Notifications")
            {
                Response.Redirect("Notifications_Details_2.aspx");
            }
        }
    }
Ejemplo n.º 2
0
    protected void lstChildMyTag_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        HiddenField hdnPkId           = (HiddenField)e.Item.FindControl("hdnPkId");
        HiddenField hdnTableName      = (HiddenField)e.Item.FindControl("hdnTableName");
        Label       lblEmailId        = (Label)e.Item.FindControl("lblEmailId");
        Label       lblGroupName      = (Label)e.Item.FindControl("lblGroupName");
        HiddenField hdnrequserid      = (HiddenField)e.Item.FindControl("hdnrequserid");
        HiddenField hdnRegistrationId = (HiddenField)e.Item.FindControl("hdnRegID");
        LinkButton  lnkstrLink        = (LinkButton)e.Item.FindControl("lnkstrLink");
        HiddenField hdnShareInvitee   = (HiddenField)e.Item.FindControl("hdnShareInvitee");

        ViewState["lblGroupName"] = lblGroupName.Text;
        hdnEmailId.Value          = lblEmailId.Text;

        if (e.CommandName == "Details" && Convert.ToInt32(hdnRegistrationId.Value) != 0)
        {
            //Response.Redirect(lnkstrLink.CommandArgument);
            Response.Redirect("Home.aspx?RegId=" + hdnRegistrationId.Value);
        }
        else if (e.CommandName == "Details" && Convert.ToInt32(hdnRegistrationId.Value) == 0)
        {
            lnkName.Attributes["class"] = "remove-hover-anchor";
        }
        else
        if (e.CommandName == "ShareDetails")
        {
            if (hdnRegistrationId.Value != Convert.ToString(ViewState["UserID"]))
            {
                Response.Redirect("Group-Home.aspx?GrpId=" + hdnrequserid.Value);
            }
        }
        else
        if (e.CommandName == "Confirm")
        {
            if (hdnTableName.Value == "Scrl_UserRequestInvitationTbl")
            {
                objRegistration.intRequestInvitaionId = Convert.ToInt32(hdnPkId.Value);
                objRegistration.AddedBy   = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRegistration.IpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRegistration.IpAddress == null)
                {
                    objRegistration.IpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRegistrationDB.AddEditDel_Request(objRegistration, DA_Registrationdetails.RegistrationDetails.Update);
                SendMail(e.CommandName, hdnTableName.Value);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "starScripts", "CallUserMethod();", true);
            }

            else if (hdnTableName.Value == "Scrl_UserGroupJoiningTbl")
            {
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDO.intAddedBy       = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.isAccepted       = 1;
                objGrpJoinDO.strIpAddress     = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objGrpJoinDO.strIpAddress == null)
                {
                    objGrpJoinDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Update);
                SendMail(e.CommandName, hdnTableName.Value);
            }

            else if (hdnTableName.Value == "Scrl_UserRecommendationTbl")
            {
                objRecmndDO.intRecommendationId = Convert.ToInt32(hdnPkId.Value);
                objRecmndDO.intAddedBy          = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objRecmndDO.strIpAddress        = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (objRecmndDO.strIpAddress == null)
                {
                    objRecmndDO.strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                objRecmndDA.Scrl_AddEditDelRecommendations(objRecmndDO, DA_Scrl_UserRecommendation.Scrl_UserRecommendation.Update);

                SendMail(e.CommandName, hdnTableName.Value);
            }
            else if (hdnTableName.Value == "Scrl_RequestGroupJoin")
            {
                objgrp.intAddedBy = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objgrp.inGroupId  = Convert.ToInt32(hdnShareInvitee.Value);
                DataSet ds = new DataSet();
                ds = objgrpDB.GetDataSet(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetOtherGroupDetailsByGroupId);

                if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "A")
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "0")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "1")
                        {
                            objGrpJoinDO.isAccepted = 2;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "2")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }
                    }
                    else
                    {
                        if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "A")
                        {
                            objGrpJoinDO.isAccepted = 1;
                        }
                    }
                }

                else if (Convert.ToString(ds.Tables[0].Rows[0]["strAccess"]) == "R")
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "0")
                        {
                            objGrpJoinDO.isAccepted = 1;

                            lblSuccess.Text      = "You have already send the group joining request.";
                            lblSuccess.ForeColor = System.Drawing.Color.Red;
                            divSuccess.Style.Add("display", "block");
                            return;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "1")
                        {
                            objGrpJoinDO.isAccepted = 2;
                        }

                        else if (Convert.ToString(ds.Tables[1].Rows[0]["IsAccepted"]) == "2")
                        {
                            objGrpJoinDO.isAccepted = 0;
                        }
                    }
                }

                objGrpJoinDO.isAccepted       = 1;
                objGrpJoinDO.inGroupId        = Convert.ToInt32(hdnShareInvitee.Value);
                objGrpJoinDO.intInvitedUserId = Convert.ToInt32(ds.Tables[0].Rows[0]["intRegistrationId"]);

                string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (ip == null)
                {
                    ip = Request.ServerVariables["REMOTE_ADDR"];
                }
                objGrpJoinDO.strIpAddress      = ip;
                objGrpJoinDO.intAddedBy        = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDO.intRegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.Insert);
                objGrpJoinDO.intRequestJoinId = Convert.ToInt32(hdnPkId.Value);
                objGrpJoinDA.AddEditDel_Scrl_UserGroupJoin(objGrpJoinDO, DA_Scrl_UserGroupJoin.Scrl_UserGroupJoin.UpdateGroupMember);
            }

            BindAllRequest();
        }
        else
        if (e.CommandName == "Delete")
        {
            ViewState["hdnTableName"]          = hdnTableName.Value;
            ViewState["intRequestInvitaionId"] = hdnPkId.Value;
            divSuccess.Style.Add("display", "block");
        }
    }
Ejemplo n.º 3
0
    protected void lnkConnDisconn_Click(object sender, EventArgs e)
    {
        divConnDisPopup.Style.Add("display", "none");
        string name = "", emailId = "";
        int    accept        = 0;
        int    InvitedUserId = Convert.ToInt32(ViewState["RegId"]);

        objdoreg.InvitedUserId  = Convert.ToInt32(ViewState["RegId"]);
        objdoreg.RegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());

        if (Convert.ToString(Session["ExternalUserId"]) != "" && Session["ExternalUserId"] != null)
        {
            objdoreg.RegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
            objdoreg.InvitedUserId  = Convert.ToInt32(ViewState["RegId"]);
            DataTable dtReq = new DataTable();
            dtReq = objdareg.GetExistsRequest(objdoreg, DA_Registrationdetails.RegistrationDetails.SingleRecord);
            if (dtReq.Rows.Count > 0)
            {
                name    = Convert.ToString(dtReq.Rows[0]["Name"]);
                emailId = Convert.ToString(dtReq.Rows[0]["vchrUserName"]);
                accept  = Convert.ToInt32(dtReq.Rows[0]["IsAccepted"]);

                if (Convert.ToInt32(dtReq.Rows[0]["IsAccepted"]) == 0)
                {
                    if (Convert.ToInt32(dtReq.Rows[0]["Accepts"]) != 2)
                    {
                        divConnDisPopup.Style.Add("display", "none");
                        divSuccess.Style.Add("display", "block");
                        lblSuccess.Text      = "You have already send the request.";
                        lblSuccess.ForeColor = System.Drawing.Color.Red;
                        divSuccess.Style.Add("display", "block");
                        return;
                    }
                    else
                    {
                        objdoreg.intRequestInvitaionId = Convert.ToInt32(dtReq.Rows[0]["intRequestInvitaionId"]);
                        objdareg.AddEditDel_Request(objdoreg, DA_Registrationdetails.RegistrationDetails.Update);
                        divConnDisPopup.Style.Add("display", "none");
                        BinduserSearch();
                        return;
                    }
                }
            }
        }
        else
        {
            return;
        }
        objdoreg.ConnectRegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
        objdoreg.AddedBy   = Convert.ToInt32(Session["ExternalUserId"].ToString());
        objdoreg.IpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        if (objdoreg.IpAddress == null)
        {
            objdoreg.IpAddress = Request.ServerVariables["REMOTE_ADDR"];
        }

        if (Convert.ToString(ViewState["CommandName"]).Trim() == "DisConnect")
        {
            objdareg.AddEditDel_Request(objdoreg, DA_Registrationdetails.RegistrationDetails.UpdateConnection);

            if (ISAPIURLACCESSED == "1")
            {
                try
                {
                    String url = APIURL + "disconnectUser.action?" +
                                 "uidFirstUser="******"&uidSecondUser="******"GET";
                    if (ISAPIResponse == "1")
                    {
                        WebResponse  myResponse1 = myRequest1.GetResponse();
                        StreamReader sr          = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8);
                        String       result      = sr.ReadToEnd();
                        objAPILogDO.strURL       = url;
                        objAPILogDO.strAPIType   = "Search People Disconnect User";
                        objAPILogDO.strResponse  = result;
                        objAPILogDO.strIPAddress = objdoreg.IpAddress;
                        objAPILogDO.intAddedBy   = Convert.ToInt32(ViewState["UserID"]);
                        objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert);
                    }
                }
                catch { }
            }

            if (Convert.ToString(ViewState["ViewAll"]) == "1")
            {
                BindSingleData();
            }
            else
            {
                BinduserSearch();
            }
            lblSuccess.Text      = "Successfully removed from the friendlist.";
            lblSuccess.ForeColor = System.Drawing.Color.Green;
            divSuccess.Style.Add("display", "block");
            return;
        }
        else
        {
            objdareg.AddEditDel_Request(objdoreg, DA_Registrationdetails.RegistrationDetails.Add);

            objdoreg.RegistrationId = Convert.ToInt32(Session["ExternalUserId"].ToString());
            objdoreg.InvitedUserId  = Convert.ToInt32(ViewState["RegId"]);
            DataTable dtReqs = new DataTable();
            dtReqs = objdareg.GetExistsRequest(objdoreg, DA_Registrationdetails.RegistrationDetails.SingleRecord);
            if (dtReqs.Rows.Count > 0)
            {
                name    = Convert.ToString(dtReqs.Rows[0]["Name"]);
                emailId = Convert.ToString(dtReqs.Rows[0]["vchrUserName"]);
                accept  = Convert.ToInt32(dtReqs.Rows[0]["IsAccepted"]);
            }

            if (ISAPIURLACCESSED == "1")
            {
                try
                {
                    String url = APIURL + "connectUser.action?" +
                                 "uidFirstUser="******"&uidSecondUser="******"GET";
                    if (ISAPIResponse == "1")
                    {
                        WebResponse  myResponse1 = myRequest1.GetResponse();
                        StreamReader sr          = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8);
                        String       result      = sr.ReadToEnd();
                        objAPILogDO.strURL       = url;
                        objAPILogDO.strAPIType   = "Search People Connect User";
                        objAPILogDO.strResponse  = result;
                        objAPILogDO.strIPAddress = objdoreg.IpAddress;
                        objAPILogDO.intAddedBy   = Convert.ToInt32(ViewState["UserID"]);
                        objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert);
                    }
                }
                catch { }
            }
            if (Convert.ToString(ViewState["ViewAll"]) == "1")
            {
                BindSingleData();
            }
            else
            {
                BinduserSearch();
            }
            SendMailConnections(emailId, name, accept);
            lblSuccess.Text      = "Request Invitation and a mail has been send to the person.";
            lblSuccess.ForeColor = System.Drawing.Color.Green;
        }
        divConnDisPopup.Style.Add("display", "none");
        divSuccess.Style.Add("display", "block");
    }