/// <summary>
 /// Constructor Method
 /// </summary>
 /// <param name="listhold"></param>
 public Pharmacist(ListHolder listhold, ListHolder.Usertype value)
 {
     InitializeComponent();
     ParentListHolder = listhold;
     ParentListHolder.Initialise(); //Loads Stock Control Method
     usertype = value;
 }
Esempio n. 2
0
        public MainForm(ListHolder.Usertype usertypevalue, ListHolder mainlist)
        {
            InitializeComponent();
            parentlistholder = mainlist;

            if (usertypevalue == ListHolder.Usertype.Cashier)            //If User is a Cashier
            {
                AddPrescription.Enabled = true;                          //they can use the add prescription form
                usertype = usertypevalue;                                //Parses User Type
            }
            else if (usertypevalue == ListHolder.Usertype.Pharmacist)    //If User is a Pharmacist
            {
                ProcessPrescription.Enabled = true;                      //they can use the process prescription form
                usertype = usertypevalue;                                //Parses User Type
            }
            else if (usertypevalue == ListHolder.Usertype.Administrator) //If User is a Admin
            {
                //Administrators can use everything
                ProcessPrescription.Enabled = true;
                AddPrescription.Enabled     = true;
                StockControl.Enabled        = true;
                UserManagement.Enabled      = true;
                btnManagementReport.Enabled = true;
                usertype = usertypevalue; //Parses User Type
            }
        }
Esempio n. 3
0
        ListHolder.Usertype usertype;                                        //Users Type

        public AddPrescription(ListHolder holder, ListHolder.Usertype value) //Constructor Method
        {
            InitializeComponent();
            parentlistholder = holder;                  //Loads in ListHolder
            parentlistholder.Initialise();              // Loads in Dodgy Bobs Stock Control System
            adddoc   = new AddDoctor(parentlistholder); //Create a Instance of the AddDoctor Form
            usertype = value;
        }
Esempio n. 4
0
        /// <summary>
        /// Adding a Nwe User
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Add_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text != "" && txtPassword.Text != "" && UserTypeCombo.Text != "") //If all the fields are filled in
            {
                bool UniqueUsername = true;                                                   //Flag for a Unique Username
                for (int i = 0; i < UserListView.Items.Count; i++)                            //For Every user in the list
                {
                    if (UserListView.Items[i].Text == txtUsername.Text)                       //Check if the one typed is uniquw
                    {
                        UniqueUsername = false;                                               //If it is not uniquw
                        MessageBox.Show("Username Already Exists");                           //Show Error Message
                    }
                }
                if (UniqueUsername)                                                      //If it is a Unique Username
                {
                    Users tempuserclass = new Users(txtUsername.Text, txtPassword.Text); //Create New Class
                    ListHolder.Usertype tempusertype = ListHolder.Usertype.Cashier;      //Default Value
                    switch (UserTypeCombo.Text)                                          //For Each User Type
                    {
                    case "Administrator":
                        tempusertype = ListHolder.Usertype.Administrator;     //Set Admin
                        break;

                    case "Pharmacist":
                        tempusertype = ListHolder.Usertype.Pharmacist;     //Set Pharmacist
                        break;

                    case "Cashier":
                        tempusertype = ListHolder.Usertype.Cashier;     //Set Cashier
                        break;
                    }
                    tempuserclass.pJobtype = tempusertype; //Set Class User type as this one
                    users.UserList.Add(tempuserclass);     //Adds the New User

                    PopulateListView();                    //Update List View
                    WriteUsers();                          //Write Users Out
                }
            }
            else //If Not all fields are filled in
            {
                MessageBox.Show("Not All the Fields Contain Data"); //Show error Message
            }
        }
Esempio n. 5
0
        public ListHolder loadusers = new ListHolder(); //List of Users
        /// <summary>
        /// Login Button Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Loginbutton_Click(object sender, EventArgs e)
        {
            bool UserAuth = false;                                                                              //User is not authenticated (default value)

            ListHolder.Usertype logintype = ListHolder.Usertype.Cashier;                                        //default value
            foreach (Users userclass in loadusers.UserList)                                                     //For Every User in the list
            {
                if (txtUsername.Text == userclass.GetUsername() && txtPassword.Text == userclass.GetPassword()) //Check Usernames & Passwords against what the user has typed
                {
                    UserAuth  = true;                                                                           //User is authenticated
                    logintype = userclass.GetUserStatus();                                                      //Get the User type
                }
            }
            if (UserAuth == true)                                  //If user is allowed to login
            {
                MainForm lol = new MainForm(logintype, loadusers); //Show Main Form
                lol.Show();
                this.Hide();                                       //Close This Form
            }
            else
            {
                MessageBox.Show("Invalid Username or Password");     //Show Error Message
            }
        }
 /// <summary>
 ///  Sets User Type as Cashier
 /// </summary>
 public void SetAsCashier()
 {
     pJobtype = ListHolder.Usertype.Cashier;
 }
 /// <summary>
 ///  Sets User Type as Pharmacist
 /// </summary>
 public void SetAsPharmacist()
 {
     pJobtype = ListHolder.Usertype.Pharmacist;
 }
 /// <summary>
 /// Sets User Type as Admin
 /// </summary>
 public void SetAsAdmin()
 {
     pJobtype = ListHolder.Usertype.Administrator;
 }
Esempio n. 9
0
 /// <summary>
 /// Constructor Method
 /// </summary>
 /// <param name="listhold"></param>
 public UserManagement(ListHolder listhold, ListHolder.Usertype value)
 {
     InitializeComponent();
     users    = listhold;
     usertype = value;
 }
 ListHolder.Usertype usertype; //Users Type
 /// <summary>
 /// Constructor Method
 /// </summary>
 /// <param name="hold"></param>
 public StockControl(ListHolder hold, ListHolder.Usertype value)
 {
     InitializeComponent();
     parentlistholder = hold;
     usertype         = value;
 }
 List <Prescription> PrescriptionsList = new List <Prescription>(); //List of Prescriptions
 /// <summary>
 /// Constructor Method
 /// </summary>
 /// <param name="listholder"></param>
 public ManagementReport(ListHolder listholder, ListHolder.Usertype value)
 {
     InitializeComponent();
     prescriptions = listholder;
     usertype      = value;
 }