Beispiel #1
0
        private void saveAbsences()
        {
            List <int> selectedStudents = new List <int>();

            foreach (ListItem item in listBoxStudentAbsences.Items)
            {
                if (item.Selected)
                {
                    selectedStudents.Add(Int32.Parse(item.Value));
                }
            }
            if (selectedStudents.Count() == 0 || dropDownListSubjects.SelectedIndex == 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert(\" Не сте маркирали никого. Опитайте отново след като маркирате избраните ученици. \");", true);
                return;
            }

            for (int i = 0; i < selectedStudents.Count(); ++i)
            {
                Absence newAbsence = new Absence();
                newAbsence.StudentID     = selectedStudents[i];
                newAbsence.SubjectID     = (short)dropDownListSubjects.SelectedIndex;
                newAbsence.Excused       = false;
                newAbsence.AbsenceTypeID = 2;
                newAbsence.Date          = DateTime.Now.Date;
                db.Absences.Add(newAbsence);
                db.SaveChanges();
            }
            listBoxStudentAbsences.SelectedIndex = -1;
            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert(\" Отсъстващите са записани. \");", true);
        }
Beispiel #2
0
        private void saveActor()
        {
            var db = new eRegisterContext();

            Actor newActor = new Actor();

            newActor.FirstName   = Name.Text;
            newActor.MiddleName  = Midname.Text;
            newActor.LastName    = Lastname.Text;
            newActor.Gender      = Convert.ToBoolean(dropDownListGender.SelectedIndex);
            newActor.Address     = Address.Text;
            newActor.EGN         = PersonalID.Text;
            newActor.email       = Email.Text;
            newActor.PhoneNumber = Number.Text;
            newActor.UserID      = newUser.UserID;

            newActor.ClassDivisionID = dropDownListDivisionDetails.SelectedIndex;
            newActor.SchoolID        = dropDownListSchool.SelectedIndex;
            newActor.CityVillageID   = dropDownListTown.SelectedIndex;

            if (dropDownListType.SelectedIndex == 1)
            {
                newActor.ParentlID = parrentActor.ActorID;
            }

            db.Actors.Add(newActor);
            db.SaveChanges();
        }
Beispiel #3
0
        private void saveUser()
        {
            var db = new eRegisterContext();


            newUser.UserName   = inputUsername.Text;
            newUser.Password   = inputPassword.Text;
            newUser.UserTypeID = dropDownListType.SelectedIndex;
            db.Users.Add(newUser);
            db.SaveChanges();
            //ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert(\" Потребителят е добавен успешно. \");", true);
        }
Beispiel #4
0
        private void saveParrentActor()
        {
            var db = new eRegisterContext();

            parrentActor.FirstName  = parrentName.Text;
            parrentActor.MiddleName = parrentMName.Text;
            parrentActor.LastName   = parrentLName.Text;

            parrentActor.Gender      = Convert.ToBoolean(dropDownListGender.SelectedIndex);
            parrentActor.Address     = Address.Text;
            parrentActor.EGN         = PersonalID.Text;
            parrentActor.email       = Email.Text;
            parrentActor.PhoneNumber = parrentPhone.Text;
            db.Actors.Add(parrentActor);
            db.SaveChanges();
        }