Esempio n. 1
0
        public bool Create_Window(string Userlogin)
        {
            var role = ceqacc.Login.Where(x => x.name == Userlogin);

            switch (role.First().role_id)
            {
            case 0:     //права адміністратора
                Home h = new Home(Userlogin);
                h.Show();

                break;

            case 2:
                accountant ac = new accountant(Userlogin);
                ac.Show();
                break;


            case 3:     //права спеціаліста

                Home home = new Home(Userlogin);
                home.Show();
                break;
            }
            return(true);
        }
        public ActionResult Create([Bind(Include = "id,Insurance,mobileCost,telephoneCost,electricity,rent,officeSupplies,sanitarySupplies,month")] accountant accountant)
        {
            if (ModelState.IsValid)
            {
                var    Tlist      = db.NewTrucks.ToList();
                double tinsurance = 0.00;
                foreach (var item in Tlist)
                {
                    tinsurance = tinsurance + item.insurance;
                }

                var    mlist      = db.Maintenances.ToList();
                double tmaintence = 0.00;
                foreach (var item in mlist)
                {
                    tmaintence = tmaintence + item.MaintainPrice;
                }



                accountant.month = accountant.monthly() + tinsurance + tmaintence;


                db.accountants.Add(accountant);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(accountant));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            accountant accountant = db.accountants.Find(id);

            db.accountants.Remove(accountant);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,Insurance,mobileCost,telephoneCost,electricity,rent,officeSupplies,sanitarySupplies,month")] accountant accountant)
 {
     if (ModelState.IsValid)
     {
         db.Entry(accountant).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(accountant));
 }
        // GET: accountants/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            accountant accountant = db.accountants.Find(id);

            if (accountant == null)
            {
                return(HttpNotFound());
            }
            return(View(accountant));
        }