Esempio n. 1
0
 public DepartmentsController(
     IDepartments dep,
     IMapper mapper)
 {
     _depBll = dep;
     _mapper = mapper;
 }
Esempio n. 2
0
 public EmployeesController(IEmployees pIEmployees, IBusinessUnits pIBusinessUnits, IDepartments pIDepartments, IPositions pIPositions, IMEmployees pIMEmployees)
 {
     lIEmployees     = pIEmployees;
     lIBusinessUnits = pIBusinessUnits;
     lIDepartments   = pIDepartments;
     lIPositions     = pIPositions;
     lIMEmployees    = pIMEmployees;
 }
Esempio n. 3
0
 public ConfigurationController(IBusinessUnits BParam, IDepartments DParam, IidentityCodes idCodes, IJobtitles jParam, IPositions pParam, IPrefixes prparam, IEmploymentStatus status, ILeaveManagement lParam)
 {
     this.BusinessRepo = BParam;
     this.DeptRepo     = DParam;
     this.IdentityRepo = idCodes;
     this.JobRepo      = jParam;
     this.positionRepo = pParam;
     this.prefixRepo   = prparam;
     this.statusRepo   = status;
     this.leaveRepo    = lParam;
 }
Esempio n. 4
0
 public BasicDataController(ICountries countries, IStates states, IRoles roles, IDepartments departments, IGender gender, INationality nationality, ICurrency currency, IIdentificationtypes identificationtypes, IMaritalstatuses maritalstatuses, IEntities entities)//, ITaxMaster tasMaster)
 {
     _countries           = countries;
     _states              = states;
     _roles               = roles;
     _departments         = departments;
     _gender              = gender;
     _nationality         = nationality;
     _currency            = currency;
     _identificationtypes = identificationtypes;
     _maritalstatuses     = maritalstatuses;
     _entities            = entities;
 }
Esempio n. 5
0
 public PageController(IAssetsTypes pIAssetsTypes, IAssetsGroups pIAssetsGroups, IAssetsItems pIAssetsItems, IBusinessUnits pIBusinessUnits, IDepartments pIDepartments, IEmployees pIEmployees, IPositions pIPositions, IMAssetsItems pIMAssetsItems, IMAuditsTrails pIMAuditsTrails, IMEmployees pIMEmployees, IMMRs pIMMRs)
 {
     #region BLO
     lIAssetsTypes   = pIAssetsTypes;
     lIAssetsGroups  = pIAssetsGroups;
     lIAssetsItems   = pIAssetsItems;
     lIBusinessUnits = pIBusinessUnits;
     lIDepartments   = pIDepartments;
     lIEmployees     = pIEmployees;
     lIPositions     = pIPositions;
     #endregion
     #region Models
     lIMAssetsItems  = pIMAssetsItems;
     lIMAuditsTrails = pIMAuditsTrails;
     lIMEmployees    = pIMEmployees;
     lIMMRs          = pIMMRs;
     #endregion
 }
        public IDepartments Departments(Parcel parcel)
        {
            IDepartments selectedDepartment = null;

            var departments = ObjectProvider.GetAllTypesOf <IDepartments>().ToList();

            if (!departments.Any())
            {
                throw new Exception("Department not found");
            }

            foreach (var department in departments)
            {
                if (parcel.Weight > department.WeightMin && parcel.Weight < department.WeightMax)
                {
                    selectedDepartment = department;
                    break;
                }


                if (parcel.Weight > department.WeightMin && department.WeightMax == null)
                {
                    selectedDepartment = department;
                    break;
                }

                if (parcel.Value > department.Value && department.WeightMax == null && department.WeightMin == null)
                {
                    selectedDepartment = department;
                    break;
                }
            }

            if (selectedDepartment == null)
            {
                throw new Exception("Department not found");
            }

            return(selectedDepartment);
        }
Esempio n. 7
0
        public IDepartments GetDepartment(Parcel parcel)
        {
            IDepartments selectedDepartment = null;
            var          departments        = _serviceProvider.GetServices <IDepartments>().ToList();

            if (!departments.Any())
            {
                throw new Exception("Department not found");
            }

            foreach (var department in departments)
            {
                if (parcel.Weight > department.MinmumWeight && parcel.Weight < department.MaximumWeight)
                {
                    selectedDepartment = department;
                    break;
                }


                if (parcel.Weight > department.MinmumWeight && department.MaximumWeight == null)
                {
                    selectedDepartment = department;
                    break;
                }

                if (department.MaximumWeight == null && department.MinmumWeight == null)
                {
                    selectedDepartment = department;
                    break;
                }
            }

            if (selectedDepartment == null)
            {
                throw new Exception("Department not found");
            }

            return(selectedDepartment);
        }
Esempio n. 8
0
        private static void AddUser(Program main, string[] args)
        {
            int numID;

            IUsers usersSet = main._net2Client.ViewUserRecords(String.Format("Field9_50 = '{0}' AND active=1", args[2]));

            if (usersSet.UsersList().Count > 0)
            {
                Console.WriteLine("xxx Duplicate entry, no thank you!");
                return;
            }

            //public int Day { get; }
            DateTime now = DateTime.Now;

            Console.WriteLine(now.Month);
            Console.WriteLine(now.Day);

            //string depString = "Visitors_"+ now.Month + "_" + now.Day;
            string depString = args[1];

            Console.WriteLine("MY department = " + depString);



            // add new department

            bool ret = main._net2Client.AddDepartment(depString);

            if (ret)
            {
                Console.WriteLine("New department was added " + depString);
            }

            // get new department ID

            IDepartments xxx = main._net2Client.ViewDepartments();

            numID = 0;

            foreach (DepartmentsSet.DepartmentRow dept in xxx.DepartmentsDataSource.Department)
            {
                //Console.WriteLine("here " + dept.Name + dept.DepartmentID);

                if (dept.Name == depString)
                {
                    //Console.WriteLine("gotit" + dept.DepartmentID);
                    numID = dept.DepartmentID;
                    Console.WriteLine("department ID = " + numID + " for " + depString);
                }
            }

            //Console.WriteLine("numID = " + numID);



            int    accessLevel        = 1; // All hours, all doors
            int    departmentId       = numID;
            bool   antiPassbackInd    = false;
            bool   alarmUserInd       = false;
            string firstName          = args[2];
            string middleName         = null;
            string surname            = args[3];
            string telephoneNo        = null;
            string telephoneExtension = null;
            string pinCode            = args[7];
            string pictureFileName    = null;
            //DateTime activationDate = DateTime.Now;
            DateTime activationDate = DateTime.Parse(args[5]);

            int      cardNumber = 0;
            int      cardTypeID = 0;
            bool     active     = true;
            string   faxNo      = null;
            DateTime expiryDate = DateTime.Parse(args[6]);

            string[] customFields = null;

            Console.WriteLine("New user about to be added " + args[2] + ' ' + args[3] + ' ' + args[7]);


            int userId = main._net2Client.AddNewUser(
                accessLevel, departmentId, antiPassbackInd, alarmUserInd, firstName, middleName, surname,
                telephoneNo, telephoneExtension, pinCode, pictureFileName, activationDate, cardNumber, cardTypeID,
                active, faxNo, expiryDate, customFields
                );

            if (userId == OemClient.ErrorCodes.AddNewUserFailed)
            {
                Console.Write(main._net2Client.LastErrorMessage);
                return;
            }

            Console.WriteLine("New user was added " + args[2] + ' ' + args[7]);
        }
Esempio n. 9
0
        //public int myDepID;

        static void Main(string[] args)
        {
            int numID;

            if (args.Length != 7)
            {
                Console.WriteLine("Format:  RemoveUser.exe [department] [First name] [Second name] [email] [from] [until] [code]");
                Console.WriteLine("Example: Sample1.exe visitor_05_16 Joe Bloggs [email protected]  2018-05-01 2018-05-01T07:34:42-5:00 1002");
                return;
            }

            Program main = new Program();

            bool res = main.AuthenticateUser("System engineer", "isaac0904");

            if (res != true)
            {
                Console.WriteLine("Incorrect username or password");
                main.Close();
                return;
            }

            Console.WriteLine("Authentication success");


            IUsers usersSet = main._net2Client.ViewUserRecords(String.Format("Field9_50 = '{0}' AND active=1", args[2]));

            if (usersSet.UsersList().Count > 0)
            {
                Console.WriteLine("xxx Duplicate entry, no thank you!");
                main.Close();
                return;
            }

            //public int Day { get; }
            DateTime now = DateTime.Now;

            Console.WriteLine(now.Month);
            Console.WriteLine(now.Day);

            //string depString = "Visitors_"+ now.Month + "_" + now.Day;
            string depString = args[0];

            Console.WriteLine("department = " + depString);


            //private IDepartments xxx;


            // foreach (DepartmentsSet.DepartmentRow dept in xxx.DepartmentsDataSource.Department)
            //{
            //     Console.WriteLine("department  " + dept.Name + " " + dept.DepartmentID);
            //     Console.WriteLine("department  " + dept.Name + " " + dept.DepartmentID);
            // }

            // delete departments XXXwe need to learn how to remove all users from department

            /*
             *          //    foreach (DepartmentsSet.DepartmentRow dept in xxx.DepartmentsDataSource.Department)
             *         // {
             *          //    Console.WriteLine("department xx  " + dept.Name + " " + dept.DepartmentID);
             *              Console.WriteLine("department  " + dept.Name + " " + dept.DepartmentID);
             *
             *              IUsers usersSetDep = main._net2Client.ViewUserRecords("departmentId = '26'");
             *
             *              Console.WriteLine("hererere");
             *
             *              foreach (UsersSet.UserRow u in usersSetDep.UsersDataSource.User)
             *              {
             *                  //   Console.WriteLine("users in dep");
             *
             *
             *              }
             *
             *
             *              //if (usersSetDep.UsersList().Count > 0)
             *              //{
             *              //
             *               //   Console.WriteLine("users in dep");
             *              //}
             *
             *
             *
             *                      bool retdel = main._net2Client.DeleteDepartment(26);
             *              Console.WriteLine("HERE " + retdel);
             *
             *              //if (retdel)
             *              //{
             *              //    Console.WriteLine(" department was delete  " + depString);
             *              //}
             *
             *              retdel = main._net2Client.DeleteDepartment(23);
             *              if (retdel)
             *              {
             *                  Console.WriteLine(" department was delete  " + depString);
             *              }
             *
             *
             *          }
             */

            // add new department

            bool ret = main._net2Client.AddDepartment(depString);

            if (ret)
            {
                Console.WriteLine("New department was added " + depString);
            }

            // get new department ID

            IDepartments xxx = main._net2Client.ViewDepartments();

            numID = 0;

            foreach (DepartmentsSet.DepartmentRow dept in xxx.DepartmentsDataSource.Department)
            {
                //Console.WriteLine("here " + dept.Name + dept.DepartmentID);

                if (dept.Name == depString)
                {
                    //Console.WriteLine("gotit" + dept.DepartmentID);
                    numID = dept.DepartmentID;
                    Console.WriteLine("department ID = " + numID + " for " + depString);
                }
            }

            //Console.WriteLine("numID = " + numID);



            int    accessLevel        = 1; // All hours, all doors
            int    departmentId       = numID;
            bool   antiPassbackInd    = false;
            bool   alarmUserInd       = false;
            string firstName          = args[1];
            string middleName         = null;
            string surname            = args[2];
            string telephoneNo        = null;
            string telephoneExtension = null;
            string pinCode            = args[6];
            string pictureFileName    = null;
            //DateTime activationDate = DateTime.Now;
            DateTime activationDate = DateTime.Parse(args[4]);

            int      cardNumber = 0;
            int      cardTypeID = 0;
            bool     active     = true;
            string   faxNo      = null;
            DateTime expiryDate = DateTime.Parse(args[5]);

            string[] customFields = null;

            Console.WriteLine("New user about to be added " + args[1] + ' ' + args[2] + ' ' + args[6]);


            int userId = main._net2Client.AddNewUser(
                accessLevel, departmentId, antiPassbackInd, alarmUserInd, firstName, middleName, surname,
                telephoneNo, telephoneExtension, pinCode, pictureFileName, activationDate, cardNumber, cardTypeID,
                active, faxNo, expiryDate, customFields
                );

            if (userId == OemClient.ErrorCodes.AddNewUserFailed)
            {
                Console.Write(main._net2Client.LastErrorMessage);
                main.Close();
                return;
            }

            Console.WriteLine("New user was added " + args[1] + ' ' + args[6]);

            // Get list of users in department

            var query = "SELECT  * from UsersEx";

            var dataSet = main._net2Client.QueryDb(query);

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                Console.Write("row...");
                Console.Write(row["Surname"] + "   ");
                Console.WriteLine(row["DepartmentName"]);
            }

            main.Close();
            return;
        }
Esempio n. 10
0
 public DepartmentsController(IDepartments deparmentRepository)
 {
     _departmentService = new DepartmentService(deparmentRepository);
 }
Esempio n. 11
0
 public DepartmentService(IDepartments repository)
 {
     this._repository = repository;
 }