Пример #1
0
        private void ValidateLogin()
        {
            Debug.WriteLine(DatabaseHelper.CalculateMD5Hash(txt_Password.Text));

            bool            loggedIn = false;
            ValidityChecker checker  = new ValidityChecker(txt_Password, txt_Username);
            var             list     = checker.InvalidFields();

            if (list.Count == 0)
            {
                DataTable employeeTable = DatabaseHelper.GetTable("Employees");
                foreach (DataRow item in employeeTable.Rows)
                {
                    if (item != null && item["PC Username"].ToString() == txt_Username.Text)
                    {
                        string MD5hash = DatabaseHelper.CalculateMD5Hash(txt_Password.Text);
                        Debug.WriteLine(MD5hash);
                        if (MD5hash == item["PC Password MD5"].ToString())
                        {
                            Employee_ID         = int.Parse(item["Person ID"].ToString());
                            LoggedInEmployee.ID = Employee_ID;
                            loggedIn            = true;
                            Proceed();
                        }
                    }
                }
                if (!loggedIn)
                {
                    Fail();
                }
            }
        }
Пример #2
0
        private void btn_Place_Order_Click(object sender, EventArgs e)
        {
            DateTimePicker tempval = new DateTimePicker()
            {
                Value = dtp_Order_Date.Value
            };
            int hours = 0;

            switch (cmb_Time.SelectedIndex)
            {
            case 0:
                hours = 16;
                break;

            case 1:
                hours = 16;
                break;

            case 2:
                hours = 2;
                break;
            }
            tempval.Value = tempval.Value.Date.AddHours(hours);
            ValidityChecker validityChecker = new ValidityChecker(tempval, cmb_Dealer);

            if (validityChecker.InvalidFields().Count == 0)
            {
                PlaceOrder();
            }
        }
Пример #3
0
        private void btn_addDealer_Click(object sender, EventArgs e)
        {
            ValidityChecker checker = new ValidityChecker(txt_First_Name, txt_Last_Name, txt_Location, txt_Company);

            if (checker.InvalidFields().Count == 0)
            {
                AddDealer();
            }
        }
Пример #4
0
        private void btn_addEmployee_Click(object sender, EventArgs e)
        {
            ValidityChecker checker = new ValidityChecker(txt_First_Name, txt_Last_Name, txt_Password, txt_Tax_File_Number, txt_User_Name, txt_Location);

            if (checker.InvalidFields().Count == 0)
            {
                AddEmployee();
            }
        }
Пример #5
0
        private void btn_addFactory_Click(object sender, EventArgs e)
        {
            ValidityChecker checker = new ValidityChecker(cmb_Office, txt_Registration, txt_Factory_Name);

            if (checker.InvalidFields().Count == 0)
            {
                AddFactory();
            }
            Close();
        }
Пример #6
0
        private void btn_addProduct_Click(object sender, EventArgs e)
        {
            ValidityChecker checker           = new ValidityChecker(txt_Postcode, txt_City, txt_Address);
            List <string>   invalidFieldNames = checker.InvalidFields();

            if (invalidFieldNames.Count == 0)
            {
                SetLocation();
            }
        }
Пример #7
0
        private void btn_addProduct_Click(object sender, EventArgs e)
        {
            ValidityChecker checker           = new ValidityChecker(txt_Landline, txt_Name, txt_Location);
            List <string>   invalidFieldNames = checker.InvalidFields();

            if (invalidFieldNames.Count == 0)
            {
                AddOffice();
            }
        }
Пример #8
0
        private void btn_addProduct_Click(object sender, EventArgs e)
        {
            ValidityChecker checker           = new ValidityChecker(txt_Registration_Letters, txt_Registration_Numbers);
            List <string>   invalidFieldNames = checker.InvalidFields();

            if (invalidFieldNames.Count == 0)
            {
                AddTruck();
            }
        }