예제 #1
0
        // constructor
        public AddEditEmployee(PL_GUI _parentWindow, IBL itsDepartmentBL, IBL itsEmployeeBL, bool _isAdd, Object _oldObj)
        {
            InitializeComponent();
            parentWindow = _parentWindow;

            // Create departments list for choosing depID
            depID.ItemsSource = itsDepartmentBL.GetAll();

            // Create Employees list for choosing supID
            List <Object> allEmployees = itsEmployeeBL.GetAll();
            Employee      def          = new Employee();

            def.Id = 0;
            allEmployees.Add(def); // gives an option to be an administrator

            isAdd = _isAdd;
            if (!isAdd)
            {
                loginDetails.Visibility = Visibility.Collapsed;
                AddEditTitle.Text       = "Edit Employee";
                AddEditButton.Content   = "Edit Employee";
                oldObj = _oldObj;
                allEmployees.Remove(((Employee)oldObj)); // prevents an option of employee being his own supervisor
                supID.ItemsSource = allEmployees;
                ResetToDefault();
            }
            else
            {
                supID.ItemsSource = allEmployees;
            }
        }
예제 #2
0
 // constructors
 public Login(IBL _userBL, PL_GUI _parentWindow)
 {
     InitializeComponent();
     parentWindow  = _parentWindow;
     userBL        = (User_BL)_userBL;
     isEndProccess = true;
 }
예제 #3
0
        // constructor
        public AddEditCustomer(Login _login, PL_GUI _parentWindow, bool _isRegister, bool _isAdd, Object _oldObj)
        {
            InitializeComponent();
            login        = _login;
            parentWindow = _parentWindow;
            isRegister   = _isRegister;
            if (_isRegister)
            {
                title = "Register to E-MART";
            }
            else
            {
                title = "Add Customer";
            }
            customerForm.DataContext = title;

            isAdd = _isAdd;
            if (!isAdd)
            {
                loginDetails.Visibility = Visibility.Collapsed;
                AddEditTitle.Text       = "Edit Customer";
                AddEditButton.Content   = "Edit Customer";
                oldObj = _oldObj;
                ResetToDefault();
            }
            if (isRegister)
            {
                backButton.Visibility = Visibility.Visible;
            }
        }
예제 #4
0
        private bool IsValid()
        {
            bool flag = true;

            if (isAdd)
            {
                flag = PL_GUI.RegExp(username.Text, "User name", 3);
            }
            if (flag && isAdd)
            {
                flag = PL_GUI.RegExp(password.Password, "Password", 3);
            }
            if (flag)
            {
                flag = PL_GUI.RegExp(firstName.Text, "First name", 1);
            }
            if (flag)
            {
                flag = PL_GUI.RegExp(lastName.Text, "Last name", 1);
            }
            if (flag)
            {
                flag = PL_GUI.RegExp(ID.Text, "ID", 0);
            }
            return(flag);
        }
예제 #5
0
 private void SearchByRank(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.ComboboxValidate(rank, "Rank"))
     {
         Rank rnk;
         if (rank.Text.Equals("Administrator"))
         {
             rnk = Rank.Administrator;
         }
         else if (rank.Text.Equals("Manager"))
         {
             rnk = Rank.Manager;
         }
         else if (rank.Text.Equals("Worker"))
         {
             rnk = Rank.Worker;
         }
         else
         {
             rnk = Rank.Customer;
         }
         if (parentWindow.SearchDataEntity(TypeFields.rank, rnk, null, 4))
         {
             this.Close();
         }
     }
 }
 // constructor
 public AddEditTransaction(PL_GUI _parentWindow, Object _oldObj)
 {
     InitializeComponent();
     parentWindow = _parentWindow;
     oldObj       = _oldObj;
     ResetToDefault();
 }
예제 #7
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                depName, specificDepID, rangeDepID, fromDepID, toDepID
            };

            PL_GUI.ClearForm(lst);
        }
예제 #8
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                newPass
            };

            PL_GUI.ClearForm(lst);
        }
예제 #9
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                purchaseType, returnType, fromCurrentDate, toCurrentDate, specificCurrentDate, rangeCurrentDate, specificTranID, rangeTranID, fromTranID, toTranID, payment, specificPrdID, rangePrdID, fromPrdID, toPrdID
            };

            PL_GUI.ClearForm(lst);
        }
예제 #10
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                name, pType, specificDepID, rangeDepID, fromDepID, toDepID, specificPrice, rangePrice, fromPrice, toPrice, specificPrdID, rangePrdID, fromPrdID, toPrdID, pStatus, specificStockCount, rangeStockCount, fromStockCount, toStockCount
            };

            PL_GUI.ClearForm(lst);
        }
예제 #11
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                firstName, lastName, ID, specificDepID, rangeDepID, fromDepID, toDepID, specificSalary, rangeSalary, fromSalary, toSalary, specificSupID, rangeSupID, fromSupID, toSupID, male, female, rank
            };

            PL_GUI.ClearForm(lst);
        }
예제 #12
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                username, password
            };

            PL_GUI.ClearForm(lst);
        }
예제 #13
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                firstName, lastName, ID, specificMemberID, rangeMemberID, fromMemberID, toMemberID, specificTranID, rangeTranID, fromTranID, toTranID, male, female, fromDateOfBirth, toDateOfBirth, specificDateOfBirth, rangeDateOfBirth
            };

            PL_GUI.ClearForm(lst);
        }
예제 #14
0
        private void ClearForm(object sender, RoutedEventArgs e)
        {
            List <Control> lst = new List <Control>()
            {
                firstName, lastName, ID, specificTranID, rangeTranID, fromTranID, toTranID
            };

            PL_GUI.ClearForm(lst);
        }
예제 #15
0
        // constructor
        public View(PL_GUI _parentWindow, Object _oldObj, int _currentCategory, bool _isProfileWatch)
        {
            InitializeComponent();
            parentWindow         = _parentWindow;
            oldObj               = _oldObj;
            viewMode.DataContext = oldObj;
            currentCategory      = _currentCategory;
            isProfileWatch       = _isProfileWatch;
            allViews             = new Grid[8] {
                null, clubMemberView, customerView, departmentView, employeeView, productView, transactionView, userView
            };
            allViews[currentCategory].Visibility = Visibility.Visible;

            if (currentCategory == 1)
            {
                tranHistoryClubMember.DataContext = ((ClubMember)oldObj).TranHistory;
            }
            else if (currentCategory == 2)
            {
                tranHistoryCustomer.DataContext = ((Customer)oldObj).TranHistory;
            }
            else if (currentCategory == 6)
            {
                receipt.DataContext = ((Transaction)oldObj).Receipt;
            }

            ///////////////////////////////////////////////////////////
            //////////////////////  permissions  //////////////////////
            ///////////////////////////////////////////////////////////

            // self profile mode
            if (isProfileWatch)
            {
                // update headlines
                customerHeader.Text   = "Customer - View your profile";
                clubMemberHeader.Text = "Club Member - View your profile";
                employeeHeader.Text   = "Employee - View your profile";

                // only administrator which can edit his own profile
                if (parentWindow.rank != 0)
                {
                    editButton.Visibility = Visibility.Collapsed;
                }
                // nobody can remove himself
                removeButton.Visibility = Visibility.Collapsed;
            }

            // watch record mode
            else
            // forbid edit/remove if there is no permission
            if (PL_GUI.allPermissions[parentWindow.rank][currentCategory] != 2)
            {
                editButton.Visibility   = Visibility.Collapsed;
                removeButton.Visibility = Visibility.Collapsed;
            }
            ///////////////////////////////////////////////////////////
        }
예제 #16
0
 private void SearchByDepName(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RegExp(depName.Text, "Department name", 1))
     {
         if (parentWindow.SearchDataEntity(StringFields.name, depName.Text, null, 3))
         {
             this.Close();
         }
     }
 }
예제 #17
0
        private bool IsValid()
        {
            bool flag = PL_GUI.ComboboxValidate(payment, "Payment method");

            if (flag)
            {
                flag = PL_GUI.DoubleRadioValidate(purchaseType, returnType, "Transaction type");
            }
            return(flag);
        }
예제 #18
0
        private bool IsValid()
        {
            bool flag = PL_GUI.RegExp(username.Text, "User name", 3);

            if (flag)
            {
                flag = PL_GUI.RegExp(password.Password, "Password", 3);
            }
            return(flag);
        }
예제 #19
0
 private void SearchByUserame(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RegExp(username.Text, "User name", 1))
     {
         if (parentWindow.SearchDataEntity(StringFields.username, username.Text, null, 7))
         {
             this.Close();
         }
     }
 }
예제 #20
0
 private void SearchByID(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RegExp(ID.Text, "ID", 0))
     {
         if (parentWindow.SearchDataEntity(IntFields.id, int.Parse(ID.Text), int.Parse(ID.Text), 2))
         {
             this.Close();
         }
     }
 }
예제 #21
0
 private void SearchByName(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RegExp(name.Text, "Product name", 1))
     {
         if (parentWindow.SearchDataEntity(StringFields.name, name.Text, null, 5))
         {
             this.Close();
         }
     }
 }
예제 #22
0
 private void SearchByLastName(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RegExp(lastName.Text, "Last name", 1))
     {
         if (parentWindow.SearchDataEntity(StringFields.lastName, lastName.Text, null, 2))
         {
             this.Close();
         }
     }
 }
예제 #23
0
        // constructor
        public PurchaseWindow(PL_GUI _parentWindow, Object _buyer)
        {
            InitializeComponent();
            parentWindow = _parentWindow;
            buyer        = _buyer;
            canDrag      = true;
            currentCart  = new Dictionary <int, int>();

            // initializing the dictionary with value 3="none" for each combobox
            currentTypes = new Dictionary <ComboBox, int>(3);
            currentTypes.Add(pType1, 3);
            currentTypes.Add(pType2, 3);
            currentTypes.Add(pType3, 3);

            // check if are there any products
            areThereAnyProducts = parentWindow.cats[5].GetAll().Any();
            if (!areThereAnyProducts)
            {
                ProductGrid.Visibility  = Visibility.Collapsed;
                purchaseGrid.Visibility = Visibility.Collapsed;
                previewBox.Visibility   = Visibility.Collapsed;
                emptyStore.Visibility   = Visibility.Visible;
            }

            // bind the datagrid to currentList
            currentList             = new ObservableCollection <Buyable>();
            ProductGrid.DataContext = currentList;

            // bind the datagrid to shopping cart
            purchasesList            = new ObservableCollection <Purchase>();
            purchaseGrid.DataContext = purchasesList;

            if (buyer != null)
            {
                if (buyer is Customer)
                {
                    myName.Text = "Name: " + ((Customer)buyer).FirstName + " " + ((Customer)buyer).LastName;
                    if (((Customer)buyer).CreditCard != null)
                    {
                        cardNumber.Text      = ((Customer)buyer).CreditCard.CreditNumber.ToString();
                        expDate.SelectedDate = ((Customer)buyer).CreditCard.ExpirationDate;
                    }
                }
                else
                {
                    myName.Text           = "Name: " + ((Employee)buyer).FirstName + " " + ((Employee)buyer).LastName;
                    toSaveVisa.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                toSaveVisa.Visibility = Visibility.Collapsed;
            }
        }
예제 #24
0
 private void SearchByStockCount(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RangeSearchRegExp(fromStockCount.Text, toStockCount.Text, "Stock count", rangeStockCount, 2))
     {
         int    min = int.Parse(fromStockCount.Text);
         String max = toStockCount.Text;
         if (parentWindow.SearchDataEntity(IntFields.stockCount, min, (max.Equals(String.Empty)) ? (min) : (int.Parse(max)), 5))
         {
             this.Close();
         }
     }
 }
예제 #25
0
 private void SearchByTranID(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RangeSearchRegExp(fromTranID.Text, toTranID.Text, "Transaction ID", rangeTranID, 2))
     {
         int    min = int.Parse(fromTranID.Text);
         String max = toTranID.Text;
         if (parentWindow.SearchDataEntity(IntFields.tranHistory, min, (max.Equals(String.Empty)) ? (min) : (int.Parse(max)), 2))
         {
             this.Close();
         }
     }
 }
예제 #26
0
 private void SearchByDateOfBirth(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RangeSearchRegExp(fromDateOfBirth.Text, toDateOfBirth.Text, "Date of birth", rangeDateOfBirth, 4))
     {
         int    min = int.Parse(((DateTime)fromDateOfBirth.SelectedDate).ToString("yyyyMMdd"));
         String max = toDateOfBirth.Text;
         if (parentWindow.SearchDataEntity(IntFields.dateOfBirth, min, (max.Equals(String.Empty)) ? (min) : int.Parse(((DateTime)toDateOfBirth.SelectedDate).ToString("yyyyMMdd")), 1))
         {
             this.Close();
         }
     }
 }
예제 #27
0
 private void SearchBySupID(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RangeSearchRegExp(fromSupID.Text, toSupID.Text, "Supervisor ID", rangeSupID, 2))
     {
         int    min = int.Parse(fromSupID.Text);
         String max = toSupID.Text;
         if (parentWindow.SearchDataEntity(IntFields.supervisiorID, min, (max.Equals(String.Empty)) ? (min) : (int.Parse(max)), 4))
         {
             this.Close();
         }
     }
 }
예제 #28
0
 private void SearchByProductID(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RangeSearchRegExp(fromPrdID.Text, toPrdID.Text, "Product ID", rangePrdID, 2))
     {
         int    min = int.Parse(fromPrdID.Text);
         String max = toPrdID.Text;
         if (parentWindow.SearchDataEntity(IntFields.productID, min, (max.Equals(String.Empty)) ? (min) : (int.Parse(max)), 5))
         {
             this.Close();
         }
     }
 }
예제 #29
0
 private void SearchByDate(object sender, RoutedEventArgs e)
 {
     if (PL_GUI.RangeSearchRegExp(fromCurrentDate.Text, toCurrentDate.Text, "Date of transaction", rangeCurrentDate, 4))
     {
         int    min = int.Parse(((DateTime)fromCurrentDate.SelectedDate).ToString("yyyyMMdd"));
         String max = toCurrentDate.Text;
         if (parentWindow.SearchDataEntity(IntFields.currentDate, min, (max.Equals(String.Empty)) ? (min) : int.Parse(((DateTime)toCurrentDate.SelectedDate).ToString("yyyyMMdd")), 1))
         {
             this.Close();
         }
     }
 }
예제 #30
0
        public static bool RangeSearchRegExp(String txtMin, String txtMax, String field, RadioButton isRangeSearch, int check)
        {
            bool flag = PL_GUI.RegExp(txtMin, field, check);

            if (flag)
            {
                if (isRangeSearch.IsChecked == true)
                {
                    flag = PL_GUI.RegExp(txtMax, "MAX " + field, check);
                }
            }
            return(flag);
        }