Ejemplo n.º 1
0
 private void editBtn_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         Work_Area updates = new Work_Area();
         updates.Site_Name   = nameTxt.Text;
         updates.Email       = emailTxt.Text;
         updates.Login       = loginTxt.Text;
         updates.Password    = passTxt.Text;
         updates.URL         = urlTxt.Text;
         updates.Phone       = phoneTxt.Text;
         updates.Comments    = commentTxt.Text;
         updates.DateCreated = DateTime.Now;
         int index = (this.Owner as Show_Infos).list.Items.IndexOf(this.currentDatas);
         int id    = currentDatas.Id;
         (this.Owner as Show_Infos).list.Items.RemoveAt(index);
         (this.Owner as Show_Infos).list.Items.Insert(index, updates);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "System Exception..Failed..",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 2
0
 private void addBtn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Work_Area area = new Work_Area
         {
             Site_Name = nameTxt.Text,
             Email     = emailTxt.Text,
             Login     = loginTxt.Text,
             Password  = passTxt.Text,
             URL       = urlTxt.Text,
             Phone     = phoneTxt.Text,
             Comments  = commentTxt.Text
         };
         db.Works_Datas.Add(area);
         db.SaveChanges();
         MessageBox.Show($"Datas about sitename {nameTxt.Text} was added successfully!",
                         "Congratulate!", MessageBoxButton.OK, MessageBoxImage.Asterisk);
         // After correct adding clear all text fields:
         nameTxt.Text     = emailTxt.Text = loginTxt.Text =
             passTxt.Text = urlTxt.Text = phoneTxt.Text = commentTxt.Text = "";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "System Exception..Failed..",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 3
0
        private void editBtn_Click(object sender, RoutedEventArgs e)
        {
            Work_Area  selected_recordt = list.SelectedItem as Work_Area;
            Edit_Datas editForm         = new Edit_Datas(selected_recordt);

            editForm.Owner = this;
            editForm.ShowDialog();
        }
Ejemplo n.º 4
0
 public Edit_Datas(Work_Area currentDatas)
 {
     InitializeComponent();
     this.currentDatas = currentDatas;
     nameTxt.Text      = currentDatas.Site_Name;
     emailTxt.Text     = currentDatas.Email;
     loginTxt.Text     = currentDatas.Login;
     passTxt.Text      = currentDatas.Password;
     urlTxt.Text       = currentDatas.URL;
     phoneTxt.Text     = currentDatas.Phone;
     commentTxt.Text   = currentDatas.Comments;
     createdTxt.Text   = currentDatas.DateCreated.ToString();
 }