예제 #1
0
        string getdata()
        {
            List <password> data = new List <password>(offset);

            for (int i = 0; i < passwordsDataGridView.Rows.Count; i++)
            {
                if (passwordsDataGridView.Rows[i] != null)
                {
                    password item = new password();

                    if (passwordsDataGridView.Rows[i].Cells[0].Value != null)
                    {
                        item.id = Convert.ToInt32(passwordsDataGridView.Rows[i].Cells[0].Value);
                    }
                    else
                    {
                        item.id = 0;
                    }

                    if (passwordsDataGridView.Rows[i].Cells[1].Value != null)
                    {
                        item.Name = passwordsDataGridView.Rows[i].Cells[1].Value.ToString();
                    }
                    else
                    {
                        item.Name = "";
                    }

                    if (passwordsDataGridView.Rows[i].Cells[2].Value != null)
                    {
                        item.Login = passwordsDataGridView.Rows[i].Cells[2].Value.ToString();
                    }
                    else
                    {
                        item.Login = "";
                    }
                    if (passwordsDataGridView.Rows[i].Cells[3].Value != null)

                    {
                        item.Email = passwordsDataGridView.Rows[i].Cells[3].Value.ToString();
                    }
                    else
                    {
                        item.Email = "";
                    }
                    if (passwordsDataGridView.Rows[i].Cells[4].Value != null)
                    {
                        item.Password = passwordsDataGridView.Rows[i].Cells[5].Value.ToString();
                    }
                    else
                    {
                        item.Password = "";
                    }
                    if (passwordsDataGridView.Rows[i].Cells[5].Value != null)
                    {
                        item.Notes = passwordsDataGridView.Rows[i].Cells[6].Value.ToString();
                    }
                    else
                    {
                        item.Notes = "";
                    }

                    data.Add(item);
                }
            }

            return(JsonConvert.SerializeObject(data));
        }