Exemple #1
0
 public void RefreshData(User user, CARSPage page)
 {
     mUser       = user;
     currentPage = page;
     ClientInstance.ShowSpinner("Get Managers");
     ClientInstance.Get().GetManagersAsync();
 }
Exemple #2
0
 private void ClickLogin(object sender, RoutedEventArgs e)
 {
     noteLabel.Visibility = System.Windows.Visibility.Collapsed;
     if (userNameTxtBox.Text == "")
     {
         ShowMessage("Please input your name.", MessageType.Error);
     }
     else if (passwordTxtBox.Password == "")
     {
         ShowMessage("Please input your password.", MessageType.Error);
     }
     else
     {
         string email = userNameTxtBox.Text.ToLower().Trim() + emailSuffix.Content.ToString();
         ClientInstance.ShowSpinner();
         if (CarsConfig.Instance().DoSavePW)
         {
             LoginInfo loginInfo = new LoginInfo();
             loginInfo.UserName = email;
             loginInfo.Password = passwordTxtBox.Password;
             CarsConfig.Instance().SaveLoginInfo(loginInfo);
         }
         ClientInstance.Get().LoginAsync(email, CryptographyStuff.AES_EncryptString(passwordTxtBox.Password));
     }
 }
Exemple #3
0
 public void GetData()
 {
     loadingRow         = 0;
     currentSelectIndex = records.SelectedIndex;
     ClientInstance.ShowSpinner("Loading Employees");
     ClientInstance.Get().GetAllEmployeesAsync();
 }
Exemple #4
0
 public void RefreshData(bool showAllRecords)
 {
     if (records.SelectedItem != null)
     {
         currentGUID = ((LeaveItem)records.SelectedItem).LeaveInfo.PKLeaveInfoID;
     }
     if (mPage == CARSPage.ApplyLeave || mPage == CARSPage.PersonalInfo)
     {
         ClientInstance.ShowSpinner("Loading Leaves");
         ClientInstance.Get().GetMyLeavesAsync(mUserRunAs.Employee.PKEmployeeID.ToString());
     }
     else if (mPage == CARSPage.ApproveLeave)
     {
         ClientInstance.ShowSpinner("Loading Leaves");
         ClientInstance.Get().GetMyTeamLeavesAsync(mUserRunAs.Employee.PKEmployeeID.ToString(), showAllRecords);
     }
     else if (mPage == CARSPage.LeaveHistory)
     {
         records.ItemsSource = null;
     }
 }
Exemple #5
0
        void sc_ClickSearchButton(object sender, EventArgs e)
        {
            string typeID = string.Empty;

            if (sc.leaveType.SelectedIndex != 0)
            {
                typeID = ((LeaveTypeValue)sc.leaveType.SelectedItem).TypeValue.PKLeaveTypeID.ToString();
            }

            string status = ((ComboBoxItem)sc.leaveStatus.SelectedItem).Content.ToString();

            DateTime start = sc.start.SelectedDate.HasValue ? sc.start.SelectedDate.Value : DateTime.MinValue;
            DateTime end   = sc.end.SelectedDate.HasValue ? sc.end.SelectedDate.Value : DateTime.MaxValue;

            if (end != DateTime.MaxValue)
            {
                end = end.AddDays(1);
            }
            ClientInstance.ShowSpinner("Finding");
            string supervisor = ((User)sc.supervisor.SelectedItem).UserName == "" ? "" : ((User)sc.supervisor.SelectedItem).PKEmployeeID.ToString();
            string applicant  = ((User)sc.applicant.SelectedItem).UserName == "" ? "" : ((User)sc.applicant.SelectedItem).PKEmployeeID.ToString();

            ClientInstance.Get().FindLeavesAsync(supervisor, applicant, typeID, status, start, end, sc.SupervisorsID);
        }
Exemple #6
0
        private void createButton_Click(object sender, MouseButtonEventArgs e)
        {
            // email
            if (baseInfo.userName.Text == "")
            {
                ShowError("Need input your email.");
                return;
            }

            // email's validation 1
            if (!baseInfo.IsEmailValid)
            {
                ShowError("Email is not valid. Email address only allows English, numbers or underscore.");
                return;
            }

            // email's validation 2
            if (baseInfo.userName.Text.ToLower().Contains("@"))
            {
                ShowError("You don't need to input \"@Advent.com\", CARS will add email suffix on it.");
                return;
            }

            // first name
            if (baseInfo.firstName.Text == "")
            {
                ShowError("Need your first name.");
                return;
            }

            // last name
            if (baseInfo.lastName.Text == "")
            {
                ShowError("Need your last name.");
                return;
            }

            // gender
            if (baseInfo.gender.SelectedIndex == -1)
            {
                ShowError("Select your Gender.");
                return;
            }

            // service years
            float serviceYears = 0f;

            if (baseInfo.serviceYears.Text == "" || !float.TryParse(baseInfo.serviceYears.Text, out serviceYears) || !baseInfo.IsServiceYearValid)
            {
                ShowError("Need input your service years. Like: 3 or 3.5");
                return;
            }
            else if (serviceYears < 0)
            {
                ShowError("Service years must be greater than 0.");
                return;
            }
            else if (serviceYears > 60f)
            {
                ShowError("Impossible, you are already retired? Service year is too big.");
                return;
            }

            // date of hire
            if (baseInfo.dateOfHire.SelectedDate == null || !baseInfo.dateOfHire.SelectedDate.HasValue)
            {
                ShowError("Select your date of hire.");
                return;
            }

            // supervisor
            if (baseInfo.supervisor.SelectedIndex == -1)
            {
                ShowError("Who will approval your leave application? Select \"Supervisor\"");
                return;
            }

            User manager = (User)baseInfo.supervisor.SelectedItem;

            ClientInstance.ShowSpinner();
            noteLabel.Visibility = System.Windows.Visibility.Collapsed;
            ClientInstance.Get().AddEmployeeAsync(baseInfo.userName.Text.ToLower().Trim() + baseInfo.emailSuffix.Content.ToString(),
                                                  baseInfo.firstName.Text.Trim(),
                                                  baseInfo.middleName.Text.Trim(),
                                                  baseInfo.lastName.Text.Trim(),
                                                  baseInfo.legalName.Text.Trim(),
                                                  baseInfo.gender.SelectedIndex == 0 ? Sex.Female : Sex.Male,
                                                  serviceYears,
                                                  baseInfo.dateOfHire.SelectedDate.Value, manager.Email, "5030"
                                                  , 0);
        }