private void услугиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form newForm = new ServicesView(this, user);

            if (currentChildForm != null)
            {
                currentChildForm.Close();
            }
            currentChildForm    = newForm;
            newForm.MdiParent   = this;
            newForm.WindowState = FormWindowState.Maximized;
            newForm.BringToFront();
            newForm.Show();
        }
Пример #2
0
 public static int Create(ServicesView s)
 {
     try
     {
         db = new AceEntities();
         Services services = new Services
         {
             Name  = s.Name,
             Price = s.Price
         };
         db.Services.Add(services);
         db.SaveChanges();
         return(services.Id);
     }
     catch
     {
         return(-1);
     }
 }
Пример #3
0
 public static bool Modify(ServicesView s)
 {
     try
     {
         db = new AceEntities();
         Services services = new Services
         {
             Name  = s.Name,
             Price = s.Price
         };
         db.Services.Attach(services);
         db.Entry(services).State = EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }