private void ApartmentResidentBenefitPropertiesForm_Load(object sender, System.EventArgs e)
 {
     this.selectTypeEDK.Faset = FasetsEnum.TypeEDK;
     this.selectTypeEDK.RefreshValuesWithNull();
     this.selectTypeEDK.SelectedFasetItem = FasetItem.Null;
     this.tbFIO.set_Text(this.m_ApartmentResident.PersonName);
     ObjectList<Bank> list = new ObjectList<Bank> {
         Bank.Null
     };
     list.AddRange(Bank.FindAll());
     this.bsBank.set_DataSource(list);
     if (this.m_ApartmentResidentBenefitProperty == null)
     {
         this.btOK.set_Text("Добавить");
         this.set_Text("Добавление");
     }
     else
     {
         this.btOK.set_Text("Изменить");
         this.set_Text("Изменение");
         this.bsBank.set_Position(this.bsBank.Find("shortName", this.m_ApartmentResidentBenefitProperty.BankName));
         this.selectTypeEDK.SelectedFasetItem = this.m_ApartmentResidentBenefitProperty.GetKind();
         this.dbxFromDate.Value = this.m_ApartmentResidentBenefitProperty.FromDate;
         this.dbxCreated.Value = this.m_ApartmentResidentBenefitProperty.Created;
     }
 }
    /// <summary>
    /// 初期処理
    /// </summary>
    public void Initialize()
    {
        var list = GameObject.FindObjectsOfType <SceneStartEvent>();

        if (list.Length > 0)
        {
            ObjectList.AddRange(list);
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// Инициализация
 /// </summary>
 protected override void InitObjectList()
 {
     ObjectList.AddRange(new NsgMultipleObject[] { Авто.Метаданные.Сервис.DataAssemblyObject.Новый(),
                                                   Авто.Метаданные.Сервис.БазыДанныхДляОбмена.Новый(),
                                                   Авто.Метаданные.Сервис.ОбъектыОбмена.Новый(),
                                                   Авто.Метаданные.Сервис.ТипыОбмена.Новый(),
                                                   Авто.Метаданные.Сервис.ПравилаОбменаДанными.Новый(),
                                                   Авто.Метаданные.Сервис.ПротоколОбмена.Новый(),
                                                   Авто.Метаданные.Сервис.НастройкиКаналаОбмена.Новый(),
                                                   Авто.Метаданные.Сервис.ОбменДанными.Новый(),
                                                   Авто.Метаданные.Сервис.ИмпортДанных.Новый(),
                                                   Авто.Метаданные.Сервис.СервисноеОбслуживание.Новый(),
                                                   Авто.Метаданные.Сервис.СостоянияОбъекта.Новый(),
                                                   Авто.Метаданные.Сервис.ВидыДвижений.Новый(),
                                                   Авто.Метаданные.Сервис.ОбщийЖурнал.Новый(),
                                                   Авто.Метаданные.Сервис.НеактуальностьИтоговРегистров.Новый(),
                                                   Авто.Метаданные.Сервис.ПечатныеФормы.Новый(),
                                                   Авто.Метаданные._SystemTables.СервисПечатныеФормыДвижения.Новый(),
                                                   Авто.Метаданные.Сервис.КорректировкаРегистра.Новый(),
                                                   Авто.Метаданные._SystemTables.PeriodicTable.Новый(),
                                                   Авто.Метаданные.Сервис.ДействияПользователей.Новый(),
                                                   Авто.Метаданные.Сервис.азрешениеОперацииПользователя.Новый(),
                                                   Авто.Метаданные.Сервис.Пользователи.Новый(),
                                                   Авто.Метаданные._SystemTables.олиПользователя.Новый(),
                                                   Авто.Метаданные.Сервис.ТипСообщения.Новый(),
                                                   Авто.Метаданные.Сервис.СписокСообщений.Новый(),
                                                   Авто.Метаданные.Сервис.Приоритет.Новый(),
                                                   Авто.Метаданные.Сервис.ТипЗадачиНаСервере.Новый(),
                                                   Авто.Метаданные.Сервис.СервернаяЗадача.Новый(),
                                                   Авто.Метаданные.Сервис.НастройкиПользователей.Новый(),
                                                   Авто.Метаданные.Сервис.ПраваПользователей.Новый(),
                                                   Авто.Метаданные._SystemTables.СервисПраваПользователейДвижения.Новый(),
                                                   Авто.Метаданные.Сервис.ОбновленияСистемы.Новый(),
                                                   Авто.Метаданные.Сервис.ТаблицаРолиМенюПользователя.Новый(),
                                                   Авто.Метаданные.Сервис.ольПользователяМеню.Новый(),
                                                   Авто.Метаданные.Сервис.ДействиеЭлементаМеню.Новый(),
                                                   Авто.Метаданные.Сервис.ТаблицаЭлементаМенюПользователя.Новый(),
                                                   Авто.Метаданные.Сервис.ЭлементМенюПользователя.Новый(),
                                                   Авто.Метаданные.Автосервис.Номенклатура.Новый(),
                                                   Авто.Метаданные.Автосервис.Контрагенты.Новый(),
                                                   Авто.Метаданные.Автосервис.ПриходнаяНакладная.Новый(),
                                                   Авто.Метаданные._SystemTables.АвтосервисПриходнаяНакладнаяТаблица.Новый(),
                                                   Авто.Метаданные._SystemTables.АвтосервисРасходнаяНакладнаяТаблица.Новый(),
                                                   Авто.Метаданные.Автосервис.асходнаяНакладная.Новый(),
                                                   Авто.Метаданные.Автосервис.Заполнение.Новый(),
                                                   Авто.Метаданные.Банк.Валюты.Новый(),
                                                   Авто.Метаданные.Банк.ИсторияКурсов.Новый(),
                                                   Авто.Метаданные.Банк.ЗаполнениеКурса.Новый() });
 }
Exemplo n.º 4
0
 public ObjectList<Area> GetSelectedAreas()
 {
     ObjectList<Area> list = new ObjectList<Area>();
     foreach (System.Windows.Forms.TreeNode node in base.SelectedNodes)
     {
         if (node.Parent == null)
         {
             list.AddRange(((AreaGroup) node.get_Tag()).GetAreas());
         }
         else
         {
             list.Add((Area) node.get_Tag());
         }
     }
     return list;
 }
        /// <summary>
        /// Return an IEnumerable providing data for use with the
        /// supplied parameter.
        /// </summary>
        /// <param name="parameter">A ParameterInfo representing one
        /// argument to a parameterized test</param>
        /// <returns>
        /// An IEnumerable providing the required data
        /// </returns>
        public System.Collections.IEnumerable GetDataFor(System.Reflection.ParameterInfo parameter)
        {
            ObjectList datapoints = new ObjectList();

            Type parameterType = parameter.ParameterType;
            Type fixtureType = parameter.Member.ReflectedType;

            foreach (MemberInfo member in fixtureType.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
            {
                if (member.IsDefined(typeof(DatapointAttribute), true))
                {
                    if (GetTypeFromMemberInfo(member) == parameterType &&
                        member.MemberType == MemberTypes.Field)
                    {
                        FieldInfo field = member as FieldInfo;
                        if (field.IsStatic)
                            datapoints.Add(field.GetValue(null));
                        else
                            datapoints.Add(field.GetValue(ProviderCache.GetInstanceOf(fixtureType)));
                    }
                }
                else if (member.IsDefined(typeof(DatapointSourceAttribute), true))
                {
                    if (GetElementTypeFromMemberInfo(member) == parameterType)
                    {
                        object instance;

                        switch(member.MemberType)
                        {
                            case MemberTypes.Field:
                                FieldInfo field = member as FieldInfo;
                                instance = field.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                                foreach (object data in (IEnumerable)field.GetValue(instance))
                                    datapoints.Add(data);
                                break;
                            case MemberTypes.Property:
                                PropertyInfo property = member as PropertyInfo;
                                MethodInfo getMethod = property.GetGetMethod(true);
                                instance = getMethod.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                                foreach (object data in (IEnumerable)property.GetValue(instance,null))
                                    datapoints.Add(data);
                                break;
                            case MemberTypes.Method:
                                MethodInfo method = member as MethodInfo;
                                instance = method.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                                foreach (object data in (IEnumerable)method.Invoke(instance, new Type[0]))
                                    datapoints.Add(data);
                                break;
                        }
                    }
                }
            }

            if (datapoints.Count == 0)
            {
                if (parameterType == typeof(bool))
                {
                    datapoints.Add(true);
                    datapoints.Add(false);
                }
                else if (parameterType.IsEnum)
                {
                    datapoints.AddRange(TypeHelper.GetEnumValues(parameterType));
                }
            }

            return datapoints;
        }
Exemplo n.º 6
0
 private void ExchangeForm_Load(object sender, System.EventArgs e)
 {
     if (!base.get_DesignMode())
     {
         bool flag;
         System.Windows.Forms.Cursor.set_Current(System.Windows.Forms.Cursors.WaitCursor);
         this.ReloadItems(this, null);
         System.Windows.Forms.Cursor.set_Current(System.Windows.Forms.Cursors.Default);
         this.exchangeRequestAddressView.set_Dock(System.Windows.Forms.DockStyle.Fill);
         this.spravkaLsView.set_Dock(System.Windows.Forms.DockStyle.Fill);
         this.lgExchangeView.set_Dock(System.Windows.Forms.DockStyle.Fill);
         this.counterChangeView.set_Dock(System.Windows.Forms.DockStyle.Fill);
         string valueByName = Setting.GetValueByName("Интерфейсы", "Название адресной группы для фильтра в окне Запросы");
         AreaGroup @null = AreaGroup.Null;
         if (!string.IsNullOrEmpty(valueByName) && (valueByName != Setting.Null.Value))
         {
             @null = AreaGroup.GetByName(valueByName);
             ObjectList<Area> list = new ObjectList<Area>();
             Area.Null.Name = Constants.ObjectNotChoosedCaption;
             list.Add(Area.Null);
             list.AddRange(@null.GetAreas());
             this.bsAreas.set_DataSource(list);
         }
         if (@null == AreaGroup.Null)
         {
             this.lblAreaGroup.set_Enabled(false);
             this.cbxAddressGroup.set_Enabled(false);
             this.bsAreas.set_DataSource(null);
         }
         this.lblAreaGroup.set_Enabled(flag = (bool) (this.tabControl.SelectedTab == this.tpPassporter));
         this.cbxAddressGroup.set_Enabled(flag);
     }
 }
Exemplo n.º 7
0
 private void CashPaymentForm_Load(object sender, System.EventArgs e)
 {
     if (!Manager.DesignMode)
     {
         ObjectList<DebtAction> list = new ObjectList<DebtAction>();
         list = Mappers.DebtActionMapper.FindByAccountId(this.m_Account.Id);
         if (list.get_Count() > 0)
         {
             ObjectList<DebtAction> list2 = new ObjectList<DebtAction> {
                 DebtAction.Null
             };
             list2.AddRange(list);
             this.cbActions.set_DataSource(list2);
         }
         else
         {
             this.tableLayoutPanel1.Controls.Remove(this.cbActions);
             this.tableLayoutPanel1.SetRowSpan(this.dataGridView1, (int) (this.tableLayoutPanel1.GetRowSpan(this.dataGridView1) + 1));
         }
         if (User.IsMemberOf(RightsEnum.АРМКассирОплатаВозможностьУстанавливатьДатуОплаты))
         {
             this.tpDatePayment.set_Enabled(true);
         }
         else
         {
             this.tpDatePayment.set_Enabled(false);
         }
         base.SuspendLayout();
         this.set_Font(Manager.WindowFont);
         this.m_PeriodsSource.set_DataSource(Mappers.CalcPeriodMapper.FindAll());
         this.m_PeriodsSource.set_Position(1);
         ObjectList<Organization> serviceHouseHolders = this.m_Account.GetServiceHouseHolders();
         serviceHouseHolders.Insert(0, Organization.Null);
         this.m_HouseHoldersSource.set_DataSource(serviceHouseHolders);
         this.m_HouseHoldersSource.set_Position(this.m_HouseHoldersSource.IndexOf(Organization.Null));
         this.m_Request = new PayRequest();
         this.m_Request.PaymentSystem = PayRequest.LocalPaymentSystem;
         this.m_Request.Organization = Constants.OrgName;
         this.m_Request.Office = "";
         this.m_Request.Terminal = Settings.Default.CashierTerminal;
         this.m_Request.Operator = User.CurrentUser.Name;
         this.m_Request.AccountNumber = this.m_Account.Number;
         this.m_Request.IsManualReturn = Settings.Default.CashierReturnMode;
         this.m_Request.CashFlowTypeId = Settings.Default.CashierCashFlowType;
         if (this.m_BarCode != string.Empty)
         {
             this.m_Request.IsByNotice = true;
             this.m_PayRequestCounters.set_DataSource(this.m_Request.GetRequestCounters());
         }
         else
         {
             this.tab.TabPages.Remove(this.tpCounters);
         }
         this.m_Request.UseBankrupt = this.chbxUseAccountServiceBankrupts.get_Checked();
         this.m_Request.NeedServiceCollapse = Settings.Default.NeedServiceCollapse;
         this.m_Request.PaymentDate = this.m_PaymentDate;
         this.m_Request.UsePaymentDate = Settings.Default.UsePaymentOrderDateForProcessPayment;
         this.m_Request.CashPaymentOrderType = this.m_CashPaymentOrderType;
         this.m_Request.SubService = this.m_subService;
         this.m_Request.PaymentOrderPackId = this.m_PaymentOrderPackId;
         this.m_Request.SaveChanges();
         this.MakeRequest();
         if (Settings.Default.CashierReturnMode)
         {
             this.m_PaymentButton.set_ForeColor(System.Drawing.Color.Red);
             this.m_PaymentButton.set_Font(new System.Drawing.Font(this.m_PaymentButton.Font, System.Drawing.FontStyle.Bold));
             this.m_PaymentButton.set_Text("&ВОЗВРАТ");
             this.m_OneSummPaymentCheckBox.set_Text("Возвращается");
         }
         this.selectDataGridViewTextBoxColumn.set_Visible(Settings.Default.CachierCanExcludeServiceFromPayment);
         if (Setting.GetValueByName("Интерфейсы", "АРМ Кассир. Учитывать невозвратные долги по умолчанию").ToUpper() != "ДА")
         {
             this.chbxUseAccountServiceBankrupts.set_Checked(false);
         }
         base.ResumeLayout();
     }
 }
Exemplo n.º 8
0
 private void PaymentReportByJournal_Load(object sender, System.EventArgs e)
 {
     this.set_Font(Manager.WindowFont);
     base.m_Period.DateBegin = System.DateTime.Now;
     base.m_Period.DateEnd = System.DateTime.Now;
     this.sfdPaymentType.Faset = FasetsEnum.PaymentAgentType;
     this.sfdPaymentType.Items.Add(FasetItem.Null);
     this.sfdPaymentType.RefreshValuesWithNull();
     this.sfdPaymentType.SelectedFasetItem = FasetItem.FindById(Settings.Default.CashierCashFlowType);
     ObjectList<PayTerminals> list = new ObjectList<PayTerminals> {
         PayTerminals.Null
     };
     list.AddRange(Mappers.PayTerminalMapper.FindAll());
     list.ApplySort("Name");
     this.m_CashierTerminalNumber.set_DataSource(list);
     ObjectList<User> list2 = new ObjectList<User> {
         User.Null
     };
     list2.AddRange(User.FindAll());
     list2.ApplySort("Name");
     this.bsUsers.set_DataSource(list2);
     this.bsUsers.set_Position(this.bsUsers.IndexOf(User.GetCurrentUser()));
     if (!User.IsMemberOf(RightsEnum.ПросмотрВАРМКассирВсехПлатежей))
     {
         this.cbUser.set_Enabled(false);
     }
     else
     {
         this.cbUser.set_Enabled(true);
     }
 }
Exemplo n.º 9
0
 public void RefreshAddress()
 {
     this.bsCity.SuspendBinding();
     ObjectList<LocalAddress> list = new ObjectList<LocalAddress>();
     ObjectList<LocalAddress> list2 = Mappers.LocalAddressMapper.FindAddressByCurrentLevel(AddressLevel.MinAddress);
     if (list2.get_Count() == 1)
     {
         list.AddRange(list2);
         list.Add(LocalAddress.Null);
     }
     else
     {
         list.Add(LocalAddress.Null);
         list.AddRange(list2);
     }
     this.bsCity.set_DataSource(list);
     int index = this.bsCity.IndexOf(LocalAddress.Null);
     this.bsCity.ResumeBinding();
     this.bsCity.set_Position((this.bsCity.get_Count() == 2) ? ((int) 0) : index);
 }
Exemplo n.º 10
0
 private ObjectList<LocalAddress> GetChildrenByLevel(AddressLevel lvl)
 {
     if (base.Level > lvl)
     {
         return null;
     }
     ObjectList<LocalAddress> list = new ObjectList<LocalAddress>();
     if (base.Level == lvl)
     {
         list.Add(this);
         return list;
     }
     foreach (LocalAddress address in this.GetChildren())
     {
         list.AddRange(address.GetChildrenByLevel(lvl));
     }
     return list;
 }
Exemplo n.º 11
0
 public static ObjectList<LocalAddress> GetRelationsByLevel(ObjectList<LocalAddress> addresses, AddressLevel lvl)
 {
     ObjectList<LocalAddress> list = new ObjectList<LocalAddress>();
     foreach (LocalAddress address in addresses)
     {
         LocalAddress parentByLevel = address.GetParentByLevel(lvl);
         if ((parentByLevel == Null) || (parentByLevel == null))
         {
             list.AddRange(address.GetChildrenByLevel(lvl));
         }
         else if (!list.Contains(parentByLevel))
         {
             list.Add(parentByLevel);
         }
     }
     return list;
 }
Exemplo n.º 12
0
        private void LocalAddressSelector_Load(object sender, System.EventArgs e)
        {
            if (!Manager.DesignMode)
            {
                this.bsCity.SuspendBinding();
                ObjectList<LocalAddress> list = new ObjectList<LocalAddress>();
                ObjectList<LocalAddress> list2 = Mappers.LocalAddressMapper.FindAddressByCurrentLevel(AddressLevel.MinAddress);
                if (list2.get_Count() == 1)
                {
                    list.AddRange(list2);
                    list.Add(LocalAddress.Null);
                }
                else
                {
                    list.Add(LocalAddress.Null);
                    list.AddRange(list2);
                }
                this.bsCity.set_DataSource(list);
                int index = this.bsCity.IndexOf(LocalAddress.Null);
                this.bsCity.ResumeBinding();
                this.bsCity.set_Position((this.bsCity.get_Count() == 2) ? ((int) 0) : index);
                switch (LocalAddress.FirstSignificantLevel)
                {
                    case AddressLevel.None:
                    case AddressLevel.MinAddress:
                    case AddressLevel.Жилье:
                        break;

                    case AddressLevel.Улица:
                        this.m_CityLabel.set_Visible(false);
                        this.m_CityBox.set_Visible(false);
                        break;

                    case AddressLevel.Дом:
                        this.m_CityLabel.set_Visible(false);
                        this.m_CityBox.set_Visible(false);
                        this.m_StreetLabel.set_Visible(false);
                        this.m_StreetBox.set_Visible(false);
                        break;

                    case AddressLevel.MaxAddress:
                        this.m_CityLabel.set_Visible(false);
                        this.m_CityBox.set_Visible(false);
                        this.m_StreetLabel.set_Visible(false);
                        this.m_StreetBox.set_Visible(false);
                        break;

                    default:
                        throw new System.ArgumentOutOfRangeException();
                }
                this.OnResize(System.EventArgs.Empty);
            }
        }
Exemplo n.º 13
0
 private static void LoadChildren(System.Windows.Forms.BindingSource parentBS, System.Windows.Forms.BindingSource childBS)
 {
     if (!parentBS.get_IsBindingSuspended())
     {
         LocalAddress parent = parentBS.get_Current() as LocalAddress;
         if (parent != null)
         {
             childBS.SuspendBinding();
             if (parent == LocalAddress.Null)
             {
                 childBS.Clear();
                 childBS.Add(LocalAddress.Null);
             }
             else
             {
                 ObjectList<LocalAddress> list = new ObjectList<LocalAddress>();
                 ObjectList<LocalAddress> children = Mappers.LocalAddressMapper.GetChildren(parent);
                 if (children.get_Count() == 1)
                 {
                     list.AddRange(children);
                     list.Add(LocalAddress.Null);
                 }
                 else
                 {
                     list.Add(LocalAddress.Null);
                     list.AddRange(children);
                 }
                 childBS.set_DataSource(list);
             }
             int index = childBS.IndexOf(LocalAddress.Null);
             childBS.ResumeBinding();
             childBS.set_Position(((childBS.get_Count() == 2) && !((LocalAddress) childBS.get_Item(0)).Name.Equals(string.Empty)) ? ((int) 0) : index);
         }
     }
 }
Exemplo n.º 14
0
 private void tsbtnLoadByHolders_Click(object sender, System.EventArgs e)
 {
     if ((this.selectHouseHolders.SelectedOrganizations.get_Count() == 0) && (this.tabControlOrgs.SelectedTab == this.tpOrganizations))
     {
         Messages.ShowMessage("Выберите УК");
     }
     else
     {
         if (this.tabControlOrgs.SelectedTab == this.tpOrganizations)
         {
             this.orgs = this.selectHouseHolders.SelectedOrganizations;
             ObjectList<LocalAddress> byHouseHolders = LocalAddress.GetByHouseHolders(this.orgs);
             this.areaAddressesTree.Load(byHouseHolders, false);
         }
         if (this.tabControlOrgs.SelectedTab == this.tpAreaGroups)
         {
             ObjectList<Area> selectedAreas = this.areaGroupsTree.GetSelectedAreas();
             if (selectedAreas.get_Count() > 0)
             {
                 ObjectList<LocalAddress> localAddresses = new ObjectList<LocalAddress>();
                 foreach (Area area in selectedAreas)
                 {
                     localAddresses.AddRange(area.GetAddresses());
                 }
                 this.areaAddressesTree.Load(localAddresses, false);
             }
             else
             {
                 this.areaAddressesTree.Load();
             }
         }
         this.tsbtnLoadAll.set_ForeColor(System.Drawing.Color.Black);
         this.tsbtnLoadByHolders.set_ForeColor(System.Drawing.Color.Blue);
     }
 }
 private void AddChangeHouseServiceForm_Load(object sender, System.EventArgs e)
 {
     this.set_Font(Manager.WindowFont);
     ObjectList<ServiceType> list = new ObjectList<ServiceType> {
         ServiceType.Null
     };
     list.AddRange(ServiceType.FindAll());
     this.bsServiceTypes.set_DataSource(list);
     if (this.m_House != House.Null)
     {
         this.houseSelector.SelectAddressHouse(this.m_House.Id);
     }
     if (this.m_HouseHouseHolder != HouseHouseHolder.Null)
     {
         this.houseHolderSelector.SelectedOrganization = Organization.FindById(this.m_HouseHouseHolder.HouseHolderId);
         this.dbFromDate.Value = this.m_HouseHouseHolder.FromDate;
         this.dbToDate.Value = this.m_HouseHouseHolder.ToDate;
     }
 }
        /// <summary>
        /// Return an IEnumerable providing data for use with the
        /// supplied parameter.
        /// </summary>
        /// <param name="parameter">A ParameterInfo representing one
        /// argument to a parameterized test</param>
        /// <returns>
        /// An IEnumerable providing the required data
        /// </returns>
        public System.Collections.IEnumerable GetDataFor(System.Reflection.ParameterInfo parameter)
        {
            ObjectList datapoints = new ObjectList();

            Type parameterType = parameter.ParameterType;
            Type fixtureType   = parameter.Member.ReflectedType;

            foreach (MemberInfo member in fixtureType.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
            {
                if (member.IsDefined(typeof(DatapointAttribute), true))
                {
#if PORTABLE
                    bool isField = member is FieldInfo;
#else
                    bool isField = member.MemberType == MemberTypes.Field;
#endif
                    if (GetTypeFromMemberInfo(member) == parameterType && isField)
                    {
                        FieldInfo field = member as FieldInfo;
                        if (field.IsStatic)
                        {
                            datapoints.Add(field.GetValue(null));
                        }
                        else
                        {
                            datapoints.Add(field.GetValue(ProviderCache.GetInstanceOf(fixtureType)));
                        }
                    }
                }
                else if (member.IsDefined(typeof(DatapointSourceAttribute), true))
                {
                    if (GetElementTypeFromMemberInfo(member) == parameterType)
                    {
                        object instance;

#if PORTABLE
                        if (member is FieldInfo)
                        {
                            FieldInfo field = member as FieldInfo;
                            instance = field.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                            foreach (object data in (IEnumerable)field.GetValue(instance))
                            {
                                datapoints.Add(data);
                            }
                        }
                        else if (member is PropertyInfo)
                        {
                            PropertyInfo property  = member as PropertyInfo;
                            MethodInfo   getMethod = property.GetGetMethod(true);
                            instance = getMethod.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                            foreach (object data in (IEnumerable)property.GetValue(instance, null))
                            {
                                datapoints.Add(data);
                            }
                        }
                        else if (member is MethodInfo)
                        {
                            MethodInfo method = member as MethodInfo;
                            instance = method.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                            foreach (object data in (IEnumerable)method.Invoke(instance, new Type[0]))
                            {
                                datapoints.Add(data);
                            }
                        }
#else
                        switch (member.MemberType)
                        {
                        case MemberTypes.Field:
                            FieldInfo field = member as FieldInfo;
                            instance = field.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                            foreach (object data in (IEnumerable)field.GetValue(instance))
                            {
                                datapoints.Add(data);
                            }
                            break;

                        case MemberTypes.Property:
                            PropertyInfo property  = member as PropertyInfo;
                            MethodInfo   getMethod = property.GetGetMethod(true);
                            instance = getMethod.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                            foreach (object data in (IEnumerable)property.GetValue(instance, null))
                            {
                                datapoints.Add(data);
                            }
                            break;

                        case MemberTypes.Method:
                            MethodInfo method = member as MethodInfo;
                            instance = method.IsStatic ? null : ProviderCache.GetInstanceOf(fixtureType);
                            foreach (object data in (IEnumerable)method.Invoke(instance, new Type[0]))
                            {
                                datapoints.Add(data);
                            }
                            break;
                        }
#endif
                    }
                }
            }

            if (datapoints.Count == 0)
            {
                if (parameterType == typeof(bool))
                {
                    datapoints.Add(true);
                    datapoints.Add(false);
                }
                else if (parameterType.IsEnum)
                {
                    datapoints.AddRange(TypeHelper.GetEnumValues(parameterType));
                }
            }

            return(datapoints);
        }
Exemplo n.º 17
0
 private void AddBenefitForm_Load(object sender, System.EventArgs e)
 {
     this.set_Font(Manager.WindowFont);
     this.bsOrganizations.SuspendBinding();
     ObjectList<Organization> list = new ObjectList<Organization> {
         Organization.Null
     };
     list.AddRange(Organization.FindBenefitTransferrer());
     this.bsOrganizations.set_DataSource(list);
     this.bsOrganizations.set_Position(this.bsOrganizations.IndexOf(Organization.Null));
     this.bsOrganizations.ResumeBinding();
     this.bsLaw.set_DataSource(Mappers.LawMapper.FindAll());
     this.selectCalcFeature.Faset = FasetsEnum.CalcFeature;
     this.selectCalcFeature.RefreshValuesWithNull();
     if ((this.benefit != Benefit.Null) && (this.benefit != null))
     {
         try
         {
             this.selectCalcFeature.set_SelectedItem(this.benefit.GetCalcFeature());
         }
         catch (System.Exception)
         {
         }
         foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvLaw.Rows)
         {
             if (row.Cells.get_Item("Id").get_Value().ToString() == ((long) this.benefit.LawId).ToString())
             {
                 row.set_Selected(true);
                 this.bsLaw.set_Position(this.bsLaw.Find("Id", row.Cells.get_Item("Id").get_Value()));
                 break;
             }
         }
         this.dateBoxMonetization.Value = this.benefit.MonetizationDate;
     }
 }