Пример #1
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            Cs_User ObjCs_User = new Cs_User()
            {
                UserName   = txtUserName.Text.Trim(),
                FirstName  = txtFirstName.Text.Trim(),
                LastName   = txtLastName.Text.Trim(),
                Password   = txtPassword2.Text.Trim(),
                Email      = txtEmail.Text.Trim(),
                CellNumber = txtCellNumber.Text.Trim(),
                Country    = txtCountry.Text.Trim(),
                City       = txtCity.Text.Trim(),
                State      = txtState.Text.Trim(),
                Sex        = Convert.ToChar(rdlSexList.SelectedValue),
                Image      = rdlSexList.SelectedValue == "M" ? "user_male.jpg" : "user_female.jpg"
            };
            DataTable result = ObjCs_User.RegisterUser();

            if (result.Rows.Count > 0)
            {
                ObjCs_User.UserID = Convert.ToInt32(result.Rows[0]["UserID"]);
                Cs_CommonFunction.SetUserSession(ObjCs_User);
                Response.Redirect("~/Index.aspx");
            }
            else
            {
                lblError.Text      = "User Registration failed";
                lblError.ForeColor = System.Drawing.Color.Red;
            }
        }
Пример #2
0
        private void LoadNotifications()
        {
            Cs_User   cs_User         = new Cs_User();
            DataTable dtNotifications = cs_User.GetNewNotification(Session["UserID"].ToString());

            if (dtNotifications.Rows.Count > 0)
            {
                imgNotification.ToolTip = dtNotifications.Rows.Count + "New Notification";
            }
            else
            {
                imgNotification.CssClass = "lightItem";
            }
            Cs_Chat   cs_Chat       = new Cs_Chat();
            int       UserID        = Convert.ToInt32(HttpContext.Current.Session["UserID"]);
            DataTable dtNewMessages = cs_Chat.GetUserChat(UserID);
            DataTable dt            = new DataTable();

            if (dtNewMessages.Rows.Count > 0)
            {
                var rows = (from p in dtNewMessages.AsEnumerable()
                            where p.Field <int>("Status") == 0
                            select p);
                dt = rows.Any() ? rows.CopyToDataTable() : dt.Clone();
            }

            imgMessage.ToolTip = dtNotifications.Rows.Count + "New Messages";
        }
Пример #3
0
        private void BindNotification()
        {
            Cs_User   cs_User = new Cs_User();
            DataTable dt      = cs_User.GetNotification(Session["UserID"].ToString());

            if (dt.Rows.Count > 0)
            {
                var rows = (from p in dt.AsEnumerable()
                            where p.Field <int>("Type") == 1
                            select p);
                DataTable dtFriendRequest = rows.Any() ? rows.CopyToDataTable() : dt.Clone();
                rptRequestNotification.DataSource = dtFriendRequest;
                rptRequestNotification.DataBind();


                var rows1 = (from p in dt.AsEnumerable()
                             where p.Field <int>("Type") == 2
                             select p);
                DataTable dtResponseNotification = rows1.Any() ? rows1.CopyToDataTable() : dt.Clone();
                rptResponseNotification.DataSource = dtResponseNotification;
                rptResponseNotification.DataBind();
            }
            else
            {
                Notifiction.InnerHtml = "<center><h4>No new Notification</h4></center>";
            }
        }
Пример #4
0
        protected void btnSave_ProfileClicked(object sender, EventArgs e)
        {
            string  ImagePath = Server.MapPath("~") + "UserImages/" + fileUpload.FileName;
            int     UserID    = (int)Session["UserID"];
            Cs_User cs_User   = new Cs_User();

            cs_User.UserID = UserID;
            if (fileUpload.HasFile)
            {
                fileUpload.SaveAs(ImagePath);
                cs_User.Image = fileUpload.FileName;
            }
            else
            {
                cs_User.Image = imgName.Value;
            }



            cs_User.OLineDescritpion = txtDescritpion.Text.Trim();
            cs_User.About            = txtAbout.Text.Trim();
            cs_User.Special          = txtSpecial.Text.Trim();
            cs_User.Special          = txtSpecial.Text.Trim();

            string Occupation = "<root><Occupation>" +
                                "<OccupationName>" + txtOccupation.Text + "</OccupationName>" +
                                "<Role>" + txtRole.Text + "</Role>" +
                                "<Company >" + txtRole.Text + "</Company >" +
                                "</Occupation></root>";

            cs_User.Occupation = Occupation;

            string Study = "<root><Study>" +
                           "<Collage>" + txtCollage.Text + "</Collage>" +
                           "<Schooling>" + txtSchool.Text + "</Schooling>" +
                           "</Study></root>";

            cs_User.Study      = Study;
            cs_User.City       = txtCity.Text;
            cs_User.State      = txtState.Text;
            cs_User.Country    = txtCountry.Text;
            cs_User.Zip        = txtPostalCode.Text;
            cs_User.Status     = rblStatus.SelectedValue;
            cs_User.CellNumber = txtCell.Text;
            cs_User.Email      = txtEmail.Text;

            cs_User.HereFor = "<root><HereFor>";

            cs_User.HereFor += "<Friend>" + chlHereFor.Items[0].Selected + "</Friend>";
            cs_User.HereFor += "<Dating>" + chlHereFor.Items[1].Selected + "</Dating>";
            cs_User.HereFor += "<Relationship>" + chlHereFor.Items[2].Selected + "</Relationship>";
            cs_User.HereFor += "<Networking>" + chlHereFor.Items[3].Selected + "</Networking>";

            cs_User.HereFor += "</HereFor></root>";

            cs_User.OnlineProfile = txtOnlineLink.Text;
            cs_User.UpdateUser();
        }
Пример #5
0
        protected void lnkLogout_Click(object sender, EventArgs e)
        {
            Cs_User cs_User = new Cs_User();

            cs_User.UserID = (int)Session["UserID"];
            cs_User.SetUserStatus(0);
            ChatME.BusinessLayer.Cs_CommonFunction.CleanUserSession();
            Response.Redirect("~/Default.aspx");
        }
Пример #6
0
 protected void Session_End(object sender, EventArgs e)
 {
     if (Session["UserID"] != null)
     {
         Cs_User cs_User = new Cs_User();
         cs_User.UserID = (int)Session["UserID"];
         cs_User.SetUserStatus(0);
         ChatME.BusinessLayer.Cs_CommonFunction.CleanUserSession();
     }
 }
Пример #7
0
        protected void lnkNotification_Click(object sender, EventArgs e)
        {
            Cs_User   cs_User = new Cs_User();
            DataTable dt      = cs_User.GetNotification(Session["UserID"].ToString());

            if (dt.Rows.Count > 0)
            {
                LinkButton lnkFriendRequest = new LinkButton();
                lnkFriendRequest.ID = "lnkFriendRequest";
                DataRow[] drFreiendRequest = dt.Select("Type=1");
                lnkFriendRequest.Text = drFreiendRequest.Count() + " New Friend Request";
                lnkFriendRequest.Attributes.Add("href", "RequestNotification.aspx");
            }
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Cs_CommonFunction.IsUserLoggedIn())
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!IsPostBack)
            {
                Cs_User cs_User = new Cs_User();
                imgUser.ImageUrl = Cs_CommonFunction.RelativePath + "UserImages/" + Convert.ToString(Session["UserImage"]);
                lblUser.Attributes.Add("onclick", "setIUrl('profile.aspx?UserID=" + Session["UserID"] + "');");
                imgUser.Attributes.Add("onclick", "setIUrl('profile.aspx?UserID=" + Session["UserID"] + "');");
                lblUser.Attributes.Add("href", "#");
                LoadNotifications();
            }

            lblUser.Text = Session["UserName"].ToString();
        }
Пример #9
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Cs_User ObjCs_User = new Cs_User()
            {
                UserName = txtUser.Text.Trim(),
                Password = txtPassword.Text.Trim()
            };
            DataTable dt = ObjCs_User.LoginUser();

            if (dt.Rows.Count > 0)
            {
                ObjCs_User.FirstName = dt.Rows[0]["FirstName"].ToString();
                ObjCs_User.LastName  = dt.Rows[0]["LastName"].ToString();
                ObjCs_User.UserID    = Convert.ToInt32(dt.Rows[0]["UserID"]);
                ObjCs_User.Image     = Convert.ToString(dt.Rows[0]["Image"]);
                Cs_CommonFunction.SetUserSession(ObjCs_User);
                ObjCs_User.SetUserStatus(1);
                Response.Redirect("~/Index.aspx");
            }
            else
            {
            }
        }
Пример #10
0
        private void LoadUserProfile(string UserID)
        {
            int       userID  = Convert.ToInt32(UserID);
            Cs_User   cs_User = new Cs_User();
            DataTable dt      = cs_User.GetUser(Convert.ToInt32(userID));

            if (dt.Rows.Count > 0)
            {
                imgUser.ImageUrl = Cs_CommonFunction.RelativePath + "UserImages/" + Convert.ToString(dt.Rows[0]["Image"]);

                userName.Text       = Convert.ToString(dt.Rows[0]["FirstName"]) + " " + Convert.ToString(dt.Rows[0]["LastName"]);
                txtDescritpion.Text = Convert.ToString(dt.Rows[0]["OLineDescritpion"]);
                txtAbout.Text       = Convert.ToString(dt.Rows[0]["About"]);
                txtSpecial.Text     = Convert.ToString(dt.Rows[0]["Special"]);

                string Occupation = Convert.ToString(dt.Rows[0]["Occupation"]);
                if (!string.IsNullOrEmpty(Occupation))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(Occupation);
                    foreach (XmlNode node in doc.SelectNodes("//Occupation"))
                    {
                        txtOccupation.Text = node["OccupationName"].InnerText;
                        txtRole.Text       = node["Role"].InnerText;
                        txtCompany.Text    = node["Company"].InnerText;
                    }
                }

                string Study = Convert.ToString(dt.Rows[0]["Study"]);
                if (!string.IsNullOrEmpty(Study))
                {
                    XmlDocument docStudy = new XmlDocument();
                    docStudy.LoadXml(Study);
                    foreach (XmlNode node in docStudy.SelectNodes("//Study"))
                    {
                        txtCollage.Text = node["Collage"].InnerText;
                        txtSchool.Text  = node["Schooling"].InnerText;
                    }
                }

                txtCity.Text            = Convert.ToString(dt.Rows[0]["City"]);
                txtState.Text           = Convert.ToString(dt.Rows[0]["State"]);
                txtCountry.Text         = Convert.ToString(dt.Rows[0]["Country"]);
                txtPostalCode.Text      = Convert.ToString(dt.Rows[0]["Zip"]);
                rblStatus.SelectedValue = Convert.ToString(dt.Rows[0]["UStatus"]);
                txtCell.Text            = Convert.ToString(dt.Rows[0]["CellNumber"]);
                txtEmail.Text           = Convert.ToString(dt.Rows[0]["Email"]);

                string HereFor = Convert.ToString(dt.Rows[0]["HereFor"]);

                if (!string.IsNullOrEmpty(HereFor))
                {
                    XmlDocument docHereFor = new XmlDocument();
                    docHereFor.LoadXml(HereFor);
                    foreach (XmlNode node in docHereFor.SelectNodes("//HereFor"))
                    {
                        chlHereFor.Items[0].Selected = node["Friend"].InnerText == "True" ? true : false;
                        chlHereFor.Items[1].Selected = node["Dating"].InnerText == "True" ? true : false;
                        chlHereFor.Items[2].Selected = node["Relationship"].InnerText == "True" ? true : false;
                        chlHereFor.Items[3].Selected = node["Networking"].InnerText == "True" ? true : false;
                    }
                }
                txtOnlineLink.Text = Convert.ToString(dt.Rows[0]["OnlineProfile"]);
            }
        }