Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SiteText sitetext = db.SiteText.Find(id);

            db.SiteText.Remove(sitetext);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        private void Clear_Click(object sender, RoutedEventArgs e)
        {
            NameCustomerText.Clear();
            SiteText.Clear();
            RepresentativeText.Clear();
            PhoneNumberText.Clear();

            ClientsListBox.SelectedItem = -1;
        }
Example #3
0
 public ActionResult Edit(SiteText sitetext)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sitetext).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sitetext));
 }
Example #4
0
        public ActionResult Create(SiteText sitetext)
        {
            if (ModelState.IsValid)
            {
                db.SiteText.Add(sitetext);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sitetext));
        }
Example #5
0
        private void DeleteClient_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                foreach (Customer cs in lc.Cust)
                {
                    if (ClientsListBox.SelectedItem != null)
                    {
                        if (cs.Name == ClientsListBox.SelectedItem.ToString())
                        {
                            NameCustomerText.Text   = cs.Name;
                            SiteText.Text           = cs.Site;
                            RepresentativeText.Text = cs.Representative;
                            PhoneNumberText.Text    = cs.RepPhone.ToString();

                            Log.logging("Удален клиент: " + cs.Name + " " + DateTime.Now);
                            lc.Cust.Remove(cs);

                            break;
                        }
                    }
                }
                Serialization.Serialize(lc);



                ClientsListBox.Items.Clear();

                foreach (var item in lc.Cust)
                {
                    ClientsListBox.Items.Add(item.Name);
                }



                NameCustomerText.Clear();
                SiteText.Clear();
                RepresentativeText.Clear();
                PhoneNumberText.Clear();

                MessageBox.Show("Удалено!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.logging("Ошибка: " + ex);
            }
        }
Example #6
0
        private void AddClient_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ClientsListBox.SelectedItem.ToString() != NameCustomerText.Text)
                {
                    Customer cust = new Customer(NameCustomerText.Text, SiteText.Text, RepresentativeText.Text, PhoneNumberText.Text);

                    lc.Cust.Add(cust);
                    Log.logging("Добавлен клиент: " + cust.Name + " " + DateTime.Now);
                    Serialization.Serialize(lc);

                    ClientsListBox.Items.Clear();


                    lc = Serialization.Deserialze(lc);

                    NameCustomerText.Clear();
                    SiteText.Clear();
                    RepresentativeText.Clear();
                    PhoneNumberText.Clear();


                    foreach (var item in lc.Cust)
                    {
                        ClientsListBox.Items.Add(item.Name);
                    }
                    MessageBox.Show("Сохранено!");
                }
                else
                {
                    MessageBox.Show("Такой заказчик уже существует!");
                    NameCustomerText.Clear();
                    SiteText.Clear();
                    RepresentativeText.Clear();
                    PhoneNumberText.Clear();

                    ClientsListBox.SelectedItem = -1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.logging("Ошибка" + ex);
            }
        }
Example #7
0
        //
        // GET: /SiteText/Delete/5

        public ActionResult Delete(int id)
        {
            SiteText sitetext = db.SiteText.Find(id);

            return(View(sitetext));
        }
Example #8
0
        //
        // GET: /SiteText/Details/5

        public ViewResult Details(int id)
        {
            SiteText sitetext = db.SiteText.Find(id);

            return(View(sitetext));
        }