Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            IRegistrationService registrationService = new RegistrationService();
            ILogService          logService          = new LogService();

            if (ExistingSchedRemove.Count > 0)
            {
                if (registrationService.DeleteLoadedSubjects(controlStudentId, SY, ExistingSchedRemove))
                {
                    foreach (StudentSubject ss in ExistingSchedRemove)
                    {
                        string json = JsonConvert.SerializeObject(ss);
                        Log    log  = new Log
                        {
                            CLUD       = "D",
                            LogDate    = DateTime.Now,
                            TableName  = "StudentSubject",
                            UserId     = GlobalClass.user.UserId,
                            UserName   = GlobalClass.user.UserName,
                            PassedData = json
                        };
                        logService.AddLogs(log);
                    }
                    MessageBox.Show(this, "Adding Student Subjects Successful .");
                    Close();
                }
                else
                {
                    MessageBox.Show(this, "Student Subjects Adding Failed.");
                    Close();
                }
            }
            if (subjects.Count > 0)
            {
                if (registrationService.ControlSubjects(controlStudentId, SY, subjects))
                {
                    foreach (StudentSubject ss in subjects)
                    {
                        string json = JsonConvert.SerializeObject(ss);
                        Log    log  = new Log
                        {
                            CLUD       = "C",
                            LogDate    = DateTime.Now,
                            TableName  = "StudentSubject",
                            UserId     = GlobalClass.user.UserId,
                            UserName   = GlobalClass.user.UserName,
                            PassedData = json
                        };
                        logService.AddLogs(log);
                    }
                    MessageBox.Show(this, "Adding Student Subjects Successful .");
                    Close();
                }
                else
                {
                    MessageBox.Show(this, "Student Subjects Adding Failed.");
                    Close();
                }
            }
        }
Exemplo n.º 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            calculate.Visible = false;
            IRegistrationService registrationService = new RegistrationService();
            ILogService          logService          = new LogService();
            var assessments = registrationService.AssessMe(StudentAssessed);

            if (assessments.Count > 0)
            {
                string json = JsonConvert.SerializeObject(StudentAssessed);
                Log    log  = new Log
                {
                    CLUD       = "C",
                    LogDate    = DateTime.Now,
                    TableName  = "StudentAssessment",
                    UserId     = GlobalClass.user.UserId,
                    UserName   = GlobalClass.user.UserName,
                    PassedData = json
                };
                logService.AddLogs(log);

                PrintPane();
                if (listStudentAssessed.Count <= 0)
                {
                    registrationService.UpdateStudentBalance(StudentAssessed.StudentSY, StudentAssessed.StudentId, float.Parse(Total.Text));
                }
                calculate.Visible = true;
                labelVisibility(false);
                TuitionDet.Visible = true;
            }
        }
Exemplo n.º 3
0
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            if (gvStudent.CurrentRow == null)
            {
                return;
            }

            string          message        = String.Empty;
            IStudentService studentService = new StudentService();

            if (studentService.DismissStudent(studentSelected.StudentId, ref message))
            {
                ILogService logService = new LogService();
                studentSelected.Dismissed = true;
                string json = JsonConvert.SerializeObject(studentSelected);
                Log    log  = new Log
                {
                    CLUD       = "D",
                    LogDate    = DateTime.Now,
                    TableName  = "Students",
                    UserId     = GlobalClass.user.UserId,
                    UserName   = GlobalClass.user.UserName,
                    PassedData = json
                };
                logService.AddLogs(log);
            }

            MessageBox.Show(this, "Student Dismissed");
        }
Exemplo n.º 4
0
        private void butLogin_Click(object sender, EventArgs e)
        {
            try {
                IUserService userService = new UserService();
                string       message     = String.Empty;
                if (txtPassword.Text.Equals("Enter Password") || txtPassword.Text.Equals(String.Empty) || txtUsername.Text.Equals("Enter Username") || txtUsername.Text.Equals(String.Empty))
                {
                    MessageBox.Show(this, "Username and Password is Required", "Required Fields");
                }
                else
                {
                    if (userService.AuthenticateUser(txtUsername.Text, txtPassword.Text, ref message))
                    {
                        User u = new User();
                        u = userService.GetUser(txtUsername.Text);
                        LoggedUser lu = new LoggedUser();

                        lu.UserId     = u.UserId;
                        lu.UserName   = u.UserName;
                        lu.LastName   = u.LastName;
                        lu.FirstName  = u.FirstName;
                        lu.MiddleName = u.MiddleName;
                        lu.UserType   = u.UserTypeCode;

                        GlobalClass.UserLoggedIn = true;
                        GlobalClass.user         = lu;
                        GlobalClass.currentsy    = userService.GetCurrentSy();
                        GlobalClass.userTypeCode = lu.UserType;

                        ILogService logService = new LogService();
                        string      json       = JsonConvert.SerializeObject(lu);
                        Log         log        = new Log
                        {
                            CLUD       = "L",
                            LogDate    = DateTime.Now,
                            TableName  = "Users",
                            UserId     = GlobalClass.user.UserId,
                            UserName   = GlobalClass.user.UserName,
                            PassedData = json
                        };
                        logService.AddLogs(log);
                        Close();
                    }
                    else
                    {
                        MessageBox.Show(this, message, "Login Failed");
                    }
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Unable to Establish the network connection. Please check if network is connected.", "LogIn Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Exemplo n.º 5
0
        private void Log(string clud, string table, Object obj)
        {
            ILogService logService = new LogService();
            string      json       = JsonConvert.SerializeObject(obj);
            Log         log        = new Log
            {
                CLUD       = clud,
                LogDate    = DateTime.Now,
                TableName  = table,
                UserId     = GlobalClass.user.UserId,
                UserName   = GlobalClass.user.UserName,
                PassedData = json
            };

            logService.AddLogs(log);
        }