Exemple #1
0
        private void AddNewAddress()
        {
            AddressDetailForm dlg = new AddressDetailForm();

            dlg.Text = "새 친구 추가";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                JusoDataSet.tblJusoRow row = jusoDataSet.tblJuso.NewtblJusoRow();

                SetRowData(dlg.AddressDetail, ref row);

                jusoDataSet.tblJuso.Rows.Add(row);

                //데이터소스에 반영
                this.Validate();
                this.jusoDataSetBindingSource.EndEdit();
                this.tblJusoTableAdapter.Update(this.jusoDataSet.tblJuso);
            }
        }
Exemple #2
0
        private void ModifyAddress()
        {
            DataGridViewRow currentRow = dgvAddressList.CurrentRow;

            if (currentRow == null)
            {
                MessageBox.Show("편집할 행을 먼저 선택하십시오.");
                return;
            }

            int id = (int)currentRow.Cells[0].Value;

            AddressDetailForm dlg = new AddressDetailForm();

            dlg.Text = "친구 정보 수정";

            dlg.AddressDetail.Name       = (string)currentRow.Cells[1].Value;
            dlg.AddressDetail.Male       = (bool)currentRow.Cells[2].Value;
            dlg.AddressDetail.Birthday   = (DateTime)currentRow.Cells[3].Value;
            dlg.AddressDetail.Addr       = (string)currentRow.Cells[4].Value;
            dlg.AddressDetail.AddrDetail = (string)currentRow.Cells[5].Value;
            dlg.AddressDetail.ZipCode    = (string)currentRow.Cells[6].Value;
            dlg.AddressDetail.Cellphone  = (string)currentRow.Cells[7].Value;
            dlg.AddressDetail.Email      = (string)currentRow.Cells[8].Value;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                JusoDataSet.tblJusoRow row = jusoDataSet.tblJuso.FindById(id);
                SetRowData(dlg.AddressDetail, ref row);

                //데이터소스에 반영
                this.Validate();
                this.jusoDataSetBindingSource.EndEdit();
                this.tblJusoTableAdapter.Update(this.jusoDataSet.tblJuso);
            }
        }