예제 #1
0
 public bool DeleteUndeletedEmployeeNumber(UndeletedEmployeeNumber undeletedEmployeeNumber)
 {
     OleDbCommand odCom1 = BuildDelCmd("UndeletedEmployeeNumber", "EmployeeNumber=@EmployeeNumber AND @TerminalID=@TerminalID", new object[] { "@EmployeeNumber", undeletedEmployeeNumber.EmployeeNumber, "@TerminalID", undeletedEmployeeNumber.TerminalID }); ;
     return odCom1.ExecuteNonQuery() > 0 ? true : false;
 }
예제 #2
0
        public bool AddUndeletedEmployeeNumber(UndeletedEmployeeNumber undeletedEmployeeNumber)
        {
            OleDbCommand odCom1 = BuildInsertCmd("UndeletedEmployeeNumber",
                new string[] { "TerminalID"
                },
                new object[] { undeletedEmployeeNumber.TerminalID
                }
            );

            if (odCom1.ExecuteNonQuery() == 1)
            {
                return true;
            }
            return false;
        }
예제 #3
0
        public bool UpdateUndeletedEmployeeNumber(UndeletedEmployeeNumber undeletedEmployeeNumber)
        {
            OleDbCommand odCom1 = BuildUpdateCmd("UndeletedEmployeeNumber",
                new string[] { "TerminalID"
                },
                new object[] { undeletedEmployeeNumber.TerminalID
                },
                "EmployeeNumber=@ID", new object[] { "@ID", undeletedEmployeeNumber.EmployeeNumber }
            );

            return odCom1.ExecuteNonQuery() > 0 ? true : false;
        }
예제 #4
0
        public List<UndeletedEmployeeNumber> GetUndeletedEmployeeNumberList()
        {
            OleDbCommand odCom = BuildSelectCmd("UndeletedEmployeeNumber", "*", null);
            OleDbDataReader odRdr = odCom.ExecuteReader();
            List<UndeletedEmployeeNumber> undeletedEmployeeNumberList = new List<UndeletedEmployeeNumber>();
            UndeletedEmployeeNumber undeletedEmployeeNumber = null;
            while (odRdr.Read())
            {
                undeletedEmployeeNumber = new UndeletedEmployeeNumber();

                undeletedEmployeeNumber.EmployeeNumber = Convert.ToInt32(odRdr["EmployeeNumber"]);
                undeletedEmployeeNumber.TerminalID = Convert.ToInt16(odRdr["TerminalID"]);

                undeletedEmployeeNumberList.Add(undeletedEmployeeNumber);
            }

            odRdr.Close();
            return undeletedEmployeeNumberList;
        }
예제 #5
0
        public UndeletedEmployeeNumber GetUndeletedEmployeeNumber(int employeeNumber, int terminalID)
        {
            OleDbCommand odCom = BuildSelectCmd("UndeletedEmployeeNumber", "*", "EmployeeNumber=@EmployeeNumber AND @TerminalID=@TerminalID", new object[] { "@EmployeeNumber", employeeNumber, "@TerminalID", terminalID });
            OleDbDataReader odRdr = odCom.ExecuteReader();

            UndeletedEmployeeNumber undeletedEmployeeNumber = null;
            if (odRdr.Read())
            {
                undeletedEmployeeNumber = new UndeletedEmployeeNumber();

                undeletedEmployeeNumber.EmployeeNumber = Convert.ToInt32(odRdr["EmployeeNumber"]);
                undeletedEmployeeNumber.TerminalID = Convert.ToInt16(odRdr["TerminalID"]);
            }

            odRdr.Close();
            return undeletedEmployeeNumber;
        }
예제 #6
0
        private void RemoveEmployeeFromTerminal(Employee employee)
        {
            List<Terminal> terminalList = _dtCtrl.GetTerminalListByEmployee(employee.EmployeeNumber);

            foreach (Terminal terminal in terminalList)
            {
                if (_terCtrl.IsTerminalConnected(terminal))
                {
                    //throw new Exception("Do not do this yet. It is painful to add an employee from the terminal you know.");

                    if (_terCtrl.RemoveEmployee(terminal, employee.EmployeeNumber) == false)
                        throw new Exception("Cannot remove employee " + employee.EmployeeNumber + " from terminal " + terminal.Name + ".");
                }
                else
                {
                    UndeletedEmployeeNumber undeletedEmployeeNumber = new UndeletedEmployeeNumber();
                    undeletedEmployeeNumber.EmployeeNumber = employee.EmployeeNumber;
                    undeletedEmployeeNumber.TerminalID = terminal.ID;

                    if (_dtCtrl.AddUndeletedEmployeeNumber(undeletedEmployeeNumber) == false)
                        throw new Exception("Employee " + employee.EmployeeNumber + " could not be deleted.");
                }
            }
        }