/// <summary>
        /// Creates a new connection to the service or uses an existing one
        /// </summary>
        /// <returns>A working connection to the service</returns>
        public static TeacherServiceClient GetClient()
        {
            if(clientInstance == null)
            {
                clientInstance = new TeacherServiceClient();
            }

            return clientInstance;
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (teacherSelected != null)
            {
                TeacherServiceClient teacherService = new TeacherServiceClient();
                string message = String.Empty;

                if (!teacherService.DeactivateTeacher(teacherSelected.TeacherId, ref message))
                {
                    message = "Deactivation of User Failed";
                }
                else
                {
                    MessageBox.Show("Deactivated succesfully!");
                }
            }
        }
Ejemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (teacherSelected != null)
            {
                TeacherServiceClient teacherService = new TeacherServiceClient();
                string message = String.Empty;

                if (!teacherService.DeactivateTeacher(teacherSelected.TeacherId, ref message))
                {
                    teacherSelected.Deactivated = true;
                    Log("D", "Teachers", teacherSelected);

                    MessageBox.Show("Deactivation of User Failed");
                }
                else
                {
                    MessageBox.Show("Deactivated succesfully!");
                }
            }
        }
Ejemplo n.º 4
0
        public void LoadTeachers()
        {
            TeacherServiceClient teacherService = new TeacherServiceClient();
            string message = String.Empty;
            try
            {
                var teachers = teacherService.GetAllTeachers();
                teacherList = new List<Teacher>(teachers);
                gvTeacher.DataSource = teachers;
                gvTeacher.Refresh();

                if (gvTeacher.RowCount != 0)
                    gvTeacher.Rows[0].IsSelected = true;
            }
            catch (Exception ex)
            {
                message = "Error Loading Teacher List";
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 5
0
        private void txtTeacherID_Leave(object sender, EventArgs e)
        {
            Teacher teach = new Teacher();
            string  msg   = string.Empty;
            TeacherServiceClient teacherService = new TeacherServiceClient();

            if (txtTeacherID.Text == string.Empty)
            {
                txtTeacherID.Text = szTeacherID;
            }


            teach = teacherService.GetTeacher(txtTeacherID.Text, ref msg);
            if (teach != null)
            {
                MessageBox.Show("Teacher ID already exist!");
                txtTeacherID.Text = szTeacherID;
                txtTeacherID.Focus();
                return;
            }
        }
Ejemplo n.º 6
0
        public void LoadFilteredTeachers()
        {
            TeacherServiceClient teacherService = new TeacherServiceClient();
            string message = String.Empty;

            try
            {
                var teachers = teacherService.GetFilteredTeachers(cmbSearch.Text, txtSearch.Text);
                teacherList          = new List <Teacher>(teachers);
                gvTeacher.DataSource = teachers;
                gvTeacher.Refresh();

                if (gvTeacher.RowCount != 0)
                {
                    gvTeacher.Rows[0].IsSelected = true;
                }
            }
            catch (Exception ex)
            {
                message = "Error Loading Teacher List";
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 7
0
        private void frmTeacherDetails_Load(object sender, EventArgs e)
        {
            pageViewTeacher.SelectedPage = pageViewTeacher.Pages[0];
            List <RegionDic> ResRegion = new List <RegionDic>(regions);
            List <RegionDic> PARegion  = new List <RegionDic>(regions);

            cmbPA_Region.DataSource  = PARegion;
            cmbRes_Region.DataSource = ResRegion;

            if (Op.Equals("edit"))
            {
                SetFields();
                SetGrids();
            }

            if (Op.Equals("new"))
            {
                TeacherServiceClient teacherService = new TeacherServiceClient();
                szTeacherID       = teacherService.GenerateTeacherId();
                txtTeacherID.Text = szTeacherID;
                BindGrids();
            }
        }
Ejemplo n.º 8
0
 public TeacherExamManage()
 {
     client = new TeacherServiceClient();
 }
Ejemplo n.º 9
0
        private void Save()
        {
            string szGender = string.Empty;
            if (cmbGender.Text == "Female") szGender = "F";
            if (cmbGender.Text == "Male") szGender = "M";
            Boolean ret = false;
            string message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);

            TeacherServiceClient teacherService = new TeacherServiceClient();

            Teacher teacher = new Teacher()
            {
                TeacherId = txtTeacherID.Text,
                BloodType = txtBloodType.Text,
                CivilStatus = cmbCivilState.Text,
                DOB = dtBirth.Value,
                DateOfAppointment = dtAppointment.Value,
                EmailAddress = txtEmailAdd.Text,
                EmploymentStatus = txtEmploymentState.Text,
                DialectSpoken = txtDialect.Text,
                FirstName = txtFirstName.Text,
                MiddleName = txtMiddleName.Text,
                LastName = txtLastName.Text,
                Gender = szGender,
                HeightCm = int.Parse(txtHeight.Text),
                WeightKg = double.Parse(txtWeight.Text),
                MobileNo = txtCellphone.Text,
                PAMunicipality = txtPA_Municipality.Text,
                PAProvince = txtPA_Province.Text,
                PARegion = cmbPA_Region.SelectedValue.ToString(),
                PAStreetName = txtPA_StreetName.Text,
                POBMunicipality = txtPOB_Municipality.Text,
                POBProvince = txtPOB_Province.Text,
                PagIBIGNo = txtPagIbig.Text,
                PhilHealthNo = txtPhilHealth.Text,
                PreviousSchool = txtSchoolReassigned.Text,
                RAMunicipality = txtRes_Municipality.Text,
                RAProvince = txtRes_Province.Text,
                RARegion = cmbRes_Region.SelectedValue.ToString(),
                RAStreetName = txtRes_StreetName.Text,
                ResTelephoneNo = txtRes_TelNo.Text,
                SSSNum = txtSSS.Text,
                SpouseBusinessAdd = txtSpouse_BusinessAdd.Text,
                SpouseEmployerName = txtSpouse_Employer.Text,
                SpouseFirstName = txtSpouse_FirstName.Text,
                SpouseLastName = txtSpouse_LastName.Text,
                SpouseMiddleName = txtSpouse_MiddleName.Text,
                SpouseOccupation = txtSpouse_Occupation.Text,
                SpouseTelephoneNo = txtSpouse_Contact.Text,
                TIN = txtTIN.Text,
                Image = bImage,
                PERAA = txtPERAA.Text,
                TeacherChildrens = teachChild.ToArray(),
                TeacherEducationalBackgrounds = educBack.ToArray(),
                TeacherEligibilities = teachElig.ToArray(),
                WorkExperiences = workExp.ToArray(),
                TrainingSeminars=trainSem.ToArray()
                
            };



            if (Op.Equals("edit"))
                ret = teacherService.UpdateTeacher(ref teacher, ref message);
            else
            ret = teacherService.CreateTeacher(ref teacher, ref message);

            if (ret)
                MessageBox.Show("Saved Successfully");
            else
                MessageBox.Show("Error Saving");

            Close();
        }
Ejemplo n.º 10
0
        private void txtTeacherID_Leave(object sender, EventArgs e)
        {
            Teacher teach = new Teacher();
            string msg = string.Empty;
            TeacherServiceClient teacherService = new TeacherServiceClient();

            if (txtTeacherID.Text == string.Empty) txtTeacherID.Text = szTeacherID;

           
            teach = teacherService.GetTeacher(txtTeacherID.Text, ref msg);
            if (teach != null)
            {
                MessageBox.Show("Teacher ID already exist!");
                txtTeacherID.Text = szTeacherID;
                txtTeacherID.Focus();
                return;
            }
        }
Ejemplo n.º 11
0
        private void frmTeacherDetails_Load(object sender, EventArgs e)
        {
            pageViewTeacher.SelectedPage = pageViewTeacher.Pages[0];
            List<RegionDic> ResRegion = new List<RegionDic>(regions);
            List<RegionDic> PARegion = new List<RegionDic>(regions);
            cmbPA_Region.DataSource = PARegion;
            cmbRes_Region.DataSource = ResRegion;

            if (Op.Equals("edit"))
            {
                SetFields();
                SetGrids();
            }

            if (Op.Equals("new"))
            {
                TeacherServiceClient teacherService = new TeacherServiceClient();
                szTeacherID = teacherService.GenerateTeacherId();
                txtTeacherID.Text = szTeacherID;
                BindGrids();
            }
        }
Ejemplo n.º 12
0
        private void Save()
        {
            string szGender = string.Empty;
            string szBloodType = string.Empty;
            bool acad = false;
            if (cmbGender.Text == "Female") szGender = "F";
            if (cmbGender.Text == "Male") szGender = "M";

            if (cmbBloodType.Text == "A") szBloodType = "A";
            if (cmbBloodType.Text == "O") szBloodType = "O";
            if (cmbBloodType.Text == "AB") szBloodType = "AB";
            if (cmbBloodType.Text == "A") szBloodType = "A";
            if (radioAcademic.Checked == true && radioNonAcad.Checked == false) acad = true;
            else if (radioAcademic.Checked == false && radioNonAcad.Checked == true) acad = false;
            else if (radioAcademic.Checked == false && radioNonAcad.Checked == false) acad = false;
            Boolean ret = false;
            string message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null) bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);

            TeacherServiceClient teacherService = new TeacherServiceClient();

            String fName = txtFirstName.Text;
            String mName = txtMiddleName.Text;
            String lName = txtLastName.Text;

            String cName = fName.Trim() + mName.Trim() + lName.Trim();

            var teachers = teacherService.GetAllTeachers();

            teacherCompare = new List<Teacher>(teachers);

            Teacher teacher = new Teacher()
            {
                TeacherId = txtTeacherID.Text,
                BloodType = szBloodType,
                CivilStatus = cmbCivilState.Text,
                DOB = dtBirth.Value,
                DateOfAppointment = dtAppointment.Value,
                EmailAddress = txtEmailAdd.Text,
                EmploymentStatus = txtEmploymentState.Text,
                DialectSpoken = txtDialect.Text,
                FirstName = txtFirstName.Text,
                MiddleName = txtMiddleName.Text,
                LastName = txtLastName.Text,
                Gender = szGender,
                HeightCm = int.Parse(txtHeight.Text),
                WeightKg = double.Parse(txtWeight.Text),
                MobileNo = txtCellphone.Text,
                PAMunicipality = txtPA_Municipality.Text,
                PAProvince = txtPA_Province.Text,
                PARegion = cmbPA_Region.SelectedValue.ToString(),
                PAStreetName = txtPA_StreetName.Text,
                POBMunicipality = txtPOB_Municipality.Text,
                POBProvince = txtPOB_Province.Text,
                PagIBIGNo = txtPagIbig.Text,
                PhilHealthNo = txtPhilHealth.Text,
                PreviousSchool = txtSchoolReassigned.Text,
                RAMunicipality = txtRes_Municipality.Text,
                RAProvince = txtRes_Province.Text,
                RARegion = cmbRes_Region.SelectedValue.ToString(),
                RAStreetName = txtRes_StreetName.Text,
                ResTelephoneNo = txtRes_TelNo.Text,
                SSSNum = txtSSS.Text,
                SpouseBusinessAdd = txtSpouse_BusinessAdd.Text,
                SpouseEmployerName = txtSpouse_Employer.Text,
                SpouseFirstName = txtSpouse_FirstName.Text,
                SpouseLastName = txtSpouse_LastName.Text,
                SpouseMiddleName = txtSpouse_MiddleName.Text,
                SpouseOccupation = txtSpouse_Occupation.Text,
                SpouseTelephoneNo = txtSpouse_Contact.Text,
                TIN = txtTIN.Text,
                Image = bImage,
                PERAA = txtPERAA.Text,
                Academic = acad,

                TeacherChildrens = teachChild.ToArray(),
                TeacherEducationalBackgrounds = educBack.ToArray(),
                TeacherEligibilities = teachElig.ToArray(),
                WorkExperiences = workExp.ToArray(),
                TrainingSeminars=trainSem.ToArray(),

            };

            if (Op.Equals("edit"))
            {
                ret = teacherService.UpdateTeacher(ref teacher, ref message);
                LogServiceClient logService = new LogServiceClient();
                teacher.TeacherChildrens = null;
                teacher.TeacherEducationalBackgrounds = null;
                teacher.TeacherEligibilities = null;
                teacher.TrainingSeminars = null;
                teacher.WorkExperiences = null;

                Log("U", "Teachers", teacher);

                foreach (TeacherChildren tc in teachChild)
                   Log("U", "TeacherChildren", tc);

                foreach (TeacherEducationalBackground teb in educBack)
                   Log("U", "TeacherEducationalBackground", teb);

                foreach (TeacherEligibility te in teachElig)
                    Log("U", "TeacherEligibilities", te);

                foreach (WorkExperience we in workExp)
                    Log("U", "WorkExperiences", we);

                foreach (TrainingSeminar ts in trainSem)
                   Log("U", "TrainingSeminars", ts);

            }

            else
            {
                foreach (Teacher tc in teacherCompare)
                {
                    String compareString = tc.FirstName.Trim() + tc.MiddleName.Trim() + tc.LastName.Trim();
                    if (cName.Equals(compareString))
                    {
                        MessageBox.Show("Teacher already exist!");
                        break;
                    }
                    else
                    {
                        ret = teacherService.CreateTeacher(ref teacher, ref message);
                        Log("C", "Teachers", teacher);

                    }
                }
            }

               // if (ret)
                MessageBox.Show("Saved Successfully");
            //else
            //    MessageBox.Show("Error Saving");

            Close();
        }
 public LoginWindow()
 {
     ClientManager.CloseClient();
     client = ClientManager.GetClient();
     InitializeComponent();
 }
Ejemplo n.º 14
0
        private void Save()
        {
            string szGender = string.Empty;

            if (cmbGender.Text == "Female")
            {
                szGender = "F";
            }
            if (cmbGender.Text == "Male")
            {
                szGender = "M";
            }
            Boolean ret     = false;
            string  message = String.Empty;

            byte[] bImage = null;
            if (pbImage.BackgroundImage != null)
            {
                bImage = imageToByteArray(pbImage.BackgroundImage, ImageFormat.Png);
            }

            TeacherServiceClient teacherService = new TeacherServiceClient();

            Teacher teacher = new Teacher()
            {
                TeacherId                     = txtTeacherID.Text,
                BloodType                     = txtBloodType.Text,
                CivilStatus                   = cmbCivilState.Text,
                DOB                           = dtBirth.Value,
                DateOfAppointment             = dtAppointment.Value,
                EmailAddress                  = txtEmailAdd.Text,
                EmploymentStatus              = txtEmploymentState.Text,
                DialectSpoken                 = txtDialect.Text,
                FirstName                     = txtFirstName.Text,
                MiddleName                    = txtMiddleName.Text,
                LastName                      = txtLastName.Text,
                Gender                        = szGender,
                HeightCm                      = int.Parse(txtHeight.Text),
                WeightKg                      = double.Parse(txtWeight.Text),
                MobileNo                      = txtCellphone.Text,
                PAMunicipality                = txtPA_Municipality.Text,
                PAProvince                    = txtPA_Province.Text,
                PARegion                      = cmbPA_Region.SelectedValue.ToString(),
                PAStreetName                  = txtPA_StreetName.Text,
                POBMunicipality               = txtPOB_Municipality.Text,
                POBProvince                   = txtPOB_Province.Text,
                PagIBIGNo                     = txtPagIbig.Text,
                PhilHealthNo                  = txtPhilHealth.Text,
                PreviousSchool                = txtSchoolReassigned.Text,
                RAMunicipality                = txtRes_Municipality.Text,
                RAProvince                    = txtRes_Province.Text,
                RARegion                      = cmbRes_Region.SelectedValue.ToString(),
                RAStreetName                  = txtRes_StreetName.Text,
                ResTelephoneNo                = txtRes_TelNo.Text,
                SSSNum                        = txtSSS.Text,
                SpouseBusinessAdd             = txtSpouse_BusinessAdd.Text,
                SpouseEmployerName            = txtSpouse_Employer.Text,
                SpouseFirstName               = txtSpouse_FirstName.Text,
                SpouseLastName                = txtSpouse_LastName.Text,
                SpouseMiddleName              = txtSpouse_MiddleName.Text,
                SpouseOccupation              = txtSpouse_Occupation.Text,
                SpouseTelephoneNo             = txtSpouse_Contact.Text,
                TIN                           = txtTIN.Text,
                Image                         = bImage,
                PERAA                         = txtPERAA.Text,
                TeacherChildrens              = teachChild.ToArray(),
                TeacherEducationalBackgrounds = educBack.ToArray(),
                TeacherEligibilities          = teachElig.ToArray(),
                WorkExperiences               = workExp.ToArray(),
                TrainingSeminars              = trainSem.ToArray()
            };



            if (Op.Equals("edit"))
            {
                ret = teacherService.UpdateTeacher(ref teacher, ref message);
            }
            else
            {
                ret = teacherService.CreateTeacher(ref teacher, ref message);
            }

            if (ret)
            {
                MessageBox.Show("Saved Successfully");
            }
            else
            {
                MessageBox.Show("Error Saving");
            }

            Close();
        }