Пример #1
0
        public ConfigOptionPresenter(IUnityContainer container, IConfigOptionView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<ConfigOptionModel>();

            //Event Delegate
            View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch);
            View.New += new EventHandler<EventArgs>(this.OnNew);
            View.LoadData += new EventHandler<DataEventArgs<ConfigOptionByCompany>>(this.OnLoadData);
            View.Save += new EventHandler<EventArgs>(this.OnSave);
            View.Delete += new EventHandler<EventArgs>(this.OnDelete);
            View.FilterBy += new EventHandler<DataEventArgs<ConfigType>>(View_FilterBy);

            ProcessWindow pw = new ProcessWindow("Loading ...");

            if (App.curRol.Rol.RolID == BasicRol.Admin)
                View.Model.EntityList = service.GetConfigOptionByCompany(new ConfigOptionByCompany { Company = App.curCompany });
            else
                View.Model.EntityList = service.GetConfigOptionByCompany(new ConfigOptionByCompany { Company = App.curCompany })
                    .Where(f => f.ConfigOption.IsAdmin == true).ToList();
            
            View.Model.Record = null;

            View.Model.TypeList = service.GetConfigType(new ConfigType());
            View.Model.TypeList.Add(new ConfigType());

            //List Height
            View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250;

            pw.Close();

        }
Пример #2
0
        //Obtiene la configuracion del sistema y 
        public static Dictionary<string, string> GetConfigOptionValues()
        {
            WMSServiceClient service = new WMSServiceClient();

            IList<ConfigType> list = service.GetConfigType(new ConfigType());
            IList<ConfigOptionByCompany> listOptions;
            IList<ConfigOption> generalOptions;

            Dictionary<String, String> curInternal = new Dictionary<string, string>();

            foreach (ConfigType cType in list)
            {

                if (cType.ConfigTypeID == 1)
                {   //general {
                    generalOptions = service.GetConfigOption(new ConfigOption { ConfigType = new ConfigType { ConfigTypeID = 1 } });

                    foreach (ConfigOption option in generalOptions.Where(f => f.ConfigType.ConfigTypeID == cType.ConfigTypeID))
                        curInternal.Add(option.Code, option.DefValue);

                }
                else
                {
                    listOptions = service.GetConfigOptionByCompany(new ConfigOptionByCompany { Company = App.curCompany });

                    foreach (ConfigOptionByCompany option in listOptions.Where(f => f.ConfigOption.ConfigType.ConfigTypeID == cType.ConfigTypeID))
                        curInternal.Add(option.ConfigOption.Code, option.Value);
                }

            }

            //Configuracion de algunos defaults
            try { App.defTemplate = service.GetLabelTemplate(new LabelTemplate { RowID = int.Parse(curInternal["PROTEMPL"]) }).First(); }
            catch { }


            return curInternal;
        }