Exemplo n.º 1
0
        private void data_works_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            WorkWriter work = new WorkWriter();

            work = work_writer[e.RowIndex];
            WorkForm work_form = new WorkForm(work);

            work_form.Show();
        }
Exemplo n.º 2
0
        public WorkForm(WorkWriter work_writer)
        {
            InitializeComponent();
            work_Writer = work_writer;

            var webClient  = new WebClient();
            var webClient2 = new WebClient();

            work_name_lbl.Text = work_Writer.Work_name;
            writer_lbl.Text    = work_Writer.Full_name;
            link_lbl.Text      = work_Writer.Work_link;
            rating_lbl.Text   += work_Writer.Work_rating;
            work_name_lbl.Left = 750 - work_name_lbl.Width / 2;
            writer_lbl.Left    = 750 - writer_lbl.Width / 2;
            link_lbl.Left      = 750 - link_lbl.Width / 2;
            rating_lbl.Left    = 750 - rating_lbl.Width / 2;
            if (MainForm.user != null)
            {
                mark_lbl.Visible   = true;
                mark_combo.Visible = true;
                data_comments.AllowUserToAddRows = true;
            }
            if (work_Writer.Work_description != null)
            {
                web.DocumentText = work_Writer.Work_description;
            }
            else
            {
                web.DocumentText = Description.empty_description;
            }

            string url = "http://94.230.164.34:8080/api/CommentWork?id=" + work_Writer.Id_work;

            try
            {
                string response_comments = Encoding.UTF8.GetString(webClient2.DownloadData(url));
                comments = JsonConvert.DeserializeObject <List <Comment_Work> >(response_comments);

                data_comments.Rows.Clear();
                for (int i = 0; i < comments.Count; i++)
                {
                    data_comments.Rows.Add();
                    data_comments.Rows[i].Cells[0].Value = comments[i].Comment;
                    data_comments.Rows[i].Cells[1].Value = comments[i].Nick;
                    data_comments.Rows[i].Cells[2].Value = comments[i].Date.Value.Day.ToString() + "." + comments[i].Date.Value.Month.ToString() + "." + comments[i].Date.Value.Year.ToString();
                    data_comments.Rows[i].ReadOnly       = true;
                }
            }
            catch
            {
                Messages.ErrorComments();
            }
        }