Exemplo n.º 1
0
        private void newRecord()
        {
            Edit dlg = new Edit();

            dlg.Text = ("New Contact");
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.dataSet1.recordData.Rows.Add(dlg.RecordRow.ItemArray);
                if ((int)dataSet1.recordData.Rows[0]["id"] == -1)
                {
                    dataSet1.recordData.Rows[0]["id"] = 1;
                }
                else
                {
                    dataSet1.recordData.Rows[counter]["id"] = (int)dataSet1.recordData.Rows[counter - 1]["id"] + 1;
                }
                if (dlg.RecordRow.photo != "no_photo.jpg")
                {
                    string imagepath = dlg.RecordRow.photo;
                    string newPath   = photo_dir + string.Format("\\photo{0}" + System.IO.Path.GetExtension(imagepath), dataSet1.recordData.Rows[counter]["id"]);
                    File.Copy(imagepath, newPath, true);
                    dataSet1.recordData.Rows[counter]["photo"] = newPath;
                }
                this.counter++;
                ShowAdressBookName();
                updateListView(sort(filter()));
                ShowAdressBookName();
                this.changed = true;
                ShowItems();
                contactIndexChanged();
                SaveFile();
            }
        }
Exemplo n.º 2
0
        private void editContactbutton1_Click(object sender, EventArgs e)
        {
            Edit dlg = new Edit(this.loadedRow);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.loadedRow    = dlg.RecordRow;
                edited            = true;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Exemplo n.º 3
0
        private void editContact()
        {
            int index = (int)listView1.SelectedItems[0].Tag;

            DataSet1.recordDataRow newRow = dataSet1.recordData.FindByid(index);
            Edit dlg = new Edit(newRow);

            dlg.Text = "Edit Contact";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                dataSet1.recordData.FindByid(index).ItemArray = dlg.RecordRow.ItemArray;
                if (dataSet1.recordData.FindByid(index).photo != "no_photo.jpg")
                {
                    string imagepath = dlg.RecordRow.photo;
                    string newPath   = photo_dir + string.Format("\\photo{0}" + System.IO.Path.GetExtension(imagepath), dataSet1.recordData.FindByid(index).id);
                    File.Copy(imagepath, newPath, true);
                    dataSet1.recordData.FindByid(index).photo = newPath;
                }
                updateListView(sort(filter()));
                this.changed = true;
                ShowItems();
                SaveFile();
            }
        }
Exemplo n.º 4
0
 private void editContactbutton1_Click(object sender, EventArgs e)
 {
     Edit dlg = new Edit(this.loadedRow);
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         this.loadedRow = dlg.RecordRow;
         edited = true;
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Exemplo n.º 5
0
        private void Edit_Button_Click(object sender, EventArgs e)
        {
            Edit editForm = new Edit();

            editForm.ShowDialog();
        }
Exemplo n.º 6
0
 private void newRecord()
 {
     Edit dlg = new Edit();
     dlg.Text = ("New Contact");
     if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         this.dataSet1.recordData.Rows.Add(dlg.RecordRow.ItemArray);
         if ((int)dataSet1.recordData.Rows[0]["id"] == -1)
         {
             dataSet1.recordData.Rows[0]["id"] = 1;
         }
         else
         {
             dataSet1.recordData.Rows[counter]["id"] = (int)dataSet1.recordData.Rows[counter - 1]["id"] + 1;
         }
         if (dlg.RecordRow.photo != "no_photo.jpg")
         {
             string imagepath = dlg.RecordRow.photo;
             string newPath = photo_dir + string.Format("\\photo{0}" + System.IO.Path.GetExtension(imagepath), dataSet1.recordData.Rows[counter]["id"]);
             File.Copy(imagepath, newPath, true);
             dataSet1.recordData.Rows[counter]["photo"] = newPath;
         }
         this.counter++;
         ShowAdressBookName();
         updateListView(sort(filter()));
         ShowAdressBookName();
         this.changed = true;
         ShowItems();
         contactIndexChanged();
         SaveFile();
     }
 }
Exemplo n.º 7
0
 private void editContact()
 {
     int index = (int)listView1.SelectedItems[0].Tag;
     DataSet1.recordDataRow newRow = dataSet1.recordData.FindByid(index);
     Edit dlg = new Edit(newRow);
     dlg.Text = "Edit Contact";
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         dataSet1.recordData.FindByid(index).ItemArray = dlg.RecordRow.ItemArray;
         if (dataSet1.recordData.FindByid(index).photo != "no_photo.jpg")
         {
             string imagepath = dlg.RecordRow.photo;
             string newPath = photo_dir + string.Format("\\photo{0}" + System.IO.Path.GetExtension(imagepath), dataSet1.recordData.FindByid(index).id);
             File.Copy(imagepath, newPath, true);
             dataSet1.recordData.FindByid(index).photo = newPath;
         }
         updateListView(sort(filter()));
         this.changed = true;
         ShowItems();
         SaveFile();
     }
 }