Exemple #1
0
        public override void Edit()
        {
            if (Context != null && FocusedEntity != null && Context.CurrentStore != null)
            {
                List <Domain.StoreToWorld> lst = null;
                lst = swController.GetListByStoreId(Context.CurrentStore.ID);

                if (lst.Count == 0)
                {
                    lst = ClientEnvironment.StoreToWorldService.FindAllForStore(Context.CurrentStore.ID);
                    swController.AddList(lst);
                }
                using (FormAssignEmployeeToWorld assignform = new FormAssignEmployeeToWorld())
                {
                    Domain.Employee empl = Context.CurrentEmployee;
                    Context.CurrentRelation = FocusedEntity;

                    assignform.SetWorldList(swController.GetListByStoreId(Context.CurrentStore.ID));
                    assignform.Entity = Context;



                    if (assignform.ShowDialog() == DialogResult.OK)
                    {
                        LoadEmployeeRelation();
                        //m_Relations.ResetItemById(Context.CurrentRelation.ID);
                    }
                }
            }
        }
Exemple #2
0
        public override void Add()
        {
            if (Context != null && FocusedEntity != null && Context.CurrentStore != null)
            {
                List <Domain.StoreToWorld> lst = null;
                lst = swController.GetListByStoreId(Context.CurrentStore.ID);

                if (lst.Count == 0)
                {
                    lst = ClientEnvironment.StoreToWorldService.FindAllForStore(Context.CurrentStore.ID);
                    swController.AddList(lst);
                }

                using (FormAssignEmployeeToWorld assignform = new FormAssignEmployeeToWorld())
                {
                    Domain.Employee empl = Context.CurrentEmployee;

                    EmployeeRelation relation = new EmployeeRelation();

                    relation.EmployeeID   = empl.ID;
                    relation.EmployeeName = empl.FullName;
                    relation.WorldID      = 0;

                    if (FocusedEntity != null)
                    {
                        relation.WorldID   = FocusedEntity.WorldID;
                        relation.BeginTime = FocusedEntity.BeginTime;
                        if (relation.BeginTime < DateTime.Today)
                        {
                            relation.BeginTime = DateTime.Today;
                        }
                        relation.EndTime = FocusedEntity.EndTime;
                        if (relation.BeginTime > relation.EndTime)
                        {
                            relation.EndTime = Contract.DateTimeSql.SmallDatetimeMax;
                        }
                    }

                    Context.CurrentRelation = relation;
                    assignform.SetWorldList(swController.GetListByStoreId(Context.CurrentStore.ID));
                    assignform.Entity = Context;



                    if (assignform.ShowDialog() == DialogResult.OK)
                    {
                        LoadEmployeeRelation();

                        if (Context.Relations != null)
                        {
                            Domain.Employee employee = ClientEnvironment.EmployeeService.GetEmployeeByID(empl.ID, DateTime.Now);
                            if (Context.EmployeeList != null && employee != null)
                            {
                                Context.EmployeeList.SetEntity(employee);
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        public void AssignToWorld()
        {
            if (EntityStore != null && FocusedEntity != null)
            {
                List <StoreToWorld> lst = GetStoreWorldList(EntityStore.ID);


                using (FormAssignEmployeeToWorld assignform = new FormAssignEmployeeToWorld())
                {
                    Domain.Employee empl = FocusedEntity;

                    Context.CurrentEmployee = empl;

                    EmployeeRelation relation = new EmployeeRelation();

                    relation.EmployeeID   = empl.ID;
                    relation.EmployeeName = empl.FullName;
                    relation.StoreID      = Context.CurrentStore.ID;
                    relation.WorldID      = empl.WorldID;
                    relation.BeginTime    = DateTime.Today;
                    relation.EndTime      = empl.ContractEnd;

                    if (IsDeligatedEmployee && empl.EndTime.HasValue)
                    {
                        relation.EndTime = empl.EndTime.Value;
                    }

                    Context.CurrentRelation = relation;

                    assignform.SetWorldList(_swController.GetListByStoreId(EntityStore.ID));

                    assignform.Entity = Context;

                    if (assignform.ShowDialog() == DialogResult.OK)
                    {
                        Domain.Employee employee =
                            ClientEnvironment.EmployeeService.GetEmployeeByID(empl.ID, DateTime.Today);
                        if (employee != null)
                        {
                            Context.EmployeeList.SetEntity(employee);
                        }
                    }
                }
            }
        }
        public override void Edit()
        {
            if (Context != null && FocusedEntity != null && Context.CurrentStore != null)
            {

                List<Domain.StoreToWorld> lst = null;
                lst = swController.GetListByStoreId(Context.CurrentStore.ID);

                if (lst.Count == 0)
                {
                    lst = ClientEnvironment.StoreToWorldService.FindAllForStore(Context.CurrentStore.ID);
                    swController.AddList(lst);
                }
                using (FormAssignEmployeeToWorld assignform = new FormAssignEmployeeToWorld())
                {
                    Domain.Employee empl = Context.CurrentEmployee;
                    Context.CurrentRelation = FocusedEntity;

                    assignform.SetWorldList(swController.GetListByStoreId(Context.CurrentStore.ID));
                    assignform.Entity = Context;

                    if (assignform.ShowDialog() == DialogResult.OK)
                    {
                        LoadEmployeeRelation();
                        //m_Relations.ResetItemById(Context.CurrentRelation.ID);
                    }
                }
            }
        }
        public override void Add()
        {
            if (Context != null && FocusedEntity != null && Context.CurrentStore !=null)
            {

                List<Domain.StoreToWorld> lst = null;
                lst = swController.GetListByStoreId(Context.CurrentStore.ID);

                if (lst.Count == 0)
                {
                    lst = ClientEnvironment.StoreToWorldService.FindAllForStore(Context.CurrentStore.ID);
                    swController.AddList(lst);
                }

                using (FormAssignEmployeeToWorld assignform = new FormAssignEmployeeToWorld())
                {
                    Domain.Employee empl = Context.CurrentEmployee;

                    EmployeeRelation relation = new EmployeeRelation();

                    relation.EmployeeID = empl.ID;
                    relation.EmployeeName = empl.FullName;
                    relation.WorldID = 0;

                    if (FocusedEntity != null)
                    {
                        relation.WorldID = FocusedEntity.WorldID;
                        relation.BeginTime = FocusedEntity.BeginTime;
                        if (relation.BeginTime < DateTime.Today) relation.BeginTime = DateTime.Today;
                        relation.EndTime = FocusedEntity.EndTime;
                        if (relation.BeginTime > relation.EndTime)
                            relation.EndTime = Contract.DateTimeSql.SmallDatetimeMax;

                    }

                    Context.CurrentRelation = relation;
                    assignform.SetWorldList(swController.GetListByStoreId(Context.CurrentStore.ID));
                    assignform.Entity = Context;

                    if (assignform.ShowDialog() == DialogResult.OK)
                    {
                        LoadEmployeeRelation();

                        if (Context.Relations != null)
                        {
                            Domain.Employee employee = ClientEnvironment.EmployeeService.GetEmployeeByID(empl.ID, DateTime.Now);
                            if (Context.EmployeeList != null && employee != null)
                            {
                                Context.EmployeeList.SetEntity(employee);
                            }
                        }
                    }
                }
            }
        }