Beispiel #1
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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public List <StoreToWorld> GetStoreWorldList(long storeid)
        {
            List <StoreToWorld> lst = _swController.GetListByStoreId(storeid);

            if (lst.Count == 0)
            {
                lst = ClientEnvironment.StoreToWorldService.FindAllForStore(storeid);
                _swController.AddList(lst);
            }
            return(lst);
        }
Beispiel #3
0
        private void SetStore(long storeid)
        {
            Domain.Store store = null;

            if (m_ListStores.TryGetValue(storeid, out store))
            {
                Domain.Region reg = null;
                if (m_listRegions.TryGetValue(store.RegionID, out reg))
                {
                    CountryId = reg.CountryID;
                    RegionId  = reg.ID;
                    StoreId   = storeid;
                    StoreWorldController sw = new StoreWorldController();
                    sw.LoadByStoreId(storeid);

                    storeWorldLookUpCtrl.EntityList = sw.GetListByStoreId(storeid);
                }
            }
        }
Beispiel #4
0
        private void SetStore(long storeid)
        {
            Domain.Store store = null;

            if (m_ListStores .TryGetValue (storeid, out store))
            {
                Domain.Region reg = null;
                if (m_listRegions.TryGetValue(store.RegionID, out reg))
                {
                    CountryId = reg.CountryID;
                    RegionId = reg.ID;
                    StoreId = storeid;
                    StoreWorldController sw = new StoreWorldController();
                    sw.LoadByStoreId(storeid);

                    storeWorldLookUpCtrl.EntityList = sw.GetListByStoreId(storeid);

                }
            }
        }