Esempio n. 1
0
        public void Save(VinaGerman.Entity.BusinessEntity.DepartmentEntity entityObject)
        {
            System.Threading.ThreadPool.QueueUserWorkItem(delegate
            {
                try
                {
                    ShowLoading(StringResources.captionInformation, StringResources.msgLoading);

                    var updatedEntity = Factory.Resolve <IBaseDataDS>().AddOrUpdateDepartment(entityObject);

                    HideLoading();

                    //display to UI
                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        AddOrUpdateDepartment(updatedEntity);
                    }));
                }
                catch (Exception ex)
                {
                    HideLoading();
                    ShowMessageBox(StringResources.captionError, ex.ToString(), MessageBoxButton.OK);
                }
            });
        }
Esempio n. 2
0
        public void Delete(VinaGerman.Entity.BusinessEntity.DepartmentEntity entityObject)
        {
            if (ShowMessageBox(StringResources.captionConfirm, StringResources.msgConfirmDelete, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(delegate
                {
                    try
                    {
                        ShowLoading(StringResources.captionInformation, StringResources.msgLoading);

                        var updatedEntity = Factory.Resolve <ICompanyDS>().DeleteDepartment(entityObject);

                        HideLoading();

                        //display to UI
                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            DeleteDepartment(entityObject);
                        }));
                    }
                    catch (Exception ex)
                    {
                        HideLoading();
                        ShowMessageBox(StringResources.captionError, ex.ToString(), MessageBoxButton.OK);
                    }
                });
            }
        }
Esempio n. 3
0
        public bool DeleteDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity entityObject)
        {
            ICompanySvc channel = CreateChannel();
            var         result  = channel.DeleteDepartment(entityObject);

            channel.Dispose();
            return(result);
        }
Esempio n. 4
0
        public void DeleteDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity newEntity)
        {
            VinaGerman.Entity.BusinessEntity.DepartmentEntity oldEntity = DepartmentList.FirstOrDefault <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(p => p.DepartmentId == newEntity.DepartmentId);

            if (oldEntity != null)
            {
                DepartmentList.Remove(oldEntity);
            }

            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
Esempio n. 5
0
        public void Add()
        {
            var newEntity = new VinaGerman.Entity.BusinessEntity.DepartmentEntity()
            {
                Deleted      = false,
                Description  = "",
                Phone        = "",
                DepartmentId = -1,
                CompanyId    = ApplicationHelper.CurrentUserProfile.CompanyId
            };

            DepartmentList.Add(newEntity);
            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
Esempio n. 6
0
        public void AddOrUpdateDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity newEntity)
        {
            VinaGerman.Entity.BusinessEntity.DepartmentEntity oldEntity = DepartmentList.FirstOrDefault <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(p => p.Description == newEntity.Description);

            if (oldEntity == null)
            {
                DepartmentList.Insert(0, newEntity);
            }
            else
            {
                int index = DepartmentList.IndexOf(oldEntity);
                DepartmentList.Remove(oldEntity);
                DepartmentList.Insert(index, newEntity);
            }

            DepartmentList = new List <VinaGerman.Entity.BusinessEntity.DepartmentEntity>(_departmentList);
        }
Esempio n. 7
0
 public bool DeleteDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity entityObject)
 {
     return(Factory.Resolve <IDepartmentBL>().DeleteDepartment(entityObject));
 }
Esempio n. 8
0
 public VinaGerman.Entity.BusinessEntity.DepartmentEntity AddOrUpdateDepartment(VinaGerman.Entity.BusinessEntity.DepartmentEntity entityObject)
 {
     return(Factory.Resolve <IDepartmentBL>().AddOrUpdateDepartment(entityObject));
 }