Exemplo n.º 1
0
        public Boolean AddStaff(string name, string surname, string skills, string address, string username, string password)
        {
            bool[] flagArr = new bool[2];
            bool   flag    = true;

            StaffDataHandler handler = new StaffDataHandler();

            //Build ID etc
            int    userID  = new IDBuilder().GenerateUserID();
            string staffID = new IDBuilder().GenerateStaffID(skills);

            //Add the user first
            flagArr[0] = handler.addUser(userID, username, password);

            //Add staff last
            flagArr[1] = handler.addStaff(staffID, userID, name, surname, "Active", skills, address);

            foreach (bool item in flagArr)
            {
                if (!item)
                {
                    flag = false;
                }
                else
                {
                    continue;
                }
            }
            return(flag);
        }
Exemplo n.º 2
0
        public Boolean CreateIssue(Clients clients, DateTime reportedDate, String staffID, String status, String description)
        {
            string  issueID = new IDBuilder().GenerateIssueID();
            Boolean flag    = new IssueDataHandler().CreateIssue(issueID, clients, reportedDate, staffID, status, description);

            return(flag);
        }
Exemplo n.º 3
0
        public void Test_ifSA()     // Check if Valid SA Citizen based of returned values from ID Number
        {
            IDBuilder iDBuilder = new IDBuilder();
            var       id        = "9605225076089";
            int       getValue  = int.Parse(id.Substring(10, 1));

            Assert.AreEqual(getValue, 0);
        }
Exemplo n.º 4
0
        public void Test_GetGender()    // Check if returned value fits criteria of gender
        {
            IDBuilder iDBuilder = new IDBuilder();
            var       id        = "9605225076089";
            int       getValue  = int.Parse(id.Substring(6, 4));

            Assert.IsTrue(getValue > 5000);
        }
Exemplo n.º 5
0
        public void Test_GetDateOfBirth() // Checks whether method returns a value
        {
            IDBuilder iDBuilder = new IDBuilder();
            var       id        = "9605225076089";
            var       testDob   = DateTime.ParseExact(id.Substring(0, 6), "yyMMdd", CultureInfo.InvariantCulture);

            Assert.IsNotNull(testDob);
        }
Exemplo n.º 6
0
        public Boolean CreateCallLog(string clientID, string staffID, DateTime startStamp, DateTime endStamp)
        {
            bool   flag = false;
            string ID   = new IDBuilder().GenerateCallRecordID(clientID);

            flag = new Data().AddCall(ID, clientID, startStamp, endStamp, staffID);
            return(flag);
        }
Exemplo n.º 7
0
        public Boolean CreateProd(string name, string serialNum, string contractID, string clientID, DateTime expDate)
        {
            //ID Builder
            String prodID = new IDBuilder().GenerateProductID();

            Boolean flag = new Data().AddProduct(prodID, clientID, contractID, name, serialNum, expDate);

            return(flag);
        }
Exemplo n.º 8
0
        public Boolean CreateReq(string clientID, DateTime plannedDate, DateTime deadlineDate, string service)
        {
            //ID Builder
            String requestID = new IDBuilder().GenerateReqID();

            Boolean flag = new Data().AddRequest(requestID, clientID, plannedDate, deadlineDate, service);

            return(flag);
        }
Exemplo n.º 9
0
        private static Person ValidateAndExtractInformation(string idNumber)
        {
            // Write your code here

            IDBuilder iDBuilder = new IDBuilder();          //Create Builder Object
            Person    obj       = new Person                //Create Person Class Object
            {                                               //Call Methods and pass through id number as parameter
                DateOfBirth           = iDBuilder.GetDOB(idNumber),
                Gender                = iDBuilder.GetGender(idNumber),
                isSouthAfricanCitizen = iDBuilder.IsSouthAfrican(idNumber),
                isValidIDNumber       = iDBuilder.IsValidID(idNumber)
            };

            return(obj);

            //throw new NotImplementedException();
        }
Exemplo n.º 10
0
        public Boolean ScheduleRequests()
        {
            bool        flag     = true;
            List <bool> boolList = new List <bool>();
            string      jobID    = "";

            Data      data    = new Data();
            IDBuilder builder = new IDBuilder();

            List <RequestData> requests     = new List <RequestData>();
            List <Staff>       staff        = new List <Staff>();
            List <string>      staffNotBusy = new List <string>();

            int n = 0;

            staff = new StaffDataHandler().GetLAllStaff();

            foreach (Staff item in staff)
            {
                if (item.Status == "Active" && item.StaffID.Substring(0, 2) == "SM")
                {
                    staffNotBusy.Add(item.StaffID);
                }
                else
                {
                    continue;
                }
            }

            requests = GetLRequests();


            int a = 0;

            if (requests.Count > staffNotBusy.Count)
            {
                MessageBox.Show("There is not enough staff to fill the requests", "Staff Shortage", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            else
            {
                foreach (RequestData item in requests)
                {
                    jobID = builder.GenerateJobID(item.ClientID);
                    boolList.Add(data.AddJob(jobID, item.PlannedDate, item.Service, "Busy", staffNotBusy[a], item.ClientID));
                    a++;
                }

                foreach (bool item in boolList)
                {
                    if (!item)
                    {
                        flag = false;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 11
0
        internal bool AddSLA(string name, string descrip, string tarif, string code)
        {
            String slaID = new IDBuilder().GenerateSlaID(code);

            return(data.AddSLA(slaID, name, descrip, Double.Parse(tarif)));
        }