public EmployeeEntity GetEmployeeInfo(EmployeeEntity employee)
        {
            EmployeeEntity entity = new EmployeeEntity();
              Guid id = SynergyService.GetUserByName(employee.username).UserId;
              EM_Employee emp = SynergyService.GetEmployee(id);

              return AssembleEntity(emp);
        }
        /// <summary>
        /// Gets the employee info.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        public EmployeeEntity GetEmployeeInfo(EmployeeEntity employee)
        {
            Guid id = SynergyService.GetUserByName(employee.username).UserId;
               employee.ExternalId = SynergyService.GetEmployeeExternalId(id);

               EmployeeEntity  entity = new EmployeeEntity();
               entity = EmployeeAdapter.EmployeeAdaper.GetEmployeeInfo(employee.ExternalId);

               return entity;
        }
        /// <summary>
        /// Assembles the entity.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <returns></returns>
        private EmployeeEntity AssembleEntity(EM_Employee employee)
        {
            EmployeeEntity entity = new EmployeeEntity();

              entity.Address = employee.Address;
              entity.Email = employee.Email;
              entity.FirstName = employee.FirstName;
              entity.LastName = employee.LastName;
              entity.Phone = employee.Phone;
              entity.ExternalId = employee.ExternalId;
              return entity;
        }
Example #4
0
 public int Count(EmployeeEntity EmployeeEntity, DiscountSearchEntity DiscountSearchEntity)
 {
     return(UnitOfWork.DiscountRepository.Count(DiscountSearchEntity));
 }
Example #5
0
 public int Count(EmployeeEntity EmployeeEntity, CarrierSearchEntity CarrierSearchEntity)
 {
     return(UnitOfWork.CarrierRepository.Count(CarrierSearchEntity));
 }
Example #6
0
        public ReceiptNoteEntity Get(EmployeeEntity EmployeeEntity, Guid ReceiptNoteId)
        {
            ReceiptNote ReceiptNote = UnitOfWork.ReceiptNoteRepository.Get(ReceiptNoteId);

            return(new ReceiptNoteEntity(ReceiptNote, ReceiptNote.WareHouse, ReceiptNote.Supplier, ReceiptNote.ReceiptNoteLines));
        }
Example #7
0
 public int Count(EmployeeEntity EmployeeEntity, ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
 {
     return(UnitOfWork.ReceiptNoteRepository.Count(ReceiptNoteSearchEntity));
 }
Example #8
0
        public PermissionEntity Get(EmployeeEntity EmployeeEntity, Guid PermissionId)
        {
            Permission Permission = UnitOfWork.PermissionRepository.Get(PermissionId);

            return(new PermissionEntity(Permission));
        }
Example #9
0
 public int Count(EmployeeEntity EmployeeEntity, PermissionSearchEntity PermissionSearchEntity)
 {
     return(UnitOfWork.PermissionRepository.Count(PermissionSearchEntity));
 }
Example #10
0
        public CustomerEntity Get(EmployeeEntity EmployeeEntity, Guid CustomerId)
        {
            Customer Customer = UnitOfWork.CustomerRepository.Get(CustomerId);

            return(new CustomerEntity(Customer));
        }
 public string Insertmanager([FromBody] EmployeeEntity employee)
 {
     return(model.Insertmanager(employee));
 }
Example #12
0
 private IPageVm BuildNewImVm(EmployeeEntity employeeEntity, AddEmployeeImCommand command) =>
 BuildImTab(employeeEntity).Link(RelTypes.Breadcrumb, "New Email", AddImUri(new AddEmployeeImQuery(employeeEntity.EmployeeId)))
 .Property(nameof(AddEmployeeImCommand.Im), "IM", command.Im)
 .Property(nameof(AddEmployeeImCommand.Description), "Description", command.Description)
 .Build()
 .ToFormVm();
Example #13
0
 private IResourceBuilder BuildImTab(EmployeeEntity employeeEntity) =>
 BuildEditBase(employeeEntity).Link(RelTypes.Self, "IM", ImsUri(new SearchEmployeeImQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Breadcrumb, "IM", ImsUri(new SearchEmployeeImQuery(employeeEntity.EmployeeId)));
Example #14
0
 private IPageVm BuildNewPhoneVm(EmployeeEntity employeeEntity, AddEmployeePhoneCommand command) =>
 BuildePhoneTab(employeeEntity).Link(RelTypes.Breadcrumb, "New Email", AddEmailUri(new AddEmployeeEmailQuery(employeeEntity.EmployeeId)))
 .Property(nameof(AddEmployeePhoneCommand.Phone), "Phone", command.Phone)
 .Property(nameof(AddEmployeePhoneCommand.Description), "Description", command.Description)
 .Build()
 .ToFormVm();
Example #15
0
 private IResourceBuilder BuildePhoneTab(EmployeeEntity employeeEntity) =>
 BuildEditBase(employeeEntity).Link(RelTypes.Self, "Phones", PhonesUri(new SearchEmployeePhoneQuery(employeeEntity.EmployeeId)))
 .Link(RelTypes.Breadcrumb, "Phones", PhonesUri(new SearchEmployeePhoneQuery(employeeEntity.EmployeeId)));
Example #16
0
        public DiscountEntity Get(EmployeeEntity EmployeeEntity, Guid DiscountId)
        {
            Discount Discount = UnitOfWork.DiscountRepository.Get(DiscountId);

            return(new DiscountEntity(Discount));
        }
 public EmployeeEntity GetLogin(EmployeeEntity employeeEntity)
 {
     return(model.GetLogin(employeeEntity));
 }
 public string AddEmployees([FromBody] EmployeeEntity employees)
 {
     return(model.AddEmployees(employees));
 }
Example #19
0
 public bool Delete(EmployeeEntity EmployeeEntity, Guid CustomerId)
 {
     UnitOfWork.CustomerRepository.Delete(CustomerId);
     UnitOfWork.Complete();
     return(true);
 }
 public string UpdateEmployees([FromBody] EmployeeEntity employees, int Id)
 {
     return(model.UpdateEmployees(employees, Id));
 }
Example #21
0
        public List <PermissionEntity> Get(EmployeeEntity EmployeeEntity, PermissionSearchEntity PermissionSearchEntity)
        {
            List <Permission> Permissions = UnitOfWork.PermissionRepository.List(PermissionSearchEntity);

            return(Permissions.ToList().Select(c => new PermissionEntity(c)).ToList());
        }
        /// <summary>
        /// Handles the LLBLGenProDataSource PerformWork Event which is raised when LivePersistence is set to false and an insert/update/delete has to be performed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void EmployeeDetailsDS_PerformWork(object sender, PerformWorkEventArgs2 e)
        {
            #region Get the entityToDelete from UOW
            EmployeeEntity entityToDelete = null;
            // If found, get the entity to be deleted from the UnitOfWork object.
            List <UnitOfWorkElement2> deleteItems = e.Uow.GetEntityElementsToDelete();
            if (deleteItems.Count > 0)
            {
                entityToDelete = (EmployeeEntity)deleteItems[0].Entity;
            }
            #endregion

            #region Get the entityToUpdate from UOW
            EmployeeEntity entityToUpdate = null;
            // If found, get the entity to be updated from the UnitOfWork object.
            List <UnitOfWorkElement2> updateItems = e.Uow.GetEntityElementsToUpdate();
            if (updateItems.Count > 0)
            {
                entityToUpdate = (EmployeeEntity)updateItems[0].Entity;
                //Set the Photo of the EMployee, if uploaded.
                SetPicture(entityToUpdate);
            }
            #endregion

            #region Get the entityToInsert from UOW
            EmployeeEntity entityToInsert = null;
            // If found, get the entity to be inserted from the UnitOfWork object.
            List <UnitOfWorkElement2> inserteItems = e.Uow.GetEntityElementsToInsert();
            if (inserteItems.Count > 0)
            {
                entityToInsert = (EmployeeEntity)inserteItems[0].Entity;
                //Set the Photo of the EMployee, if uploaded.
                SetPicture(entityToInsert);
            }
            #endregion

            #region Determining the entity to validate

            // entity to be validated
            EmployeeEntity entityToValidate = null;

            // flag to know whether the entity is valid
            bool entityToValidateIsValid = true;


            if (entityToInsert != null)
            {
                entityToValidate = entityToInsert;
            }

            if (entityToUpdate != null)
            {
                entityToValidate = entityToUpdate;
            }
            #endregion


            #region Validating the entity via ValidateEntity() method
            if (entityToValidate != null)
            {
                try
                {
                    // perform the validate process
                    entityToValidate.ValidateEntity();

                    // everything OK, lets hide the error controls
                    HideEntityErrorControls();
                }
                catch (ORMEntityValidationException ex)
                {
                    // oops, there are errors somewhere, lets show to the user
                    ShowEntityErrors(ex.Message);
                    entityToValidateIsValid = false;
                }
            }
            #endregion


            #region Perform the work
            if (entityToValidateIsValid)
            {
                try
                {
                    DataAccessAdapter adapter = new DataAccessAdapter();
                    e.Uow.Commit(adapter, true);
                }
                catch (ORMQueryExecutionException ex)
                {
                    /// catch other errors
                    /// ...
                }
            }
            #endregion
        }
Example #23
0
 public bool Delete(EmployeeEntity EmployeeEntity, Guid PermissionId)
 {
     UnitOfWork.PermissionRepository.Delete(PermissionId);
     UnitOfWork.Complete();
     return(true);
 }
Example #24
0
        public static void LoadEmployees()
        {
            using (NorthwindDataContext db = new NorthwindDataContext())
            {
                var duplicateMapping = (from t in db.Territories.ToList()
                                        group int.Parse(t.TerritoryID) by t.TerritoryDescription into g
                                        where g.Count() > 1
                                        let min = g.Min()
                                                  from item in g.Except(new[] { min })
                                                  select new
                {
                    Min = min,
                    Item = item
                }).ToDictionary(a => a.Item, a => a.Min);

                var territoriesDic = Database.RetrieveAll <TerritoryEntity>().ToDictionary(a => a.Id);


                var exmployeeTerritories = (from e in db.Employees
                                            from t in e.EmployeeTerritories
                                            select new { e.EmployeeID, t.TerritoryID }).ToList()
                                           .AgGroupToDictionary(a => a.EmployeeID, gr =>
                                                                gr.Select(a => int.Parse(a.TerritoryID))
                                                                .Select(id => duplicateMapping.TryGet(id, id))
                                                                .Select(id => territoriesDic[id])
                                                                .Distinct().ToMList());


                Administrator.SaveListDisableIdentity(
                    from e in db.Employees
                    select new EmployeeEntity
                {
                    BirthDate       = e.BirthDate,
                    FirstName       = e.FirstName,
                    LastName        = e.LastName,
                    TitleOfCourtesy = e.TitleOfCourtesy,
                    HomePhone       = e.HomePhone,
                    Extension       = e.Extension,
                    HireDate        = e.HireDate,
                    Photo           = new FileEntity {
                        FileName = e.PhotoPath.AfterLast('/'), BinaryFile = RemoveOlePrefix(e.Photo.ToArray())
                    }.ToLiteFat(),
                    PhotoPath = e.PhotoPath,
                    Address   = new AddressEntity
                    {
                        Address    = e.Address,
                        City       = e.City,
                        Country    = e.Country,
                        Region     = e.Region,
                        PostalCode = e.PostalCode,
                    },
                    Notes       = e.Notes,
                    Territories = exmployeeTerritories[e.EmployeeID],
                }.SetId(e.EmployeeID));

                var pairs = (from e in db.Employees
                             where e.ReportsTo != null
                             select new { e.EmployeeID, e.ReportsTo });

                foreach (var pair in pairs)
                {
                    EmployeeEntity employee = Database.Retrieve <EmployeeEntity>(pair.EmployeeID);
                    employee.ReportsTo = Lite.Create <EmployeeEntity>(pair.ReportsTo.Value);
                    employee.Save();
                }
            }
        }
Example #25
0
        public List <ReceiptNoteEntity> Get(EmployeeEntity EmployeeEntity, ReceiptNoteSearchEntity ReceiptNoteSearchEntity)
        {
            List <ReceiptNote> ReceiptNotes = UnitOfWork.ReceiptNoteRepository.List(ReceiptNoteSearchEntity);

            return(ReceiptNotes.ToList().Select(rn => new ReceiptNoteEntity(rn, rn.WareHouse, rn.Supplier)).ToList());
        }
        private EmployeeModel ConvertEmployee(EmployeeEntity empEntity)
        {
            var empModel = FromDbToModel.ConvertEmployee(empEntity);

            return(empModel);
        }
Example #27
0
 public bool Delete(EmployeeEntity EmployeeEntity, Guid ReceiptNoteId)
 {
     UnitOfWork.ReceiptNoteRepository.Delete(ReceiptNoteId);
     UnitOfWork.Complete();
     return(true);
 }
Example #28
0
 public async Task <IAnnualSalary> ExecuteCreationAsync(CalculationTypes type, EmployeeEntity employee) => await factories[type].CreateAsync(employee);
Example #29
0
        public List <CarrierEntity> Get(EmployeeEntity EmployeeEntity, CarrierSearchEntity CarrierSearchEntity)
        {
            List <Carrier> Carriers = UnitOfWork.CarrierRepository.List(CarrierSearchEntity);

            return(Carriers.Select(c => new CarrierEntity(c)).ToList());
        }
Example #30
0
 /// <summary> Removes the sync logic for member _employee</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncEmployee(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_employee, new PropertyChangedEventHandler(OnEmployeePropertyChanged), "Employee", AdventureWorks.Dal.Adapter.v50.RelationClasses.StaticDocumentRelations.EmployeeEntityUsingOwnerStatic, true, signalRelatedEntity, "Documents", resetFKFields, new int[] { (int)DocumentFieldIndex.Owner });
     _employee = null;
 }
Example #31
0
        public List <DiscountEntity> Get(EmployeeEntity EmployeeEntity, DiscountSearchEntity DiscountSearchEntity)
        {
            List <Discount> Discounts = UnitOfWork.DiscountRepository.List(DiscountSearchEntity);

            return(Discounts.ToList().Select(c => new DiscountEntity(c)).ToList());
        }
Example #32
0
        public List <CustomerEntity> Get(EmployeeEntity EmployeeEntity, CustomerSearchEntity CustomerSearchEntity)
        {
            List <Customer> Customers = UnitOfWork.CustomerRepository.List(CustomerSearchEntity);

            return(Customers.ToList().Select(c => new CustomerEntity(c)).ToList());
        }
Example #33
0
 public bool Delete(EmployeeEntity EmployeeEntity, Guid DiscountId)
 {
     UnitOfWork.DiscountRepository.Delete(DiscountId);
     UnitOfWork.Complete();
     return(true);
 }
        /// <summary>
        /// Gets the employee entity.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <returns></returns>
        public static EmployeeEntity GetEmployeeEntity(string username)
        {
            EmployeeEntity entity = new EmployeeEntity();
            if (IsEmployeeSystemExternal())
            {
                ExternalEmployeeManagement empl = new ExternalEmployeeManagement();
                entity.username = username;

                entity = empl.GetEmployeeInfo(entity);
            }
            else
            {
                SynergyEmployeeManagement emp = new SynergyEmployeeManagement();
                entity.username = username;
                entity = emp.GetEmployeeInfo(entity);

            }
            return entity;
        }