示例#1
14
        private void btnDelete_Click_1(object sender, EventArgs e)
        {
            string message = String.Empty;
            StudentServiceClient studentService = new StudentServiceClient();
            if (studentService.DismissStudent(studentSelected.StudentId, ref message)) {
                LogServiceClient logService = new LogServiceClient();
                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");
        }
示例#2
0
        private void butLogin_Click(object sender, EventArgs e)
        {
            UserServiceClient userService = new UserServiceClient();
            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))
                {
                    //try
                    //{
                        eSAR.UserServiceRef.User u = new eSAR.UserServiceRef.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;

                    LogServiceClient logService = new LogServiceClient();
                    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();
                    //}
                    //catch (Exception ex)
                    //{
                    //    Console.WriteLine("Login Failed");
                    //}
                }
                else MessageBox.Show(this, message, "Login Failed");
                //frmLogIn FrmLogin = new frmLogIn();
                //FrmLogin.Show();
            }
            //this.Show();
            //frmLogIn FrmLogin = new frmLogIn();
            //FrmLogin.Show();
        }
示例#3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            LogServiceClient logService = new LogServiceClient();
            if (ExistingSchedRemove.Count > 0)
            {
                if (registrationService.DeleteLoadedSubjects(controlStudentId, SY, ExistingSchedRemove.ToArray()))
                {

                    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.ToArray()))
                {
                    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();
                }
            }
        }
示例#4
0
 private void Log(string clud, string table, Object obj)
 {
     LogServiceClient logService = new LogServiceClient();
     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);
 }
示例#5
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            calculate.Visible = false;
            RegistrationServiceClient registrationService = new RegistrationServiceClient();
            LogServiceClient logService = new LogServiceClient();
            var assessments = registrationService.AssessMe(StudentAssessed);
            if (assessments.Length> 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();
                calculate.Visible = true;
            }
        }