Esempio n. 1
0
        // GET: PostOffices
        public ActionResult Index()
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            List <PostOffices> model = new List <PostOffices>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <PostOffices> postoff = entities.PostOffices.ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta

                foreach (PostOffices post in postoff)
                {
                    PostOffices view = new PostOffices();
                    view.Post_id    = post.Post_id;
                    view.PostalCode = post.PostalCode;
                    view.PostOffice = post.PostOffice;

                    model.Add(view);
                }
            }
            finally
            {
                entities.Dispose();
            }

            return(View(model));
        }//Index
Esempio n. 2
0
        public ActionResult Create(User model)
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            User usr = new User();

            usr.UserIdentity   = model.UserIdentity;
            usr.Password       = "******";
            usr.CreatedAt      = DateTime.Now;
            usr.LastModifiedAt = DateTime.Now;
            usr.DeletedAt      = model.DeletedAt;
            usr.Active         = model.Active;

            db.User.Add(usr);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public ActionResult Create(StudentViewModel model)
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            StudentGroup stug = new StudentGroup();

            stug.StudentGroupName = model.StudentGroupName;
            stug.Active           = model.Active;
            stug.CreatedAt        = DateTime.Now;
            stug.LastModifiedAt   = DateTime.Now;
            stug.DeletedAt        = model.DeletedAt;

            db.StudentGroup.Add(stug);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }//create
Esempio n. 4
0
        public ActionResult Create(TreatmentPlaceViewModel model)
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            TreatmentPlace trp = new TreatmentPlace();

            trp.TreatmentPlaceName   = model.TreatmentPlaceName;
            trp.TreatmentPlaceNumber = model.TreatmentPlaceNumber;

            db.TreatmentPlace.Add(trp);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
        // GET: Phones
        public ActionResult Index()
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            List <Phone> model = new List <Phone>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <Phone> phones = entities.Phone.ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (Phone phone in phones)
                {
                    Phone view = new Phone();
                    view.Phone_id   = phone.Phone_id;
                    view.PhoneNum_1 = phone.PhoneNum_1;

                    model.Add(view);
                }
            }
            finally
            {
                entities.Dispose();
            }

            return(View(model));
        }
Esempio n. 6
0
        // GET: Henkilo/Details/5
        public ActionResult Details(int?id)
        {
            List <SimplyTunnitData> model = new List <SimplyTunnitData>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                Henkilot henkilodetail = entities.Henkilot.Find(id);
                if (henkilodetail == null)
                {
                    return(HttpNotFound());
                }

                SimplyTunnitData hlo = new SimplyTunnitData();
                hlo.Henkilo_id  = henkilodetail.Henkilo_id;
                hlo.Etunimi     = henkilodetail.Etunimi;
                hlo.Sukunimi    = henkilodetail.Sukunimi;
                hlo.Osoite      = henkilodetail.Osoite;
                hlo.Esimies     = henkilodetail.Esimies;
                hlo.Postinumero = henkilodetail.Postinumero;
            }
            finally
            {
                entities.Dispose();
            }

            return(View(model));
        }
Esempio n. 7
0
        public ActionResult Create(Treatment model)
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            Treatment treatment = new Treatment();

            treatment.TreatmentName  = model.TreatmentName;
            treatment.TreatmentTime  = model.TreatmentTime;
            treatment.TreatmentPrice = model.TreatmentPrice;

            db.Treatment.Add(treatment);
            //if (ModelState.IsValid)
            //{
            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
        // GET: Henkilo
        public ActionResult Index()
        {
            List <SimplyTunnitData> model = new List <SimplyTunnitData>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <Henkilot> henkilot = entities.Henkilot.OrderByDescending(Henkilot => Henkilot.Sukunimi).ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (Henkilot henkilo in henkilot)
                {
                    SimplyTunnitData hlo = new SimplyTunnitData();
                    hlo.Henkilo_id  = henkilo.Henkilo_id;
                    hlo.Etunimi     = henkilo.Etunimi;
                    hlo.Sukunimi    = henkilo.Sukunimi;
                    hlo.Osoite      = henkilo.Osoite;
                    hlo.Esimies     = henkilo.Esimies;
                    hlo.Postinumero = henkilo.Postinumero;

                    model.Add(hlo);
                }

                return(View(model));
            }

            finally
            {
                entities.Dispose();
            }
        }
Esempio n. 9
0
        public ActionResult CreatePerson(Henkilot model)
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            Henkilot henkilot = new Henkilot();

            henkilot.Henkilo_id  = model.Henkilo_id;
            henkilot.Etunimi     = model.Etunimi;
            henkilot.Sukunimi    = model.Sukunimi;
            henkilot.Osoite      = model.Osoite;
            henkilot.Esimies     = model.Esimies;
            henkilot.Postinumero = model.Postinumero;

            db.Henkilot.Add(henkilot);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        // GET: Studentxes
        public ActionResult Index()
        {
            //string username = User.Identity.Name;
            //string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            List <StudentViewModel> model = new List <StudentViewModel>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <Studentx> students = entities.Studentx.OrderBy(Studentx => Studentx.LastName).ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (Studentx student in students)
                {
                    StudentViewModel stu = new StudentViewModel();

                    ViewBag.UserIdentity = new SelectList((from u in db.User select new { User_id = u.User_id, UserIdentity = u.UserIdentity }), "User_id", "UserIdentity", null);
                    stu.User_id          = student.User?.FirstOrDefault()?.User_id;
                    stu.UserIdentity     = student.User?.FirstOrDefault()?.UserIdentity;

                    stu.Student_id        = student.Student_id;
                    stu.FirstNameH        = student.FirstName;
                    stu.LastNameH         = student.LastName;
                    stu.Identity          = student.Identity;
                    stu.Address           = student.Address;
                    stu.Email             = student.Email;
                    stu.EnrollmentDateIN  = student.EnrollmentDateIN;
                    stu.EnrollmentDateOUT = student.EnrollmentDateOUT;
                    stu.EnrollmentDateOFF = student.EnrollmentDateOFF;
                    stu.Notes             = student.Notes;
                    stu.CreatedAt         = student.CreatedAt;
                    stu.LastModifiedAt    = student.LastModifiedAt;
                    stu.DeletedAt         = student.DeletedAt;

                    ViewBag.Active  = new SelectList((from a in db.Studentx select new { Student_id = a.Student_id, Active = a.Active }), "Student_id", "Active", null);
                    stu.Active      = student.Active;
                    stu.Information = student.Information;

                    stu.Phone_id   = student.Phone?.FirstOrDefault()?.Phone_id;
                    stu.PhoneNum_1 = student.Phone?.FirstOrDefault()?.PhoneNum_1;

                    stu.Post_id    = student.PostOffices?.FirstOrDefault()?.Post_id;
                    stu.PostalCode = student.PostOffices?.FirstOrDefault()?.PostalCode;
                    stu.PostOffice = student.PostOffices?.FirstOrDefault()?.PostOffice;

                    ViewBag.StudentGroupName = new SelectList((from s in db.StudentGroup select new { StudentGroup_id = s.StudentGroup_id, StudentGroupName = s.StudentGroupName }), "StudentGroup_id", "StudentGroupName", null);
                    stu.StudentGroup_id      = student.StudentGroup?.StudentGroup_id;
                    stu.StudentGroupName     = student.StudentGroup?.StudentGroupName;

                    model.Add(stu);
                }
            }
            finally
            {
                entities.Dispose();
            }
            return(View(model));
        }
Esempio n. 11
0
        //2.vaihtoehto ilman ViewModel luokkaa
        //List<Henkilot> model = new List<Henkilot>();
        //try
        //{
        //    JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();
        //    model = entities.Henkilot.ToList();
        //    entities.Dispose();
        //}
        //catch (Exception ex)
        //{
        //    ViewBag.ErrorMessage = ex.GetType() + ": " + ex.Message;
        //}
        //return View(model);

        public ActionResult GetTunnit(int?id)
        {
            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            List <Tunnit> tunnit = (from t in entities.Tunnit
                                    where t.Henkilo_id == id
                                    select t).ToList();

            List <SimplyTunnitData> result = new List <SimplyTunnitData>();

            CultureInfo fiFi = new CultureInfo("fi-FI");

            foreach (Tunnit tunti in tunnit)
            {
                SimplyTunnitData data = new SimplyTunnitData();

                data.Tunti_id   = tunti.Tunti_id;
                data.Henkilo_id = (int)(tunti.Henkilo_id);
                //data.Pvm = tunti.Pvm.Value.ToString(fiFi);
                data.Pvm            = tunti.Pvm;
                data.ProjektiTunnit = (int)tunti.ProjektiTunnit;

                List <Projektit> projektit = (from p in entities.Projektit
                                              where p.Projekti_id == tunti.Projekti_id
                                              select p).ToList();

                data.ProjektiNimi = projektit[0].ProjektiNimi;

                result.Add(data);
            }

            entities.Dispose();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        // GET: StudentGroups
        public ActionResult Index()
        {
            //string username = User.Identity.Name;
            //string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            List <StudentGroupViewModel> model = new List <StudentGroupViewModel>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <StudentGroup> treatoffs = entities.StudentGroup.ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta

                foreach (StudentGroup stg in treatoffs)
                {
                    StudentGroupViewModel view = new StudentGroupViewModel();
                    view.StudentGroup_id  = stg.StudentGroup_id;
                    view.StudentGroupName = stg.StudentGroupName;
                    view.Active           = stg.Active;
                    view.CreatedAt        = stg.CreatedAt;
                    view.LastModifiedAt   = stg.LastModifiedAt;
                    view.DeletedAt        = stg.DeletedAt;

                    model.Add(view);
                }
            }
            finally
            {
                entities.Dispose();
            }

            return(View(model));
        }//Index
        public ActionResult Create(StudentViewModel model)
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            StudentGroup stug = new StudentGroup();

            stug.StudentGroupName = model.StudentGroupName;
            stug.Active           = model.Active;
            stug.CreatedAt        = DateTime.Now;
            stug.LastModifiedAt   = DateTime.Now;
            stug.DeletedAt        = model.DeletedAt;

            db.StudentGroup.Add(stug);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }//create
Esempio n. 14
0
        // GET: Projekti
        public ActionResult Index()
        {
            List <SimplyTunnitData> model = new List <SimplyTunnitData>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <Projektit> projektit = entities.Projektit.OrderByDescending(Projektit => Projektit.Avattu).ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (Projektit projekti in projektit)
                {
                    SimplyTunnitData pro = new SimplyTunnitData();
                    pro.Projekti_id  = projekti.Projekti_id;
                    pro.ProjektiNimi = projekti.ProjektiNimi;
                    pro.Esimies      = projekti.Esimies;
                    pro.Avattu       = projekti.Avattu;
                    pro.Suljettu     = projekti.Suljettu;
                    pro.Status       = projekti.Status;

                    model.Add(pro);
                }

                return(View(model));
            }

            finally
            {
                entities.Dispose();
            }
        }
        // GET: TreatmentPlaces
        public ActionResult Index()
        {
            //string username = User.Identity.Name;
            //string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            List <TreatmentPlaceViewModel> model = new List <TreatmentPlaceViewModel>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <TreatmentPlace> treatplaces = entities.TreatmentPlace.ToList();
                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (TreatmentPlace treatplace in treatplaces)
                {
                    TreatmentPlaceViewModel view = new TreatmentPlaceViewModel();
                    view.TreatmentPlace_id    = treatplace.TreatmentPlace_id;
                    view.TreatmentPlaceName   = treatplace.TreatmentPlaceName;
                    view.TreatmentPlaceNumber = treatplace.TreatmentPlaceNumber;

                    model.Add(view);
                }
            }
            finally
            {
                entities.Dispose();
            }

            return(View(model));
        }//Index
Esempio n. 16
0
        // GET: Customers
        public ActionResult Index()
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            List <CustomerViewModel> model = new List <CustomerViewModel>();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <Customer> customers = entities.Customer.OrderBy(Customer => Customer.LastName).ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (Customer customer in customers)
                {
                    CustomerViewModel view = new CustomerViewModel();
                    view.User_id         = customer.User?.FirstOrDefault()?.User_id;
                    view.UserIdentity    = customer.User?.FirstOrDefault()?.UserIdentity;
                    ViewBag.UserIdentity = new SelectList((from u in db.User select new { User_id = u.User_id, UserIdentity = u.UserIdentity }), "User_id", "UserIdentity", null);

                    view.Customer_id    = customer.Customer_id;
                    view.FirstNameA     = customer.FirstName;
                    view.LastNameA      = customer.LastName;
                    view.Identity       = customer.Identity;
                    view.Email          = customer.Email;
                    view.Address        = customer.Address;
                    view.Notes          = customer.Notes;
                    view.CreatedAt      = customer.CreatedAt;
                    view.LastModifiedAt = customer.LastModifiedAt;
                    view.DeletedAt      = customer.DeletedAt;
                    view.Active         = customer.Active;
                    view.Permission     = customer.Permission;

                    view.Phone_id   = customer.Phone?.FirstOrDefault()?.Phone_id;
                    view.PhoneNum_1 = customer.Phone?.FirstOrDefault()?.PhoneNum_1;

                    view.Post_id    = customer.PostOffices?.FirstOrDefault()?.Post_id;
                    view.PostalCode = customer.PostOffices?.FirstOrDefault()?.PostalCode;
                    view.PostOffice = customer.PostOffices?.FirstOrDefault()?.PostOffice;

                    //haetaan seuraava varaus:
                    view.Reservation_id = customer.Reservation?.FirstOrDefault()?.Reservation_id;
                    view.Start          = customer.Reservation?.FirstOrDefault()?.Start;
                    view.End            = customer.Reservation?.FirstOrDefault()?.End.Value;
                    view.Date           = customer.Reservation?.FirstOrDefault()?.Date.Value;

                    model.Add(view);
                }
            }
            finally
            {
                entities.Dispose();
            }



            return(View(model));
        }//Index
Esempio n. 17
0
        //PDF-tiedoston luominen:
        public ActionResult DownloadViewPDF(int?id)
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            PersonnelViewModel model = new PersonnelViewModel();

            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();

            try
            {
                List <Personnel> personnels = entities.Personnel.ToList();

                // muodostetaan näkymämalli tietokannan rivien pohjalta
                foreach (Personnel persdetail in personnels)
                {
                    PersonnelViewModel view = new PersonnelViewModel();

                    ViewBag.UserIdentity = new SelectList((from u in db.User select new { User_id = u.User_id, UserIdentity = u.UserIdentity }), "User_id", "UserIdentity", null);
                    view.User_id         = persdetail.User?.FirstOrDefault()?.User_id;
                    view.UserIdentity    = persdetail.User?.FirstOrDefault()?.UserIdentity;

                    view.Personnel_id   = persdetail.Personnel_id;
                    view.FirstNameP     = persdetail.FirstName;
                    view.LastNameP      = persdetail.LastName;
                    view.Identity       = persdetail.Identity;
                    view.Email          = persdetail.Email;
                    view.Notes          = persdetail.Notes;
                    view.CreatedAt      = persdetail.CreatedAt;
                    view.LastModifiedAt = persdetail.LastModifiedAt;
                    view.DeletedAt      = persdetail.DeletedAt;
                    view.Active         = persdetail.Active;
                    view.Information    = persdetail.Information;

                    view.Phone_id   = persdetail.Phone?.FirstOrDefault()?.Phone_id;
                    view.PhoneNum_1 = persdetail.Phone?.FirstOrDefault()?.PhoneNum_1;

                    view.Post_id    = persdetail.PostOffices?.FirstOrDefault()?.Post_id;
                    view.PostalCode = persdetail.PostOffices?.FirstOrDefault()?.PostalCode;
                    view.PostOffice = persdetail.PostOffices?.FirstOrDefault()?.PostOffice;

                    model = view;
                }
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                Personnel personnel = db.Personnel.Find(id);
                if (personnel == null)
                {
                    return(HttpNotFound());
                }
            }
            finally
            {
                entities.Dispose();
            }
            return(new ViewAsPdf(model));
        }//DownloadViewPDF
Esempio n. 18
0
        public ActionResult CreateProject()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            SimplyTunnitData model = new SimplyTunnitData();

            return(View(model));
        }
Esempio n. 19
0
        // GET: Treatments/Create
        public ActionResult Create()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();
            //ViewBag.TreatmentPlace_id = new SelectList(db.TreatmentPlace, "Treatmentplace_id", "TreatmentPlaceName");
            List <Treatment> model = new List <Treatment>();

            return(View(model));
        }
Esempio n. 20
0
        public int PersonCount()
        {
            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();
            int personCount = entities.Henkilot.Count();

            entities.Dispose();
            return(personCount);
        }
        }//details

        // GET: StudentGroups/Create
        public ActionResult Create()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            StudentGroupViewModel model = new StudentGroupViewModel();

            return(View());
        }//create
Esempio n. 22
0
        public int ProjectCount()
        {
            JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();
            int projectCount = entities.Projektit.Count();

            entities.Dispose();
            return(projectCount);
        }
Esempio n. 23
0
        public ActionResult CreatePerson()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            Henkilot model = new Henkilot();

            return(View(model));
        }
        }//Index

        // GET: TreatmentPlaces/Details/5
        //public ActionResult Details(int? id)
        //{
        //    TreatmentPlaceViewModel model = new TreatmentPlaceViewModel();

        //    JohaMeriSQL1Entities entities = new JohaMeriSQL1Entities();
        //    try
        //    {
        //        if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    TreatmentPlace treatmentPlace = db.TreatmentPlace.Find(id);
        //    if (treatmentPlace == null)
        //    {
        //        return HttpNotFound();
        //    }

        //        // muodostetaan näkymämalli tietokannan rivien pohjalta
        //        TreatmentPlaceViewModel view = new TreatmentPlaceViewModel();
        //        view.TreatmentPlace_id = treatmentPlace.TreatmentPlace_id;
        //        view.TreatmentPlaceName = treatmentPlace.TreatmentPlaceName;
        //        view.TreatmentPlaceNumber = treatmentPlace.TreatmentPlaceNumber;

        //        model = view;
        //    }
        //    finally
        //    {
        //        entities.Dispose();
        //    }

        //    return View(model);
        //}//details


        // GET: TreatmentPlaces/Create
        public ActionResult Create()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            TreatmentPlaceViewModel model = new TreatmentPlaceViewModel();

            return(View(model));
        }//create
Esempio n. 25
0
        public ActionResult Create(CustomerViewModel model)
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            Customer cus = new Customer();

            cus.FirstName      = model.FirstNameA;
            cus.LastName       = model.LastNameA;
            cus.Identity       = model.Identity;
            cus.Address        = model.Address;
            cus.Email          = model.Email;
            cus.Notes          = model.Notes;
            cus.CreatedAt      = DateTime.Now;
            cus.LastModifiedAt = DateTime.Now;
            cus.DeletedAt      = model.DeletedAt;
            cus.Active         = model.Active;
            cus.Permission     = model.Permission;

            db.Customer.Add(cus);

            User usr = new User();

            usr.UserIdentity     = model.UserIdentity;
            usr.Password         = "******";
            usr.Customer         = cus;
            ViewBag.UserIdentity = new SelectList((from u in db.User select new { User_id = u.User_id, UserIdentity = u.UserIdentity }), "User_id", "UserIdentity", null);

            db.User.Add(usr);

            Phone pho = new Phone();

            pho.PhoneNum_1 = model.PhoneNum_1;
            pho.Customer   = cus;

            db.Phone.Add(pho);

            PostOffices pos = new PostOffices();

            pos.PostalCode = model.PostalCode;
            pos.PostOffice = model.PostOffice;
            pos.Customer   = cus;

            db.PostOffices.Add(pos);

            try
            {
                db.SaveChanges();
            }

            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }//create
        }//details

        // GET: Personnels/Create
        public ActionResult Create()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            PersonnelViewModel model = new PersonnelViewModel();

            ViewBag.UserIdentity = new SelectList((from u in db.User select new { User_id = u.User_id, UserIdentity = u.UserIdentity }), "User_id", "UserIdentity", null);

            return(View(model));
        }//create
Esempio n. 27
0
        // GET: Users/Create
        public ActionResult Create()
        {
            //string username = User.Identity.Name;
            //string userid = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            List <User> model = new List <User>();

            return(View(model));
        }
Esempio n. 28
0
        public ActionResult CreateTunnit()
        {
            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            SimplyTunnitData model = new SimplyTunnitData();

            ViewBag.ProjektiNimi = new SelectList((from pn in db.Projektit select new { Projekti_id = pn.Projekti_id, ProjektiNimi = pn.ProjektiNimi }), "Projekti_id", "ProjektiNimi", null);
            ViewBag.KokonimiH    = new SelectList((from kn in db.Henkilot select new { Henkilo_id = kn.Henkilo_id, KokonimiH = kn.Etunimi + " " + kn.Sukunimi }), "Henkilo_id", "KokonimiH", null);

            return(View(model));
        }
Esempio n. 29
0
        // GET: Treatments/Create
        public ActionResult Create()
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();
            //ViewBag.TreatmentPlace_id = new SelectList(db.TreatmentPlace, "Treatmentplace_id", "TreatmentPlaceName");
            List <Treatment> model = new List <Treatment>();

            return(View(model));
        }
Esempio n. 30
0
        }//details

        // GET: TreatmentOffices/Create
        public ActionResult Create()
        {
            string username = User.Identity.Name;
            string userid   = ((ClaimsPrincipal)User).Claims?.Where(c => c.Type == ClaimTypes.GroupSid).FirstOrDefault()?.Value ?? "";

            JohaMeriSQL1Entities db = new JohaMeriSQL1Entities();

            TreatmentOfficeViewModel model = new TreatmentOfficeViewModel();

            return(View(model));
        }    //create