Beispiel #1
0
        private void btn_employee_delete_Click(object sender, EventArgs e)
        {
            try
            {
                if (gbEmpId > 0)
                {
                    using (var context = new PreSchoolEntities1())
                    {
                        var emplooye     = context.tbl_employee.Where(item => item.id == gbEmpId).First();
                        var confirmation = MessageBox.Show("Are You Sure About Deleting This Emplooye ?", "Please Confirm", MessageBoxButtons.YesNo);
                        if (confirmation == DialogResult.Yes)
                        {
                            context.tbl_employee.Remove(emplooye);
                            context.SaveChanges();
                        }
                    }

                    view();
                    clear();
                }
                else
                {
                    MessageBox.Show("Please Select A Row To Delete");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error Deleting Room Data");
            }
        }
Beispiel #2
0
        private void btn_addkids_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (userId > 0)
                {
                    using (var context = new PreSchoolEntities1())
                    {
                        var user         = context.tbl_user.Where(item => item.id == userId).First();
                        var confirmation = MessageBox.Show("Are You Sure About Deleting " + user.User_fullname + "?", "Please Confirm", MessageBoxButtons.YesNo);
                        if (confirmation == DialogResult.Yes)
                        {
                            context.tbl_user.Remove(user);
                            context.SaveChanges();
                        }
                    }

                    view();
                    clear();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please Select A Field You Want To Delete");
            }
        }
Beispiel #3
0
 private void gunaAdvenceButton7_Click(object sender, EventArgs e)
 {
     try
     {
         if (!String.IsNullOrWhiteSpace(gunaLineTextBox1.Text) && gunaLineTextBox1.Text != "0")
         {
             int healthId = int.Parse(gunaLineTextBox1.Text);
             using (var context = new PreSchoolEntities1())
             {
                 var healthData   = context.tbl_child_healthy.Where(item => item.id == healthId).First();
                 var confirmation = MessageBox.Show("Are You Sure About Deleting This Child In This Room ", "Please Confirm", MessageBoxButtons.YesNo);
                 if (confirmation == DialogResult.Yes)
                 {
                     context.tbl_child_healthy.Remove(healthData);
                     context.SaveChanges();
                     clear();
                 }
             }
         }
         else
         {
             MessageBox.Show("No Id In The Search Field");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error Deleting Health Data");
     }
 }
        void view()
        {
            db = new PreSchoolEntities1();
            var roomsData = db.tbl_rooms.Join(
                db.tbl_child_info,
                room => room.id_child,
                child => child.id,
                (room, child) => new
            {
                id        = room.id,
                childName = child.child_fullname,
                roomId    = room.id_room_name,
            }
                ).Join(
                db.tbl_room_name,
                room => room.roomId,
                roomName => roomName.id,
                (table1, roomName) => new
            {
                Id        = table1.id,
                ChildName = table1.childName,
                RoomName  = roomName.room_name,
            }

                ).ToList();

            dataGridView1.DataSource = roomsData;
        }
Beispiel #5
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var cellData = dataGridView1.SelectedCells[0].Value.ToString();

            if (!String.IsNullOrWhiteSpace(cellData))
            {
                try
                {
                    var id = int.Parse(cellData);
                    db = new PreSchoolEntities1();
                    var user = db.tbl_user
                               .Where(s => s.id == id)
                               .FirstOrDefault();
                    txt_user_userFullname.Text = user.User_fullname;
                    txt_user_password.Text     = user.password;
                    txt_user_username.Text     = user.username;
                    combo_role.Text            = user.User_Role;
                    userId = int.Parse(user.id.ToString());


                    if (user.status == true)
                    {
                        gunaCheckBox1.Checked = true;
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Please Select The Id");
                }
            }
        }
Beispiel #6
0
        private void gunaAdvenceButton1_Click(object sender, EventArgs e)
        {
            var user = new userClass();

            db = new PreSchoolEntities1();
            var authUser = db.tbl_user.Where(
                x => x.username == username.Text && x.password == gunaLineTextBox2.Text
                ).FirstOrDefault();

            if (authUser != null)
            {
                userClass.setUserId(int.Parse(authUser.id.ToString()));
                userClass.setUserName(authUser.username);
                userClass.setFullName(authUser.User_fullname);
                userClass.setUserStatus(authUser.status.ToString());
                userClass.setUserRole(authUser.User_Role);
                userClass.setUserPassword(authUser.password);
                main main = new main();
                main.c = gunaWinSwitch1.Checked;
                main.Show();
                this.Hide();
            }

            else
            {
                MessageBox.Show(this, "Wrong Credentials");
            }
        }
Beispiel #7
0
 private void gunaAdvenceButton7_Click(object sender, EventArgs e)
 {
     try
     {
         if (!String.IsNullOrWhiteSpace(gunaLineTextBox1.Text) && gunaLineTextBox1.Text != "0")
         {
             int childId = int.Parse(gunaLineTextBox1.Text);
             using (var context = new PreSchoolEntities1())
             {
                 var childData    = context.tbl_child_info.Where(item => item.id == childId).First();
                 var confirmation = MessageBox.Show("Are You Sure About Deleting This Child Data ", "Please Confirm", MessageBoxButtons.YesNo);
                 if (confirmation == DialogResult.Yes)
                 {
                     context.tbl_child_info.Remove(childData);
                     context.SaveChanges();
                     Clear(Controls);
                 }
             }
         }
         else
         {
             MessageBox.Show("No Id In The Search Field");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Before You Deeleting This Child Data You Should Remove It From The Room And Other References");
         Clear(Controls);
     }
 }
Beispiel #8
0
        private void btn_rooms_delete_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (gbActivityId > 0)
                {
                    using (var context = new PreSchoolEntities1())
                    {
                        var activity     = context.tbl_subject_activity.Where(item => item.id == gbActivityId).First();
                        var confirmation = MessageBox.Show("Are You Sure About Deleting This Child In This Activity ?", "Please Confirm", MessageBoxButtons.YesNo);
                        if (confirmation == DialogResult.Yes)
                        {
                            context.tbl_subject_activity.Remove(activity);
                            context.SaveChanges();
                        }
                    }

                    view();
                    clear();
                }
                else
                {
                    MessageBox.Show("Please Select A Row To Delete");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error Deleting Room Data");
            }
        }
        private void btn_addkids_save_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(diseasse.Text))
            {
                MessageBox.Show("Please type something!");
            }
            else
            {
                try
                {
                    db = new PreSchoolEntities1();
                    int userId     = userClass.getUserId();
                    var newDisease = new tbl_disease_type()
                    {
                        name_disease = diseasse.Text,
                        id_user_save = userId,
                    };

                    db.tbl_disease_type.Add(newDisease);

                    db.SaveChanges();

                    MessageBox.Show("New Disease Added");
                }
                catch (Exception)
                {
                    MessageBox.Show("Error Adding New Data");
                }
            }
        }
        private void btn_rooms_save_Click(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();

            if (gunaLineTextBox1.Text == gunaLineTextBox2.Text && !String.IsNullOrWhiteSpace(gunaLineTextBox1.Text))
            {
                db = new PreSchoolEntities1();

                int userId = userClass.getUserId();

                var user = db.tbl_user.Where(x => x.id == userId).FirstOrDefault();

                user.password = gunaLineTextBox1.Text;

                userClass.setUserPassword(user.password);

                db.SaveChangesAsync();



                MessageBox.Show("Password Changed Successfully");

                gunaLineTextBox1.Text = null;
                gunaLineTextBox2.Text = null;
            }

            else if ((gunaLineTextBox1.Text != gunaLineTextBox2.Text))
            {
                MessageBox.Show("Password Do Not Match");
            }
            else if (String.IsNullOrWhiteSpace(gunaLineTextBox1.Text))
            {
                MessageBox.Show("Please Enter Something At First");
            }
        }
        public void search(string text)
        {
            db = new PreSchoolEntities1();
            db.tbl_child_info.Where(n => n.child_fullname.Contains(text)).Load();
            var childs = dataGridView1.DataSource = db.tbl_child_info.Local.ToBindingList();

            dataGridView1.DataSource = childs;
        }
        private void btn_rooms_save_Click(object sender, EventArgs e)
        {
            if (gbAttensId > 0)
            {
                db = new PreSchoolEntities1();
                var attenData = db.tbl_attendance.Where(x => x.id == gbAttensId).FirstOrDefault();

                var childId = db.tbl_child_info.Where(items => items.child_fullname == comboo_child_name.Text)
                              .Select(a => a.id)
                              .FirstOrDefault();

                DateTime dt         = dateTimePicker1.Value;
                TimeSpan incomeTime = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

                DateTime dt2      = dateTimePicker2.Value;
                TimeSpan leftTime = new TimeSpan(dt2.Hour, dt2.Minute, dt2.Second);

                attenData.id_child    = childId;
                attenData.time_income = incomeTime;
                attenData.time_left   = leftTime;
                attenData.left_with   = left_with.Text;
                attenData.date_save   = DateTime.Now;

                db.SaveChanges();
                view();
                clear();
            }
            else
            {
                db = new PreSchoolEntities1();
                DateTime dt         = dateTimePicker1.Value;
                TimeSpan incomeTime = new TimeSpan(dt.Hour, dt.Minute, dt.Second);

                DateTime dt2      = dateTimePicker2.Value;
                TimeSpan leftTime = new TimeSpan(dt2.Hour, dt2.Minute, dt2.Second);

                var childId = db.tbl_child_info.Where(items => items.child_fullname == comboo_child_name.Text)
                              .Select(a => a.id)
                              .FirstOrDefault();

                var newAttendance = new tbl_attendance()
                {
                    id_child     = childId,
                    id_user_save = userClass.getUserId(),
                    time_income  = incomeTime,
                    time_left    = leftTime,
                    left_with    = left_with.Text,
                    date_save    = DateTime.Now
                };

                db.tbl_attendance.Add(newAttendance);

                db.SaveChanges();

                view();
                clear();
            }
        }
        private void btn_rooms_save_Click(object sender, EventArgs e)
        {
            if (gbSocialId > 0)
            {
                db = new PreSchoolEntities1();
                var sociogistData = db.tbl_sociologist.Where(items => items.id == gbSocialId).FirstOrDefault();

                var childId = db.tbl_child_info.Where(items => items.child_fullname == combo_sociallogist_child_name.Text)
                              .Select(a => a.id)
                              .FirstOrDefault();

                var roomId = db.tbl_room_name
                             .Where(items => items.room_name == combo_sociallogist_room_name.Text)
                             .Select(a => a.id)
                             .FirstOrDefault();

                sociogistData.id_user_update  = userClass.getUserId();
                sociogistData.datetime_update = DateTime.Now;
                sociogistData.note            = not_sociallogist.Text;
                sociogistData.id_room_name    = roomId;
                sociogistData.id_child        = childId;

                db.SaveChangesAsync();
                view();
                clear();
            }
            else
            {
                db = new PreSchoolEntities1();

                var childId = db.tbl_child_info.Where(items => items.child_fullname == combo_sociallogist_child_name.Text)
                              .Select(a => a.id)
                              .FirstOrDefault();

                var roomId = db.tbl_room_name
                             .Where(items => items.room_name == combo_sociallogist_room_name.Text)
                             .Select(a => a.id)
                             .FirstOrDefault();


                var newSocial = new tbl_sociologist()
                {
                    id_user_save  = userClass.getUserId(),
                    id_child      = childId,
                    note          = not_sociallogist.Text,
                    datetime_save = DateTime.Now,
                    id_room_name  = roomId
                };

                db.tbl_sociologist.Add(newSocial);
                db.SaveChangesAsync();
                view();
            }
        }
Beispiel #14
0
        private void combo_addkids_child_place_of_birth_Enter(object sender, EventArgs e)
        {
            combo_addkids_child_place_of_birth.Items.Clear();
            db = new PreSchoolEntities1();
            var addresses = db.tbl_address;

            foreach (var item in addresses)
            {
                combo_addkids_child_place_of_birth.Items.Add(item.adrress);
            }
        }
Beispiel #15
0
        private void addKidscs_Load(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();
            var addresses = db.tbl_address;

            foreach (var item in addresses)
            {
                combo_addkids_child_address.Items.Add(item.adrress);
                combo_addkids_child_place_of_birth.Items.Add(item.adrress);
            }
        }
Beispiel #16
0
        private void childHealth_Load(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();
            var childs = db.tbl_child_info;

            foreach (var item in childs)
            {
                combo_childHealth_child_name.Items.Add(item.child_fullname);
            }

            fillDisease();
        }
        void search(string txt)
        {
            db = new PreSchoolEntities1();
            var healthData = db.tbl_child_healthy.Join(
                db.tbl_child_info,
                x => x.id_child,
                y => y.id,
                (health, child) => new
            {
                id               = health.id,
                child_name       = child.child_fullname,
                drug_algeric     = health.drug_allergy,
                coronic_cure     = health.darmany_naxoshiya_drezhxayanaka,
                surgery          = health.have_surgery,
                disease_id_name  = health.id_child_disease_type,
                surgery_note     = health.note_of_surgery,
                clinic_type      = health.general_clinic_test_disease_type,
                clinic_type_note = health.general_clinic_test_disease_type_note,
                face_type        = health.face_type,
                height           = health.child_height,
                weight           = health.child_weight,
                food_type        = health.food_eating_type,
                dateSave         = health.datetime_save,
                dateUpdate       = health.datetime_update,
            }).Join(
                db.tbl_disease_type,
                x => x.disease_id_name,
                y => y.id,
                (tbl1, disease) => new
            {
                id          = tbl1.id,
                ChildName   = tbl1.child_name,
                DrugAlergic = tbl1.drug_algeric,
                Surgery     = tbl1.surgery,
                SurgeryNote = tbl1.surgery_note,
                CorinicCure = tbl1.coronic_cure,
                ClinicType  = tbl1.clinic_type,
                ClinicNote  = tbl1.clinic_type_note,
                Heigth      = tbl1.height,
                Weight      = tbl1.weight,
                FoodType    = tbl1.food_type,
                Disease     = disease.name_disease,
                SavedAt     = tbl1.dateSave,
                LastUpdate  = tbl1.dateUpdate,
            }
                )
                             .Where(
                x => x.ChildName.Contains(txt)
                ).ToList();

            dataGridView1.DataSource = healthData;
        }
        private void HealthData_Load(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();
            var healthData = db.tbl_child_healthy.Join(
                db.tbl_child_info,
                x => x.id_child,
                y => y.id,
                (health, child) => new
            {
                id               = health.id,
                child_name       = child.child_fullname,
                drug_algeric     = health.drug_allergy,
                coronic_cure     = health.darmany_naxoshiya_drezhxayanaka,
                surgery          = health.have_surgery,
                disease_id_name  = health.id_child_disease_type,
                surgery_note     = health.note_of_surgery,
                clinic_type      = health.general_clinic_test_disease_type,
                clinic_type_note = health.general_clinic_test_disease_type_note,
                face_type        = health.face_type,
                height           = health.child_height,
                weight           = health.child_weight,
                food_type        = health.food_eating_type,
                dateSave         = health.datetime_save,
                dateUpdate       = health.datetime_update,
            }).
                             // Join(
                             //db.tbl_disease_type,
                             //x => x.disease_id_name,
                             //y => y.id,
                             //(tbl1, disease) => new
                             //{
                             //    //id = tbl1.id,
                             //    //ChildName = tbl1.child_name,
                             //    //DrugAlergic = tbl1.drug_algeric,
                             //    //Surgery = tbl1.surgery,
                             //    //SurgeryNote = tbl1.surgery_note,
                             //    //CorinicCure = tbl1.coronic_cure,
                             //    //ClinicType = tbl1.clinic_type,
                             //    //ClinicNote = tbl1.clinic_type_note,
                             //    //Heigth = tbl1.height,
                             //    //Weight = tbl1.weight,
                             //    //FoodType = tbl1.food_type,
                             //    //Disease = disease.name_disease,
                             //    //SavedAt = tbl1.dateSave,
                             //    //LastUpdate = tbl1.dateUpdate,

                             //}
                             //).
                             ToList();

            dataGridView1.DataSource = healthData;
        }
Beispiel #19
0
        private void btn_employee_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (gbEmpId > 0)
                {
                    db = new PreSchoolEntities1();
                    int userId = userClass.getUserId();

                    var emplooye = db.tbl_employee.Where(x => x.id == gbEmpId).FirstOrDefault();

                    emplooye.employee_fullname  = txt_employee_employeeFullname.Text;
                    emplooye.employee_gender    = combo_employee_employeeGender.Text;
                    emplooye.employee_job_title = job_title.Text;
                    emplooye.salary             = Math.Round(Convert.ToDecimal(txt_employee_salary.Text));
                    emplooye.employee_phone     = txt_employee_employeePhone.Text;
                    emplooye.datetime_save      = DateTime.Now;
                    emplooye.id_user_update     = userId;

                    db.SaveChanges();
                    view();
                    clear();
                }
                else
                {
                    db = new PreSchoolEntities1();

                    int userId = userClass.getUserId();

                    var newEmployee = new tbl_employee()
                    {
                        employee_fullname  = txt_employee_employeeFullname.Text,
                        employee_gender    = combo_employee_employeeGender.Text,
                        employee_job_title = job_title.Text,
                        salary             = Math.Round(Convert.ToDecimal(txt_employee_salary.Text)),
                        employee_phone     = txt_employee_employeePhone.Text,
                        datetime_save      = DateTime.Now,
                        id_user_save       = userId
                    };

                    db.tbl_employee.Add(newEmployee);

                    db.SaveChanges();
                    view();
                    clear();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Eror");
            }
        }
Beispiel #20
0
        private void Login_Load(object sender, EventArgs e)
        {
            //checkMode();

            db = new PreSchoolEntities1();

            var users = db.tbl_user;

            foreach (var item in users)
            {
                username.Items.Add(item.username);
            }
        }
Beispiel #21
0
        private void teacher_Load(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();

            var rooms = db.tbl_room_name;

            foreach (var item in rooms)
            {
                combo_teacher_room_name.Items.Add(item.room_name);
            }


            view();
        }
        private void Rooms_Load(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();
            var childs = db.tbl_child_info;
            var rooms  = db.tbl_room_name;

            foreach (var item in childs)
            {
                combo_rooms_child_name.Items.Add(item.child_fullname);
            }
            foreach (var item in rooms)
            {
                combo_rooms_roomsName.Items.Add(item.room_name);
            }
            view();
        }
Beispiel #23
0
        void search(string txt)
        {
            db = new PreSchoolEntities1();
            int healthId   = int.Parse(txt);
            var healthData = db.tbl_child_healthy
                             .Where(s => s.id == healthId)
                             .FirstOrDefault();

            decimal childId = healthData.id_child;



            var child = db.tbl_child_info.Where(
                x => x.id == childId
                ).Select(a => a.child_fullname)
                        .FirstOrDefault();



            decimal diseaseId = Convert.ToInt32(healthData.id_child_disease_type);

            var disease = db.tbl_disease_type.Where(
                x => x.id == diseaseId
                ).Select(a => a.name_disease)
                          .FirstOrDefault();



            combo_childHealth_child_name.Text    = child;
            combo_childHealth_child_disease.Text = disease;

            txt_childHealth_drug_allergy.Text           = healthData.drug_allergy;
            disease_type_txt.Text                       = healthData.general_clinic_test_disease_type;
            not_childHealth_general_clinic_test.Text    = healthData.general_clinic_test_disease_type_note;
            not_childHealth_surgery.Text                = healthData.note_of_surgery;
            txt_childHealth_chronic_candition_cure.Text = healthData.darmany_naxoshiya_drezhxayanaka;
            txt_childHealth_face_type.Text              = healthData.face_type;
            txt_childHealth_child_weight.Text           = healthData.child_weight;
            txt_childHealth_child_height.Text           = healthData.child_height;
            txt_childHealth_foot_eating_type.Text       = healthData.food_eating_type;

            if (healthData.have_surgery == true)
            {
                gunaWinSwitch1.Checked = true;
            }
        }
Beispiel #24
0
        private void gunaAdvenceButton2_Click(object sender, EventArgs e)
        {
            using (var context = new PreSchoolEntities1())
            {
                if (userId > 0 && !String.IsNullOrWhiteSpace(txt_user_userFullname.Text) &&
                    !String.IsNullOrWhiteSpace(txt_user_username.Text) &&
                    !String.IsNullOrWhiteSpace(txt_user_username.Text))
                {
                    var user = context.tbl_user.Where(item => item.id == userId).First();

                    user.User_fullname = CapitalizeFirst(txt_user_userFullname.Text);
                    user.User_Role     = combo_role.Text;
                    user.password      = txt_user_password.Text;
                    user.username      = txt_user_username.Text;
                    user.status        = gunaCheckBox1.Checked;

                    context.SaveChanges();
                }
                else if (userId == 0 && !String.IsNullOrWhiteSpace(txt_user_userFullname.Text) &&
                         !String.IsNullOrWhiteSpace(txt_user_username.Text) &&
                         !String.IsNullOrWhiteSpace(txt_user_username.Text))
                {
                    var newUser = new tbl_user()
                    {
                        User_fullname = CapitalizeFirst(txt_user_userFullname.Text),
                        User_Role     = combo_role.Text,
                        password      = txt_user_password.Text,
                        username      = txt_user_username.Text,
                        status        = gunaCheckBox1.Checked,
                    };

                    context.tbl_user.Add(newUser);
                    context.SaveChanges();
                }



                else
                {
                    MessageBox.Show("Plese Enter Valid Fields");
                }
            }

            view();
            clear();
        }
        private void Attedance_Load(object sender, EventArgs e)
        {
            dateTimePicker1.Format       = DateTimePickerFormat.Custom;
            dateTimePicker1.CustomFormat = "HH:mm tt";
            dateTimePicker2.Format       = DateTimePickerFormat.Custom;
            dateTimePicker2.CustomFormat = "HH:mm tt";
            dateTimePicker1.ShowUpDown   = true;
            dateTimePicker2.ShowUpDown   = true;


            db = new PreSchoolEntities1();

            var childs = db.tbl_child_info;

            foreach (var item in childs)
            {
                comboo_child_name.Items.Add(item.child_fullname);
            }

            view();
        }
Beispiel #26
0
        void view()
        {
            db = new PreSchoolEntities1();
            var employees = db.tbl_employee.Join(
                db.tbl_user,
                empolooye => empolooye.id_user_save,
                user => user.id,
                (emp, usr) => new
            {
                id = emp.id,
                EmployeeFullname = emp.employee_fullname,
                EmployeeGender   = emp.employee_gender,
                JobTitle         = emp.employee_job_title,
                Salary           = emp.salary,
                Phone            = emp.employee_phone,
                SavedAt          = emp.datetime_save,
                SavedBy          = usr.User_fullname,
            }
                ).ToList();

            dataGridView1.DataSource = employees;
        }
Beispiel #27
0
        private void btn_teacher_save_Click(object sender, EventArgs e)
        {
            db = new PreSchoolEntities1();

            var roomId = db.tbl_room_name
                         .Where(items => items.room_name == combo_teacher_room_name.Text)
                         .Select(a => a.id)
                         .FirstOrDefault();

            var newActivity = new tbl_subject_activity()
            {
                subject       = txt_subject_subjectName.Text,
                date          = gunaDateTimePicker1.Value,
                note          = not_teacher_subject.Text,
                datetime_save = DateTime.Now,
                id_user_save  = userClass.getUserId(),
                id_room_name  = roomId
            };

            db.tbl_subject_activity.Add(newActivity);
            db.SaveChangesAsync();
            MessageBox.Show("New Activity Added");
        }
Beispiel #28
0
        public void search(int number)
        {
            //Creatig objct from the database
            db = new PreSchoolEntities1();
            var childData = db.tbl_child_info
                            .Where(s => s.id == number)
                            .FirstOrDefault();

            //The Fields

            txt_addkids_child_fullname.Text      = childData.child_fullname;
            txt_addkids_form_number.Text         = childData.form_number.ToString();
            combo_addkids_child_gendar.Text      = childData.child_gender;
            txt_addkids_father_fullname.Text     = childData.father_fullname;
            txt_addkids_mother_fullname.Text     = childData.mother_fullname;
            txt_addkids_father_phone_number.Text = childData.father_phone;
            txt_addkids_mother_phone_number.Text = childData.mother_phone;
            combo_addkids_child_language.Text    = childData.child_language;
            combo_addkids_child_nationality.Text = childData.child_nationality;
            txt_addkids_parent_email.Text        = childData.parent_email;
            txt_addkids_name_of_baby_steer.Text  = childData.name_of_baby_steer;
            txt_addkids_baby_steer_phone.Text    = childData.baby_steer_phone;
            combo_addkids_serial_of_child.Text   = childData.serial_of_child;
            combo_addkids_child__blood_type.Text = childData.child_blood_type;
            txt_addkids_number_of_bro_sis.Text   = childData.number_of_bro_and_sis.ToString();

            //Date And Time

            DateTimePicker_In_come_date.Value     = childData.income_date;
            DateTimePicker_child_birth_date.Value = childData.child_birthday;


            //Address And Place Of Birth

            combo_addkids_child_address.Text        = childData.id_child_address;
            combo_addkids_child_place_of_birth.Text = childData.id_child_place_of_birth;
        }
 private void btn_addkids_save_Click_1(object sender, EventArgs e)
 {
     try
     {
         var confirmation = MessageBox.Show("Are You Sure To Save These Changes ?", "Submit Channges", MessageBoxButtons.YesNo);
         if (confirmation == DialogResult.Yes)
         {
             using (var context = new PreSchoolEntities1())
             {
                 context.SaveChanges();
             }
         }
         else
         {
             db = new PreSchoolEntities1();
             db.tbl_child_info.Load();
             dataGridView1.DataSource = db.tbl_child_info.Local.ToBindingList();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Error");
     }
 }
Beispiel #30
0
        void view()
        {
            db = new PreSchoolEntities1();
            var activityData = db.tbl_subject_activity.Join(
                db.tbl_room_name,
                teacher => teacher.id_room_name,
                roomName => roomName.id,
                (subject, room) => new
            {
                id          = subject.id,
                Subject     = subject.subject,
                RoomName    = room.room_name,
                Savedate    = subject.date,
                userId      = subject.id_user_save,
                teacherNote = subject.note
            }
                )
                               .Join(
                db.tbl_user,
                subject => subject.userId,
                user => user.id,
                (table1, user) => new
            {
                Id       = table1.id,
                Subject  = table1.Subject,
                Date     = table1.Savedate,
                RoomName = table1.RoomName,
                Teacher  = user.User_fullname,
                Note     = table1.teacherNote
            }

                )
                               .ToList();

            dataGridView1.DataSource = activityData;
        }