Ejemplo n.º 1
0
        protected void btnSearchh_ServerClick(object sender, EventArgs e)
        {
            string text = txtSearchh.Value.ToLower().Trim();

            string[] textt = new string[] { };
            if (text.Contains(" "))
            {
                textt = text.Split(' ');
                if (textt.Length > 1)
                {
                    List <User> userlist = SqlTask.GetSearchedUser(textt[0], textt[1]);
                    lstSearch.DataSource = userlist;
                    lstSearch.DataBind();
                }
            }
            else
            {
                List <User> userlist = SqlTask.GetSearchedUser(text);
                lstSearch.DataSource = userlist;
                lstSearch.DataBind();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginuser"] != null)
            {
                try
                {
                    User user = SqlTask.GetUserInfo(Session["loginuser"].ToString());

                    txtProfileEmail.Text = user.Email;
                    imgUser.ImageUrl     = user.ImgPath;
                    txtID.Text           = user.ID;
                }
                catch (Exception ex)
                {
                    alertprofilepage.Attributes["class"] = "alert alert-warning alert-dismissable";
                    alertchangepassword = "******" + ex.Message;
                }
            }
            else
            {
                Response.Redirect("/Default.aspx");
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SqlTask.conn.Close();
                if (Session["loginuser"] != null)
                {
                    try
                    {
                        User user = SqlTask.GetUserInfo(Session["loginuser"].ToString());

                        txtFName.Text        = user.FName;
                        txtSName.Text        = user.SName;
                        txtProfileEmail.Text = user.Email;
                        txtDesc.Text         = user.Desc;
                        imgUser.ImageUrl     = user.ImgPath;
                        txtID.Text           = user.ID;
                        txtURL.Text          = user.URL;

                        if (char.IsDigit(user.ID[0]) == true)
                        {
                            chgPass.Visible = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        alertprofilepage.Attributes["class"] = "alert alert-warning alert-dismissable";
                        alertprofile = "The following error is occured: " + ex.Message;
                    }
                }
                else
                {
                    Response.Redirect("/Default.aspx");
                }
            }
        }
Ejemplo n.º 4
0
        protected void imgPhoto_Click(object sender, ImageClickEventArgs e)
        {
            txt_comment_edit.Visible = true;
            ImageButton b = sender as ImageButton;

            if (b.Attributes != null)
            {
                photoID     = b.Attributes["imgID"];
                deneme.Text = photoID.ToString();



                PhotoInfo photo = SqlTask.GetPhotoInfo(photoID);
                switch (photo.rate)
                {
                case "1":
                    s1.ImageUrl = "/Images/cstar.png";
                    s2.ImageUrl = "/Images/ucstar.png";
                    s3.ImageUrl = "/Images/ucstar.png";
                    s4.ImageUrl = "/Images/ucstar.png";
                    s5.ImageUrl = "/Images/ucstar.png";
                    break;

                case "2":
                    s1.ImageUrl = "/Images/cstar.png";
                    s2.ImageUrl = "/Images/cstar.png";
                    s3.ImageUrl = "/Images/ucstar.png";
                    s4.ImageUrl = "/Images/ucstar.png";
                    s5.ImageUrl = "/Images/ucstar.png";
                    break;

                case "3":
                    s1.ImageUrl = "/Images/cstar.png";
                    s2.ImageUrl = "/Images/cstar.png";
                    s3.ImageUrl = "/Images/cstar.png";
                    s4.ImageUrl = "/Images/ucstar.png";
                    s5.ImageUrl = "/Images/ucstar.png";
                    break;

                case "4":
                    s1.ImageUrl = "/Images/cstar.png";
                    s2.ImageUrl = "/Images/cstar.png";
                    s3.ImageUrl = "/Images/cstar.png";
                    s4.ImageUrl = "/Images/cstar.png";
                    s5.ImageUrl = "/Images/ucstar.png";
                    break;

                case "5":
                    s1.ImageUrl = "/Images/cstar.png";
                    s2.ImageUrl = "/Images/cstar.png";
                    s3.ImageUrl = "/Images/cstar.png";
                    s4.ImageUrl = "/Images/cstar.png";
                    s5.ImageUrl = "/Images/cstar.png";
                    break;

                default:
                    break;
                }

                deneme2.Text        = photo.rate.ToString();
                imgW.ImageUrl       = photo.imgUrl;
                userImg.ImageUrl    = photo.userImg;
                phtProjectName.Text = photo.projectname;
                phtNameSurname.Text = photo.userFName + " " + photo.userSName;
                lblRate.Text        = photo.rate;
                lbl_comment.Text    = photo.Disc;
                if (photo.publish == "1")
                {
                    Chck_publish.Checked = true;
                }
                else
                {
                    Chck_publish.Checked = false;
                }

                txt_comment_edit.Visible = true;
                txt_comment_edit.Text    = photo.Disc;
                lbl_comment.Visible      = false;

                if (Session["loginuser"] != null)
                {
                    photo = SqlTask.GetLikedPhoto(photo, Session["loginuser"].ToString());
                }

                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                uptImgModal.Update();
            }
        }
Ejemplo n.º 5
0
 protected void DeleteProject_Click(object sender, EventArgs e)
 {
     SqlTask.DeleteProject(lblprojectID.Text);
     Response.Redirect("/MyPage.aspx");
 }
Ejemplo n.º 6
0
        protected void editok_Click(object sender, EventArgs e)
        {
            string Id  = deneme.Text;
            string com = txt_comment_edit.Text;
            string pub;
            string rate;

            var ra = deneme2.Text;

            if (ra.Contains("1"))
            {
                rate = "1";
            }
            else if (ra.Contains("2"))
            {
                rate = "2";
            }
            else if (ra.Contains("3"))
            {
                rate = "3";
            }
            else if (ra.Contains("4"))
            {
                rate = "4";
            }
            else
            {
                rate = "5";
            }

            if (Chck_publish.Checked)
            {
                pub = "1";
            }
            else
            {
                pub = "0";
            }


            PhotoInfo photo = SqlTask.UpdatePhotoInfo(com, rate, pub, Id);

            switch (rate)
            {
            case "1":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/ucstar.png";
                s3.ImageUrl = "/Images/ucstar.png";
                s4.ImageUrl = "/Images/ucstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "2":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/ucstar.png";
                s4.ImageUrl = "/Images/ucstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "3":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/cstar.png";
                s4.ImageUrl = "/Images/ucstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "4":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/cstar.png";
                s4.ImageUrl = "/Images/cstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "5":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/cstar.png";
                s4.ImageUrl = "/Images/cstar.png";
                s5.ImageUrl = "/Images/cstar.png";
                break;

            default:
                break;
            }
            imgW.ImageUrl       = photo.imgUrl;
            userImg.ImageUrl    = photo.userImg;
            phtProjectName.Text = photo.projectname;
            phtNameSurname.Text = photo.userFName + " " + photo.userSName;
            lblRate.Text        = photo.rate;
            lbl_comment.Text    = photo.Disc;
            if (photo.publish == "1")
            {
                Chck_publish.Checked = true;
            }
            else
            {
                Chck_publish.Checked = false;
            }

            txt_comment_edit.Visible = true;
            txt_comment_edit.Text    = photo.Disc;
            lbl_comment.Visible      = false;

            Response.Redirect("/MyPage.aspx");
        }
Ejemplo n.º 7
0
        /* protected void AddFoto(object sender, EventArgs e)
         * {
         *   var x = sender as Button;
         *   var Pro_ID = x.CommandName;
         * }
         */



        protected void imgPhotoEdit_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton b  = sender as ImageButton;
            var         Id = b.Attributes["imgid"];


            string com = txt_comment_edit.Text;
            string pub;
            string rate;

            var ra = b.ID;

            if (ra.Contains("1"))
            {
                rate = "1";
            }
            else if (ra.Contains("2"))
            {
                rate = "2";
            }
            else if (ra.Contains("3"))
            {
                rate = "3";
            }
            else if (ra.Contains("4"))
            {
                rate = "4";
            }
            else
            {
                rate = "5";
            }

            if (Chck_publish.Checked)
            {
                pub = "1";
            }
            else
            {
                pub = "0";
            }

            Id = deneme.Text;
            PhotoInfo photo = SqlTask.UpdatePhotoInfo(com, rate, pub, Id);

            switch (rate)
            {
            case "1":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/ucstar.png";
                s3.ImageUrl = "/Images/ucstar.png";
                s4.ImageUrl = "/Images/ucstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "2":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/ucstar.png";
                s4.ImageUrl = "/Images/ucstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "3":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/cstar.png";
                s4.ImageUrl = "/Images/ucstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "4":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/cstar.png";
                s4.ImageUrl = "/Images/cstar.png";
                s5.ImageUrl = "/Images/ucstar.png";
                break;

            case "5":
                s1.ImageUrl = "/Images/cstar.png";
                s2.ImageUrl = "/Images/cstar.png";
                s3.ImageUrl = "/Images/cstar.png";
                s4.ImageUrl = "/Images/cstar.png";
                s5.ImageUrl = "/Images/cstar.png";
                break;

            default:
                break;
            }

            deneme2.Text        = rate.ToString();
            imgW.ImageUrl       = photo.imgUrl;
            userImg.ImageUrl    = photo.userImg;
            phtProjectName.Text = photo.projectname;
            phtNameSurname.Text = photo.userFName + " " + photo.userSName;
            lblRate.Text        = photo.rate;
            lbl_comment.Text    = photo.Disc;
            if (photo.publish == "1")
            {
                Chck_publish.Checked = true;
            }
            else
            {
                Chck_publish.Checked = false;
            }

            txt_comment_edit.Visible = true;
            txt_comment_edit.Text    = photo.Disc;
            lbl_comment.Visible      = false;


            if (Session["loginuser"] != null)
            {
                //photo = SqlTask.GetLikedPhoto(photo, Session["loginuser"].ToString());
            }

            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
        }
Ejemplo n.º 8
0
        void mainItem()
        {
            using (WebClient webClient = new WebClient())
            {
                _allComments = JsonConvert.DeserializeObject <List <Comments> >(webClient.DownloadString(WebUrlGetAllComments));
            }


            _listViewBind = new List <PhotoInfo>();
            try
            {
                if (conn.State != System.Data.ConnectionState.Closed)
                {
                    conn.Close();
                }
                conn.Open();
                cmd = new SqlCommand("SELECT TOP 20 U_ID,p_path,publish,rate,t_like,fname,sname,imgpath,PID,Url,Photos.Disc,Projects.Name FROM PHOTOS,USERS,PROJECTS WHERE U_ID=ID AND publish='1' AND Projects.Pro_ID=Photos.Pr_ID ORDER BY t_like DESC", conn);
                dr  = cmd.ExecuteReader();

                while (dr.Read())
                {
                    _listViewBind.Add(new PhotoInfo()
                    {
                        UID         = dr[0].ToString(),
                        imgUrl      = "https://" + dr[1].ToString(),
                        userFName   = dr[5].ToString(),
                        userSName   = dr[6].ToString(),
                        userImg     = dr[7].ToString(),
                        publish     = dr[2].ToString(),
                        rate        = dr[3].ToString(),
                        tLike       = Convert.ToInt32(dr[4]),
                        PID         = dr[8].ToString(),
                        Url         = dr[9].ToString(),
                        Disc        = dr[10].ToString(),
                        projectname = dr[11].ToString(),
                    });
                }
                conn.Close();

                if (Session["loginuser"] != null)
                {
                    try
                    {
                        _listViewBind = LikeClass.getLiked(_listViewBind, Session["loginuser"].ToString());
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                foreach (PhotoInfo item in _listViewBind)
                {
                    //List<Comment> _newComent = new List<Comment>();
                    //var allCommentItems = _allComments.Where(db => db.P_ID == item.PID).ToList();
                    //foreach (var itemComments in allCommentItems)
                    //{
                    //    _newComent.Add(new Comment
                    //    {
                    //        CDate = Convert.ToDateTime(itemComments.CDate),
                    //        PID=itemComments.P_ID,
                    //        UID = itemComments.U_ID,
                    //        CText = itemComments.P_Comment,
                    //        UserUrl=item.Url,
                    //        UserFName = item.userFName,
                    //        UserSName = item.userSName,
                    //        UserImg = item.userImg,
                    //    });
                    //}
                    //item.CommentList = _newComent;
                    item.CommentList = SqlTask.GetCommentsByPhotoId(item.PID);
                    item.tComment    = item.CommentList.Count;
                    //item.tComment = SqlTask.GetTotalComment(item.PID);
                    switch (item.rate)
                    {
                    case "0":
                        item.imgStar = "/Images/0star.png";
                        break;

                    case "1":
                        item.imgStar = "/Images/1star.png";
                        break;

                    case "2":
                        item.imgStar = "/Images/2star.png";
                        break;

                    case "3":
                        item.imgStar = "/Images/3star.png";
                        break;

                    case "4":
                        item.imgStar = "/Images/4star.png";
                        break;

                    case "5":
                        item.imgStar = "/Images/5star.png";
                        break;

                    default:
                        item.imgStar = "/Images/0star.png";
                        break;
                    }
                }

                ListView1.DataSource = _listViewBind;
                ListView1.DataBind();
            }
            finally
            {
                conn.Close();
            }
        }