public ObjectList<AccountService> GetSelectAccountServices()
 {
     ObjectList<AccountService> list = new ObjectList<AccountService>();
     foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvAccountServices.Rows)
     {
         if ((row.Cells.get_Item(0).get_Value() != null) && ((bool) row.Cells.get_Item(0).get_Value()))
         {
             list.Add((AccountService) row.get_DataBoundItem());
         }
     }
     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 IEnumerable GetDataFor(ParameterInfo parameter)
        {
            ObjectList data = new ObjectList();

            foreach (Attribute attr in parameter.GetCustomAttributes(typeof(DataAttribute), false))
            {
                IParameterDataSource source = attr as IParameterDataSource;
                if (source != null)
                    foreach (object item in source.GetData(parameter))
                        data.Add(item);
            }

            return data;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check that all items are unique.
        /// </summary>
        /// <param name="actual"></param>
        /// <returns></returns>
        protected override bool doMatch(IEnumerable actual)
        {
            ObjectList list = new ObjectList();

            foreach (object o1 in actual)
            {
                foreach (object o2 in list)
                    if (ItemsEqual(o1, o2))
                        return false;
                list.Add(o1);
            }

            return true;
        }
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;
 }
Exemplo n.º 5
0
		/// <summary>
		/// Produces a collection containing all the values of a property
		/// </summary>
		/// <param name="name">The collection of property values</param>
		/// <returns></returns>
		public ICollection Property( string name )
		{
			ObjectList propList = new ObjectList();
			foreach( object item in original )
			{
				PropertyInfo property = item.GetType().GetProperty( name, 
					BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
				if ( property == null )
					throw new ArgumentException( string.Format(
						"{0} does not have a {1} property", item, name ) );

				propList.Add( property.GetValue( item, null ) );
			}

			return propList;
		}
Exemplo n.º 6
0
        public void UpdateOrder(OrderFormView order)
        {
            var list = ObjectList.Where(c => c.OrderFormViewId == order.id).AsEnumerable();

            if (list != null)
            {
                foreach (var obj in list)
                {
                    Entry(obj).State = EntityState.Deleted;
                }
            }

            foreach (var obj in order.obj_list)
            {
                ObjectList.Add(obj);
            }

            Entry(order).State = EntityState.Modified;
            SaveChanges();
        }
        public IEnumerable GetDataFor(ParameterInfo parameter)
        {
            ObjectList objectList = new ObjectList();

            object[] customAttributes = parameter.GetCustomAttributes(typeof(DataAttribute), inherit: false);
            for (int i = 0; i < customAttributes.Length; i++)
            {
                Attribute            attribute           = (Attribute)customAttributes[i];
                IParameterDataSource parameterDataSource = attribute as IParameterDataSource;
                if (parameterDataSource == null)
                {
                    continue;
                }
                foreach (object datum in parameterDataSource.GetData(parameter))
                {
                    objectList.Add(datum);
                }
            }
            return(objectList);
        }
Exemplo n.º 8
0
    public void DuplicateObject()
    {
        bool    downLeftset = false;
        Vector2 downLeft    = Vector2.zero;
        Vector2 oldDownLeft = Vector2.zero;
        Vector2 translate   = Vector2.zero;

        for (int i = ObjectList.Count - 1; i >= 0; i--)
        {
            ScalableObject currentObject = ObjectList[i];
            if (currentObject.Selected)
            {
                if (!downLeftset)
                {
                    oldDownLeft = currentObject.DownLeftAnchor;
                    downLeft    = new Vector2(currentObject.Width() / 2f, currentObject.Height() / 2f) - Vector2.zero;
                    translate   = downLeft;
                    downLeftset = true;
                }
                else
                {
                    translate  = downLeft;
                    translate += oldDownLeft;
                    translate -= currentObject.DownLeftAnchor;
                }

                GameObject     newPathObject = GameObject.Instantiate(currentObject.gameObject, _prefabParent);
                ScalableObject dublicate     = newPathObject.GetComponent <ScalableObject>();
                dublicate.Clone(currentObject, translate);

                newObjects.Add(dublicate);
            }
        }

        foreach (var item in newObjects)
        {
            ObjectList.Add(item);
        }
        newObjects.Clear();
        SortObjectList();
    }
        private void Search(string searchedWord)
        {
            searchedWord = searchedWord.ToLower();
            int wordLength = searchedWord.Length;

            PatientItemList = new ObjectList <PatientListItemViewModel>(false);
            var patientsToDisplay = patientsList.Where(item => item.PatientName.Length >= wordLength && item.PatientName.ToLower().Substring(0, wordLength) == searchedWord);//item => item.PatientName.ToLower().Contains(searchedWord));

            foreach (var patientListItemViewModel in patientsToDisplay)
            {
                PatientItemList.Add(patientListItemViewModel);
            }
            var toSelect = PatientItemList.List.FirstOrDefault();

            if (toSelect != null)
            {
                toSelect.OnSelected(toSelect);
            }
            // CurrentPatients = new ObservableCollection<LocalPatient>(PatientsList.Where(item => item.Name.Length >= wordLength && item.Name.ToLower().Substring(0, wordLength) == searchedWord));
            // SelectedPatient = CurrentPatients.FirstOrDefault();
        }
Exemplo n.º 10
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            Line_beizhu obj = new Line_beizhu();

            obj.L6 = DateTime.Now;

            //执行添加操作
            using (FrmLine_InfoDialog_beizhu dlg = new FrmLine_InfoDialog_beizhu())
            {
                if (gridControl.DataSource != null)
                {
                    dlg.LIST = (IList <Line_beizhu>)gridControl.DataSource;
                }

                dlg.Type  = types1;
                dlg.Flag  = flags1;
                dlg.Type2 = types2;
                // dlg.ctrlLint_beizhu = this;

                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.bandedGridView2, obj);
        }
Exemplo n.º 11
0
        protected override void AdaptApp()
        {
            var asm      = typeof(Xamarin.Forms.View).Assembly;
            var typeinfo = typeof(Xamarin.Forms.TypeConverter).GetTypeInfo();

            TypeConverters = (from klass in asm.DefinedTypes
                              where typeinfo.IsAssignableFrom(klass) && !klass.IsInterface && !klass.IsAbstract
                              select new KeyValuePair <string, TypeConverter>(klass.Name, Activator.CreateInstance(klass) as TypeConverter))
                             .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            Xamarin.Forms.Forms.ViewInitialized += (s, e) =>
            {
                if (e.View is Page p)
                {
                    p.Appearing += (ss, ee) =>
                    {
                        p.SetIsShownProperty(true);
                    };

                    p.Disappearing += (ss, ee) =>
                    {
                        p.SetIsShownProperty(false);
                    };
                }

                e.View.PropertyChanged += (ss, ee) =>
                {
                    if ((ee.PropertyName == "Renderer") && (Platform.GetRenderer((BindableObject)ss) == null))
                    {
                        ObjectList.RemoveById(e.View.GetId());
                    }
                };
                ObjectList.Add(e.View);

                if ((e.View is ListView) || (e.View is TableView))
                {
                    AddItemFromList(e.View);
                }
            };
        }
Exemplo n.º 12
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            string guid = Guid.NewGuid().ToString();

            Project obj = new Project();

            obj.UID              = guid.Substring(0, 8);
            obj.CreateDate       = DateTime.Now;
            obj.StartDate        = DateTime.Now.Date;
            obj.PlanCompleteDate = DateTime.Now;
            obj.CompleteDate     = DateTime.Now;
            obj.QualityDate      = DateTime.Now;
            obj.BecomeEffective  = DateTime.Now;
            obj.GuiDangTime      = DateTime.Now;
            obj.GuiDangName      = Itop.Client.MIS.UserNumber;

            //执行添加操作
            using (FrmProjectDialog dlg = new FrmProjectDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            Itop.Client.Projects.Common.GridHelper.FocuseRow(this.gridView, obj);
        }
Exemplo n.º 13
0
        /*public async Task UpdateObject(JdObject obj)
         * {
         * var parameters = new Parameters();
         * parameters.object_id = obj.Id;
         * var jsonrpc = new JsonRpcClient(parameters);
         *
         * if (await jsonrpc.SendRequest("eqLogic::byObjectId"))
         * {
         * var response = jsonrpc.GetRequestResponseDeserialized<Response<ObservableCollection<EqLogic>>>();
         * if (response.result != null)
         * {
         *  foreach (EqLogic eqnew in response.result)
         *  {
         *      var lst = from e in EqLogicList where e.Id == eqnew.Id select e;
         *      if (lst.Count() != 0)
         *      {
         *          var eqold = lst.FirstOrDefault();
         *          eqnew.Cmds = eqold.Cmds;
         *          eqold = eqnew;
         *      }
         *      else
         *      {
         *          EqLogicList.Add(eqnew);
         *          obj.EqLogics.Add(eqnew);
         *      }
         *      await UpdateEqLogic(eqnew);
         *  }
         * }
         * }
         * }*/

        public async Task UpdateObjectList()
        {
            var jsonrpc = new JsonRpcClient();

            if (await jsonrpc.SendRequest("object::all"))
            {
                var response = jsonrpc.GetRequestResponseDeserialized <Response <ObservableCollection <JeedomObject> > >();
                foreach (JeedomObject obj in response.result)
                {
                    var lst = from o in ObjectList where o.id == obj.id select o;
                    if (lst.Count() != 0)
                    {
                        var ob = lst.FirstOrDefault();
                        ob = obj;
                    }
                    else
                    {
                        ObjectList.Add(obj);
                    }
                }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            PSP_PowerSubstationInfo obj = new PSP_PowerSubstationInfo();

            obj.Flag       = flags1;
            obj.CreateDate = DateTime.Now;

            //执行添加操作
            using (FrmPSP_PowerDialog dlg = new FrmPSP_PowerDialog())
            {
                //dlg.Text = "";
                //dlg.Type = types1;
                dlg.Flag  = flags1;
                dlg.Type2 = types2;
                dlg.ctrlPSP_PowerSubstationInfo = this;
                dlg.Text     = this.text;
                dlg.IsCreate = true;    //设置新建标志
                dlg.Object   = obj;
                dlg.rowTitle.Properties.Caption     = this.colTitle.Caption;
                dlg.rowPowerName.Properties.Caption = this.colPowerName.Caption;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView1, obj);
        }
Exemplo n.º 15
0
        //通过树状结构子属性名把列表转换成通用对象列表
        public static BaseObjectList ToList(object list, string childPropertyName)
        {
            //只有枚举对象才可以转换成通用对象
            if (!(list is IEnumerable))
            {
                throw new Exception("非枚举对象无法转换成对象列表:");
            }
            BaseObjectList result = new ObjectList();

            foreach (GeneralObject go in (IEnumerable)list)
            {
                BaseObjectList bol = (BaseObjectList)go.GetPropertyValue(childPropertyName);
                if (bol != null)
                {
                    foreach (GeneralObject cgo in bol)
                    {
                        result.Add(cgo);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 16
0
        public void ShouldCreateAndEmptyBigUserObjectList()
        {
            ObjectList <User> list = new ObjectList <User>();

            User[] users = new User[10000];

            for (int k = 0; k < users.Length; k++)
            {
                users[k] = new User("user" + k);
                list.Add(users[k]);
            }

            Assert.IsNotNull(list);
            Assert.AreEqual(users.Length, list.Count);

            foreach (User user in list.Elements)
            {
                list.Remove(user);
            }

            Assert.AreEqual(0, list.Count);
        }
Exemplo n.º 17
0
        //private IList<PSP_PlanTable_HuaiBei> tablelist(DataSet ds)
        //{
        //    PSP_PlanTable_HuaiBei t = default(PSP_PlanTable_HuaiBei);
        //    ds.Tables[0].TableName = typeof(T).Name;
        //    string str = ds.GetXml();
        //    XmlDocument xd = new XmlDocument();
        //    xd.LoadXml(str);
        //    XmlNodeList xls = xd.SelectNodes("/" + typeof(PSP_PlanTable_HuaiBei).Name.ToString() + "s/" + typeof(PSP_PlanTable_HuaiBei).Name.ToString());
        //    IList<PSP_PlanTable_HuaiBei> ts = new List<PSP_PlanTable_HuaiBei>();
        //    foreach (XmlNode xn in xls)
        //    {
        //        string str1 = xn.OuterXml;
        //        System.Xml.Serialization.XmlSerializer xms = new XmlSerializer(typeof(PSP_PlanTable_HuaiBei));
        //        System.IO.MemoryStream m = new System.IO.MemoryStream();
        //        System.IO.StreamWriter sw = new System.IO.StreamWriter(m);
        //        sw.Write(str1);
        //        sw.Flush();
        //        m.Position = 0;
        //        t = (PSP_PlanTable_HuaiBei)xms.Deserialize(m);
        //        ts.Add(t);
        //    }
        //    if (null != ts)
        //        return ts;
        //    else
        //        return null;
        //}
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject(string flag)
        {
            // 检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            PSP_PlanTable_HuaiBei obj = new PSP_PlanTable_HuaiBei();

            obj.Flag2      = flags1;
            obj.CreateDate = DateTime.Now;

            //执行添加操作
            using (FrmPSP_PlanTable_HuaiBeiDialog dlg = new FrmPSP_PlanTable_HuaiBeiDialog())
            {
                dlg.Type  = types1;
                dlg.Flag  = flags1;
                dlg.Type2 = types2;
                //// dlg.ctrlPSP_PowerSubstationInfo = this;
                dlg.Text     = "添加项目计划表";
                dlg.IsCreate = true;    //设置新建标志
                dlg.Object   = obj;

                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            RefreshData1();
            GridHelper.FocuseRow(this.bandedGridView1, obj);
        }
Exemplo n.º 18
0
        public void PopulateYears(Dictionary <int, Dictionary <int, List <LocalIntervention> > > yearMonthInterventions)
        {
            YearList = new ObjectList <YearInterventionsViewModel>(true);
            LocalCache.Instance.SettingsItems.Add(LocalCache.SettingsItemEnum.An, new List <SettingsItem>());
            int      totalInterventions = 0;
            double   totalRevenue       = 0;
            double   totalProfit        = 0;
            TimeSpan totalDuration      = new TimeSpan();
            var      listOfYears        = new List <YearInterventionsViewModel>();

            foreach (var yearKey in yearMonthInterventions.Keys)
            {
                var newYear = new YearInterventionsViewModel(yearMonthInterventions[yearKey], yearKey, this);
                // YearList.Add(newYear);
                listOfYears.Add(newYear);
                totalInterventions += newYear.NumarInterventii;
                totalRevenue       += newYear.TotalIncasari;
                totalDuration      += newYear.TotalHours;
                totalProfit        += newYear.TotalProfit;
                LocalCache.Instance.SettingsItems[LocalCache.SettingsItemEnum.An].Add(new SettingsItem()
                {
                    Id   = yearKey,
                    Name = yearKey.ToString()
                });
            }
            eventAggregator.GetEvent <TotalsModifiedEvent>().Publish(new TotalsIfo
            {
                TotalHours         = totalDuration,
                TotalInverventions = totalInterventions,
                TotalRevenue       = totalRevenue,
                TotalProfit        = totalProfit,
            });
            listOfYears = listOfYears.OrderBy(item => item.Year).ToList();
            foreach (var yearInterventionsViewModel in listOfYears)
            {
                YearList.Add(yearInterventionsViewModel);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            Substation_Info obj = new Substation_Info();

            obj.Flag       = flags1;
            obj.CreateDate = DateTime.Now;
            //obj.L1 = 100;
            //obj.L2 = 100;
            //obj.L3 = 100;

            //执行添加操作
            using (FrmSubstation_InfoDialog dlg = new FrmSubstation_InfoDialog())
            {
                dlg.Type = types1;
                dlg.Flag = flags1;
                dlg.ctrlSubstation_Info = this;
                dlg.ProjectID           = projectid;
                dlg.IsCreate            = true;         //设置新建标志
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.bandedGridView1, obj);
        }
Exemplo n.º 20
0
        private void TuioChannelHelper_OnIncomingTuioObject(TuioObject o, IncomingType type)
        {
            switch (type)
            {
            case IncomingType.New:
                lock (objectSync)
                    ObjectList.Add(o.getSessionID(), new TuioObjectContainer(o, type));
                break;

            case IncomingType.Update:
                lock (objectSync)
                {
                    ObjectList[o.getSessionID()].TuioObject.update(o);
                    ObjectList[o.getSessionID()].Type = type;
                }
                break;

            case IncomingType.Remove:
                lock (objectSync)
                    ObjectList[o.getSessionID()].Type = type;    //the one who produces the touch input is responsible for removing items
                break;
            }
        }
Exemplo n.º 21
0
        public async Task <Error> DownloadObjects()
        {
            var jsonrpc = new JsonRpcClient();

            if (await jsonrpc.SendRequest("object::full"))
            {
                var response = jsonrpc.GetRequestResponseDeserialized <RootJeedomObjects>();
                foreach (JeedomObject obj in response.result)
                {
                    var lst = from o in ObjectList where o.id == obj.id select o;
                    if (lst.Count() != 0)
                    {
                        var ob = lst.FirstOrDefault();
                        ob = obj;
                    }
                    else
                    {
                        ObjectList.Add(obj);
                    }
                }
            }
            return(jsonrpc.Error);
        }
Exemplo n.º 22
0
        public override void Invoke()
        {
            No       = -1;
            State    = State.Start;
            IsBusy   = true;
            DataList = new ObjectList();
            double no;

            while ((no = GetNo()) != 0)
            {
                GeneralObject go = CreateObj(Source, no);
                DataList.Add(go);
            }
            Source.Completed += (o, e) =>
            {
                Source.NewPropertyValue("id");
            };
            Source.SetPropertyValue("invoicelist", DataList, true);
            Source.Save();
            IsBusy = false;
            State  = State.End;
            MessageBox.Show("分配完成!");
        }
 private void btnAddShedule_Click(object sender, System.EventArgs e)
 {
     bool flag = false;
     ObjectList<UjfApartmentHouseDefect> list = new ObjectList<UjfApartmentHouseDefect>();
     foreach (System.Windows.Forms.DataGridViewRow row in this.dgvDefects.SelectedRows)
     {
         list.Add((UjfApartmentHouseDefect) row.get_DataBoundItem());
     }
     if ((list != null) && (list.get_Count() > 0))
     {
         foreach (UjfApartmentHouseDefect defect in list)
         {
             UjfApartmentHouseDefectShedule shedule = new UjfApartmentHouseDefectShedule {
                 ApartmentHouseDefectId = defect.Id,
                 InspectionId = this.m_inspectionId,
                 SheduleYear = (int) this.nudSheduleYear.Value
             };
             if (Mappers.UjfApartmentHouseDefectSheduleMapper.FindByApartmentHouseDefectIdAndSheduleYear(shedule.ApartmentHouseDefectId, shedule.SheduleYear, shedule.Id).get_Count() > 0)
             {
                 flag = true;
             }
             else
             {
                 shedule.SaveChanges();
             }
         }
     }
     else
     {
         System.Windows.Forms.MessageBox.Show("Для составления плана-графика добавьте хотя бы один дефект к текущему осмотру!");
     }
     if (flag)
     {
         System.Windows.Forms.MessageBox.Show("Некоторые планы-графики не были добавлены, так как уже присутствуют в списке!");
     }
     base.Close();
 }
Exemplo n.º 24
0
        public static ObjectList <T> CreateObjectsFromTable <T>(ObjectTable table, SqoTypeInfo actualType)
        {
            ObjectList <T> obList = new ObjectList <T>();

            foreach (ObjectRow row in table.Rows)
            {
                T currentObj = default(T);
                currentObj = Activator.CreateInstance <T>();
                //ISqoDataObject dObj = currentObj as ISqoDataObject;

                foreach (string column in table.Columns.Keys)
                {
                    FieldSqoInfo fi = MetaHelper.FindField(actualType.Fields, column);
                    if (fi != null)
                    {
#if SILVERLIGHT
                        try
                        {
                            //dObj.SetValue(fi.FInfo, row[column]);
                            MetaHelper.CallSetValue(fi.FInfo, row[column], currentObj, actualType.Type);
                        }
                        catch (Exception ex)
                        {
                            throw new SiaqodbException("Override GetValue and SetValue methods of SqoDataObject-Silverlight limitation to private fields");
                        }
#else
                        fi.FInfo.SetValue(currentObj, row[column]);
#endif
                    }
                }


                obList.Add(currentObj);
            }
            return(obList);
        }
Exemplo n.º 25
0
        public void ShouldCreateUserObjectListWithTenThousandUsers()
        {
            ObjectList <User> list = new ObjectList <User>();

            User[] users = new User[10000];

            for (int k = 0; k < users.Length; k++)
            {
                users[k] = new User("user" + k);
                list.Add(users[k]);
            }

            Assert.IsNotNull(list);
            Assert.AreEqual(users.Length, list.Count);

            int n = 0;

            foreach (User user in list.Elements)
            {
                Assert.AreEqual(users[n++].Name, user.Name);
            }

            Assert.AreEqual(users.Length, n);
        }
Exemplo n.º 26
0
        public override bool TryGetNextObject(Vector3 pos, Quaternion rot, out GameObject obj)
        {
            int lastIndex = AvailableObjects.Count - 1;

            if (AvailableObjects.Count > 0)
            {
                if (AvailableObjects[lastIndex] == null)
                {
                    Debug.LogError("EZObjectPool " + PoolName + " has missing objects in its pool! Are you accidentally destroying any GameObjects retrieved from the pool?");
                    obj = null;
                    return(false);
                }

                AvailableObjects[lastIndex].transform.position = pos;
                AvailableObjects[lastIndex].transform.rotation = rot;
                AvailableObjects[lastIndex].SetActive(true);
                obj = AvailableObjects[lastIndex];
                AvailableObjects.RemoveAt(lastIndex);
                return(true);
            }

            if (AutoResize)
            {
                GameObject g = NewActiveObject();
                g.transform.position = pos;
                g.transform.rotation = rot;
                ObjectList.Add(g);
                obj = g;
                return(true);
            }
            else
            {
                obj = null;
                return(false);
            }
        }
Exemplo n.º 27
0
        public void AddObjecta(string type, bool bl)
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            PowerEachList obj = new PowerEachList();

            obj.Types = type;

            //执行添加操作
            using (FrmPowerEachListDialog2 dlg = new FrmPowerEachListDialog2())
            {
                dlg.IsCreate = true;    //设置新建标志
                dlg.Object   = obj;
                dlg.IsPower  = true;
                dlg.IsJSXM   = isjsxm;
                dlg.bl       = bl;
                dlg.IsBTN    = isbtn;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            // ObjectList.Insert(0, obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Exemplo n.º 28
0
        public override void InstantiatePool()
        {
            ClearPool();

            AvailableObjects = new List <GameObject>(PoolSize);

            getCurrentLevel();

            for (int i = 0; i < PoolSize; i++) // iterate
            {
                // chose according to each prob probability a template
                int   idx            = Random.Range(1, 101);
                float AccProbability = 0.0f;
                for (int j = 0; j < gameSettings.enemiesSets[level].Enemies.Length; ++j)
                {
                    AccProbability += gameSettings.enemiesSets[level].Enemies[j].probability;

                    if (idx <= AccProbability)
                    {
                        Template = gameSettings.enemiesSets[level].Enemies[j].enemy;
                        break;
                    }
                }

                GameObject g = NewActiveObject();
                g.SetActive(false);
                ObjectList.Add(g);
                AvailableObjects.Add(g);
            }

            // turn off all templates
            for (int j = 0; j < gameSettings.enemiesSets[level].Enemies.Length; ++j)
            {
                gameSettings.enemiesSets[level].Enemies[j].enemy.SetActive(false);
            }
        }
Exemplo n.º 29
0
 private void Form_Load(object sender, System.EventArgs e)
 {
     if (!base.get_DesignMode())
     {
         this.set_Font(Manager.WindowFont);
         ObjectList<ServiceTypeOld> list = new ObjectList<ServiceTypeOld>();
         list.RegisterBaseList(Register.ServiceTypes);
         list.Add(ServiceTypeOld.Null);
         this.bsServiceTypes.set_DataSource(list);
         this.bsCanonicalService.set_DataSource(CanonicalService.FindAll());
         this.bsCanonicalService.Add(CanonicalService.Null);
         this.bsCanonicalService.set_Position(this.bsCanonicalService.IndexOf(CanonicalService.Null));
     }
 }
        /// <summary>
        /// Gets an enumeration of data items for use as arguments
        /// for a test method parameter.
        /// </summary>
        /// <param name="parameter">The parameter for which data is needed</param>
        /// <returns>
        /// An enumeration containing individual data items
        /// </returns>
        public IEnumerable GetData(ParameterInfo parameter)
        {
            ObjectList data = new ObjectList();
            IEnumerable source = GetDataSource(parameter);

            if (source != null)
                foreach (object item in source)
                    data.Add(item);

            return source;
        }
Exemplo n.º 31
0
 void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e)
 {
     if (e.Index == 1)
     {
         LogicalName = GXCommon.ToLogicalName(e.Value);
     }
     else if (e.Index == 2)
     {
         ObjectList.Clear();
         if (e.Value != null)
         {
             foreach (Object[] item in (Object[])e.Value)
             {
                 GXDLMSObject obj = GetObject(settings, item);
                 //Unknown objects are not shown.
                 if (obj is IGXDLMSBase)
                 {
                     ObjectList.Add(obj);
                 }
             }
         }
     }
     else if (e.Index == 3)
     {
         if (e.Value != null)
         {
             ClientSAP = Convert.ToByte(((Object[])e.Value)[0]);
             ServerSAP = Convert.ToUInt16(((Object[])e.Value)[1]);
         }
     }
     else if (e.Index == 4)
     {
         //Value of the object identifier encoded in BER
         if (e.Value is byte[])
         {
             GXByteBuffer arr = new GXByteBuffer(e.Value as byte[]);
             if (arr.GetUInt8(0) == 0x60)
             {
                 ApplicationContextName.JointIsoCtt            = arr.GetUInt8();
                 ApplicationContextName.Country                = arr.GetUInt8();
                 ApplicationContextName.CountryName            = arr.GetUInt8();
                 ApplicationContextName.IdentifiedOrganization = arr.GetUInt8();
                 ApplicationContextName.DlmsUA             = arr.GetUInt8();
                 ApplicationContextName.ApplicationContext = arr.GetUInt8();
                 ApplicationContextName.ContextId          = (ApplicationContextName)arr.GetUInt8();
             }
             else
             {
                 //Get Tag and Len.
                 if (arr.GetUInt8() != (int)BerType.Integer && arr.GetUInt8() != 7)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.JointIsoCtt = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.Country = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x12)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.CountryName = arr.GetUInt16();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.IdentifiedOrganization = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.DlmsUA = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.ApplicationContext = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 ApplicationContextName.ContextId = (ApplicationContextName)arr.GetUInt8();
             }
         }
         else if (e.Value != null)
         {
             Object[] arr = (Object[])e.Value;
             ApplicationContextName.JointIsoCtt            = Convert.ToByte(arr[0]);
             ApplicationContextName.Country                = Convert.ToByte(arr[1]);
             ApplicationContextName.CountryName            = Convert.ToUInt16(arr[2]);
             ApplicationContextName.IdentifiedOrganization = Convert.ToByte(arr[3]);
             ApplicationContextName.DlmsUA             = Convert.ToByte(arr[4]);
             ApplicationContextName.ApplicationContext = Convert.ToByte(arr[5]);
             ApplicationContextName.ContextId          = (ApplicationContextName)Convert.ToByte(arr[6]);
         }
     }
     else if (e.Index == 5)
     {
         if (e.Value != null)
         {
             Object[] arr = (Object[])e.Value;
             if (arr[0] is string || arr[0] is byte[])
             {
                 GXByteBuffer bb = new GXByteBuffer();
                 GXCommon.SetBitString(bb, arr[0], true);
                 bb.SetUInt8(0, 0);
                 XDLMSContextInfo.Conformance = (Conformance)bb.GetUInt32();
             }
             else
             {
                 XDLMSContextInfo.Conformance = (Conformance)Convert.ToUInt16(arr[0]);
             }
             XDLMSContextInfo.MaxReceivePduSize = Convert.ToUInt16(arr[1]);
             XDLMSContextInfo.MaxSendPduSize    = Convert.ToUInt16(arr[2]);
             XDLMSContextInfo.DlmsVersionNumber = Convert.ToByte(arr[3]);
             XDLMSContextInfo.QualityOfService  = Convert.ToSByte(arr[4]);
             XDLMSContextInfo.CypheringInfo     = (byte[])arr[5];
         }
     }
     else if (e.Index == 6)
     {
         //Value of the object identifier encoded in BER
         if (e.Value is byte[])
         {
             GXByteBuffer arr = new GXByteBuffer(e.Value as byte[]);
             if (arr.GetUInt8(0) == 0x60)
             {
                 AuthenticationMechanismName.JointIsoCtt            = arr.GetUInt8();
                 AuthenticationMechanismName.Country                = arr.GetUInt8();
                 AuthenticationMechanismName.CountryName            = arr.GetUInt8();
                 AuthenticationMechanismName.IdentifiedOrganization = arr.GetUInt8();
                 AuthenticationMechanismName.DlmsUA = arr.GetUInt8();
                 AuthenticationMechanismName.AuthenticationMechanismName = arr.GetUInt8();
                 AuthenticationMechanismName.MechanismId = (Authentication)arr.GetUInt8();
             }
             else
             {
                 //Get Tag and Len.
                 if (arr.GetUInt8() != (int)BerType.Integer && arr.GetUInt8() != 7)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.JointIsoCtt = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.Country = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x12)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.CountryName = arr.GetUInt16();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.IdentifiedOrganization = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.DlmsUA = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.AuthenticationMechanismName = arr.GetUInt8();
                 //Get tag
                 if (arr.GetUInt8() != 0x11)
                 {
                     throw new ArgumentOutOfRangeException();
                 }
                 AuthenticationMechanismName.MechanismId = (Authentication)arr.GetUInt8();
             }
         }
         else if (e.Value != null)
         {
             Object[] arr = (Object[])e.Value;
             AuthenticationMechanismName.JointIsoCtt            = Convert.ToByte(arr[0]);
             AuthenticationMechanismName.Country                = Convert.ToByte(arr[1]);
             AuthenticationMechanismName.CountryName            = Convert.ToUInt16(arr[2]);
             AuthenticationMechanismName.IdentifiedOrganization = Convert.ToByte(arr[3]);
             AuthenticationMechanismName.DlmsUA = Convert.ToByte(arr[4]);
             AuthenticationMechanismName.AuthenticationMechanismName = Convert.ToByte(arr[5]);
             AuthenticationMechanismName.MechanismId = (Authentication)Convert.ToByte(arr[6]);
         }
     }
     else if (e.Index == 7)
     {
         Secret = (byte[])e.Value;
     }
     else if (e.Index == 8)
     {
         if (e.Value == null)
         {
             AssociationStatus = AssociationStatus.NonAssociated;
         }
         else
         {
             AssociationStatus = (AssociationStatus)Convert.ToInt32(e.Value);
         }
     }
     else if (e.Index == 9)
     {
         SecuritySetupReference = GXCommon.ToLogicalName(e.Value);
     }
     else if (e.Index == 10)
     {
         UserList.Clear();
         if (e.Value != null)
         {
             foreach (Object[] item in (Object[])e.Value)
             {
                 UserList.Add(new KeyValuePair <byte, string>(Convert.ToByte(item[0]), Convert.ToString(item[1])));
             }
         }
     }
     else if (e.Index == 11)
     {
         if (e.Value != null)
         {
             Object[] tmp = (Object[])e.Value;
             if (tmp.Length == 1)
             {
                 CurrentUser = new KeyValuePair <byte, string>(Convert.ToByte(tmp[0]), null);
             }
             else
             {
                 CurrentUser = new KeyValuePair <byte, string>(Convert.ToByte(tmp[0]), Convert.ToString(tmp[1]));
             }
         }
         else
         {
             CurrentUser = new KeyValuePair <byte, string>(0, null);
         }
     }
     else
     {
         e.Error = ErrorCode.ReadWriteDenied;
     }
 }
        private bool FillPrecautionsAccordingToChoices2(Panel p, GeneralObject go, ObjectList lines, bool mustSelect, bool checkContradition, string equipment)
        {
            bool selected        = false;
            bool normalChecked   = false;
            bool abnormalChecked = false;

            foreach (UIElement element in p.Children)
            {
                if (element is CheckBox)
                {
                    CheckBox aBox = element as CheckBox;
                    if (aBox.IsChecked.HasValue && aBox.IsChecked.Value)
                    {
                        if (aBox.Content.Equals("无") || aBox.Content.Equals("正常"))
                        {
                            normalChecked = true;
                        }
                        else
                        {
                            abnormalChecked = true;
                        }
                    }
                    if (aBox.IsChecked.HasValue)
                    {
                        selected |= aBox.IsChecked.Value;
                    }
                }
            }
            if (!selected && mustSelect)
            {
                MessageBox.Show("请选择" + equipment + "隐患选项!");
                return(false);
            }
            if (normalChecked && abnormalChecked && checkContradition)
            {
                MessageBox.Show("请检查" + equipment + "隐患选项!");
                return(false);
            }

            foreach (UIElement element in p.Children)
            {
                if (element is CheckBox)
                {
                    CheckBox aBox = element as CheckBox;
                    if (aBox.IsChecked.HasValue && aBox.IsChecked.Value)
                    {
                        if (aBox.Content.Equals("无") || aBox.Content.Equals("正常"))
                        {
                            continue;
                        }
                        GeneralObject line = CreateALine(go);
                        lines.Add(line);
                        line.SetPropertyValue("EQUIPMENT", equipment, true);
                        if (aBox.Content.Equals("腐蚀"))
                        {
                            if (rbErodedSlight.IsChecked.Value)
                            {
                                line.SetPropertyValue("CONTENT", rbErodedSlight.Content, true);
                            }
                            else if (rbErodedSevere.IsChecked.Value)
                            {
                                line.SetPropertyValue("CONTENT", rbErodedSevere.Content, true);
                            }
                            else if (rbErodedModerate.IsChecked.Value)
                            {
                                line.SetPropertyValue("CONTENT", rbErodedModerate.Content, true);
                            }
                        }
                    }
                }
            }
            return(true);
        }
        /// <summary>
        /// Инициализация
        /// </summary>
        protected override void CreatePreDefinedFields()
        {
            #region необходимые операции до создания реквизитов и заполнения полей
            if (NsgSettings.Regime == NsgSoft.Common.NsgViewTypes.Load)
            {
                base.CreatePreDefinedFields();
            }
            #endregion             //необходимые операции до создания реквизитов и заполнения полей


            #region создание System.String Минимальный
            {
                NsgDataEnumElement Минимальный = null;
                if (ObjectList.Contains("Минимальный"))
                {
                    Минимальный = ObjectList["Минимальный"] as NsgDataEnumElement;
                }
                else
                {
                    Минимальный = new NsgDataEnumElement();
                }
                //NsgDataEnumElement
                Минимальный.IsLoadedFromDll              = true;
                Минимальный.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                Минимальный.Index                        = 0;
                Минимальный.StringFormat                 = "";
                Минимальный.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Минимальный.IncludeInPredefined          = false;
                Минимальный.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Минимальный.Required                     = false;
                Минимальный.EmptyValue                   = "";
                Минимальный.NullAllow                    = false;
                Минимальный.FieldName                    = "_Minimum";
                Минимальный.SaveInDatabase               = true;
                Минимальный.InformMetaDataOnValueChanged = false;
                Минимальный.Visible                      = true;
                Минимальный.Name         = "Минимальный";
                Минимальный.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                     new System.Object[] { "Минимальный" });
                Минимальный.Description   = "Минимальный";
                Минимальный.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Минимальный.GroupName     = "";
                Минимальный.Guid          = NsgService.StringToGuid("404deb34-4069-44e5-841d-cee01201f5a0");

                if (!ObjectList.Contains("Минимальный"))
                {
                    ObjectList.Add(Минимальный);
                }
            }
            #endregion             //создание System.String Минимальный

            #region создание System.String Низкий
            {
                NsgDataEnumElement Низкий = null;
                if (ObjectList.Contains("Низкий"))
                {
                    Низкий = ObjectList["Низкий"] as NsgDataEnumElement;
                }
                else
                {
                    Низкий = new NsgDataEnumElement();
                }
                //NsgDataEnumElement
                Низкий.IsLoadedFromDll              = true;
                Низкий.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                Низкий.Index                        = 1;
                Низкий.StringFormat                 = "";
                Низкий.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Низкий.IncludeInPredefined          = false;
                Низкий.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Низкий.Required                     = false;
                Низкий.EmptyValue                   = "";
                Низкий.NullAllow                    = false;
                Низкий.FieldName                    = "_Low";
                Низкий.SaveInDatabase               = true;
                Низкий.InformMetaDataOnValueChanged = false;
                Низкий.Visible                      = true;
                Низкий.Name         = "Низкий";
                Низкий.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                new System.Object[] { "Низкий" });
                Низкий.Description   = "Низкий";
                Низкий.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Низкий.GroupName     = "";
                Низкий.Guid          = NsgService.StringToGuid("26ea9a7d-d8ef-4d75-a066-b609def37402");

                if (!ObjectList.Contains("Низкий"))
                {
                    ObjectList.Add(Низкий);
                }
            }
            #endregion             //создание System.String Низкий

            #region создание System.String Средний
            {
                NsgDataEnumElement Средний = null;
                if (ObjectList.Contains("Средний"))
                {
                    Средний = ObjectList["Средний"] as NsgDataEnumElement;
                }
                else
                {
                    Средний = new NsgDataEnumElement();
                }
                //NsgDataEnumElement
                Средний.IsLoadedFromDll              = true;
                Средний.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                Средний.Index                        = 2;
                Средний.StringFormat                 = "";
                Средний.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Средний.IncludeInPredefined          = false;
                Средний.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Средний.Required                     = false;
                Средний.EmptyValue                   = "";
                Средний.NullAllow                    = false;
                Средний.FieldName                    = "_Medium";
                Средний.SaveInDatabase               = true;
                Средний.InformMetaDataOnValueChanged = false;
                Средний.Visible                      = true;
                Средний.Name         = "Средний";
                Средний.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                 new System.Object[] { "Средний" });
                Средний.Description   = "Средний";
                Средний.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Средний.GroupName     = "";
                Средний.Guid          = NsgService.StringToGuid("5e11f68d-df67-4bef-bc85-d3f525109499");

                if (!ObjectList.Contains("Средний"))
                {
                    ObjectList.Add(Средний);
                }
            }
            #endregion             //создание System.String Средний

            #region создание System.String Высокий
            {
                NsgDataEnumElement Высокий = null;
                if (ObjectList.Contains("Высокий"))
                {
                    Высокий = ObjectList["Высокий"] as NsgDataEnumElement;
                }
                else
                {
                    Высокий = new NsgDataEnumElement();
                }
                //NsgDataEnumElement
                Высокий.IsLoadedFromDll              = true;
                Высокий.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                Высокий.Index                        = 3;
                Высокий.StringFormat                 = "";
                Высокий.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Высокий.IncludeInPredefined          = false;
                Высокий.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Высокий.Required                     = false;
                Высокий.EmptyValue                   = "";
                Высокий.NullAllow                    = false;
                Высокий.FieldName                    = "_High";
                Высокий.SaveInDatabase               = true;
                Высокий.InformMetaDataOnValueChanged = false;
                Высокий.Visible                      = true;
                Высокий.Name         = "Высокий";
                Высокий.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                 new System.Object[] { "Высокий" });
                Высокий.Description   = "Высокий";
                Высокий.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Высокий.GroupName     = "";
                Высокий.Guid          = NsgService.StringToGuid("d2fac93d-b161-4bff-a7f6-faa76c4bff8a");

                if (!ObjectList.Contains("Высокий"))
                {
                    ObjectList.Add(Высокий);
                }
            }
            #endregion             //создание System.String Высокий

            #region создание System.String Максимальный
            {
                NsgDataEnumElement Максимальный = null;
                if (ObjectList.Contains("Максимальный"))
                {
                    Максимальный = ObjectList["Максимальный"] as NsgDataEnumElement;
                }
                else
                {
                    Максимальный = new NsgDataEnumElement();
                }
                //NsgDataEnumElement
                Максимальный.IsLoadedFromDll              = true;
                Максимальный.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                Максимальный.Index                        = 4;
                Максимальный.StringFormat                 = "";
                Максимальный.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Максимальный.IncludeInPredefined          = false;
                Максимальный.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Максимальный.Required                     = false;
                Максимальный.EmptyValue                   = "";
                Максимальный.NullAllow                    = false;
                Максимальный.FieldName                    = "_Maximum";
                Максимальный.SaveInDatabase               = true;
                Максимальный.InformMetaDataOnValueChanged = false;
                Максимальный.Visible                      = true;
                Максимальный.Name         = "Максимальный";
                Максимальный.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                      new System.Object[] { "Максимальный" });
                Максимальный.Description   = "Максимальный";
                Максимальный.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Максимальный.GroupName     = "";
                Максимальный.Guid          = NsgService.StringToGuid("5e8cac67-0b16-4470-8f37-fcf81345d570");

                if (!ObjectList.Contains("Максимальный"))
                {
                    ObjectList.Add(Максимальный);
                }
            }
            #endregion             //создание System.String Максимальный


            #region заполнение полей класса
            //NsgDataEnum
            IsLoadedFromDll        = true;
            EntityType             = NsgSoft.DataObjects.NsgInterfacedObject.EntityTypes.Object;
            Name                   = "Приоритет";
            Visible                = true;
            Guid                   = NsgService.StringToGuid("226605c2-7e81-4f06-83ba-7d7f9f378231");
            DefaultSortingName     = "";
            DefaultElementFormName = "";
            DefaultListFormName    = "";
            ValueMask              = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                               new System.Object[] { "{Представление}" });
            SearchType       = NsgSoft.Database.NsgComparison.Contain;
            SearchFieldName  = "";
            DatabaseName     = "";
            VisibleAdminOnly = false;
            TableName        = "Priority";
            Presentation     = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                         new System.Object[] { "Тип приоритета" });
            Description   = "Тип приоритета";
            EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.ReadOnly;
            GroupName     = "Сервис";

            #endregion             //заполнение полей класса
            #region необходимые операции после создания реквизитов и заполнения полей
            #endregion             //необходимые операции после создания реквизитов и заполнения полей
        }
        private IList GetFixtures(Assembly assembly, IList names)
        {
            ObjectList fixtures = new ObjectList();

            IList testTypes = GetCandidateFixtureTypes(assembly, names);

            foreach (Type testType in testTypes)
            {
                if (TestFixtureBuilder.CanBuildFrom(testType))
                    fixtures.Add(TestFixtureBuilder.BuildFrom(testType));
            }

            return fixtures;
        }
 private void HouseCounterServiceCounterAddChangeForm_Load(object sender, System.EventArgs e)
 {
     this.set_Font(Manager.WindowFont);
     this.set_Text(this.m_HouseCounterServiceCounter.IsNew ? ((string) "Добавление связи услуг со счетчиком") : ((string) "Изменение связи услуг со счетчиком"));
     this.btnOk.set_Text(this.m_HouseCounterServiceCounter.IsNew ? ((string) "Добавить") : ((string) "Изменить"));
     this.m_Area = new Area();
     ObjectList<LocalAddress> addresses = new ObjectList<LocalAddress> {
         this.m_HouseCounterServiceCounter.GetHouseCounter().GetHouse().GetLocalAddress()
     };
     this.m_Area.SaveChanges();
     this.m_Area.SaveAddresses(addresses);
     this.selectServices.Area = this.m_Area;
     if (!this.m_HouseCounterServiceCounter.IsNew)
     {
         ObjectList<ServiceOld> list2 = new ObjectList<ServiceOld>();
         list2.Add(this.m_HouseCounterServiceCounter.GetService());
         this.selectServices.SelectedServices = list2;
         this.datePeriod.DateBegin = this.m_HouseCounterServiceCounter.FromDate;
         this.datePeriod.DateEnd = (this.m_HouseCounterServiceCounter.ToDate == Constants.NullDate) ? this.datePeriod.DateEnd : this.m_HouseCounterServiceCounter.ToDate;
     }
 }
Exemplo n.º 36
0
 public ObjectList<RepReport> GetSelectPrintReports()
 {
     ObjectList<RepReport> list = new ObjectList<RepReport>();
     int num = this.bsReports.get_Position();
     this.bsReports.set_Position((num == 0) ? ((int) 1) : ((int) (num - 1)));
     this.bsReports.set_Position(num);
     foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvReports.Rows)
     {
         if ((row.Cells.get_Item("CheckPrint").get_Value() != null) && ((bool) row.Cells.get_Item("CheckPrint").get_Value()))
         {
             RepReport report = (RepReport) row.get_DataBoundItem();
             report.UpdateResult();
             list.Add(report);
         }
     }
     return list;
 }
Exemplo n.º 37
0
        /// <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.º 38
0
 private void Upload_Click(object sender, System.EventArgs e)
 {
     ObjectList<RemitteePaymentOrder> remitteePaymentOrders = new ObjectList<RemitteePaymentOrder>();
     ObjectList<Service> services = new ObjectList<Service>();
     foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvRemitteePaymentOrders.Rows)
     {
         if ((row.Cells.get_Item("CheckColumn").get_Value() != null) && ((bool) row.Cells.get_Item("CheckColumn").get_Value()))
         {
             long id = (long) ((long) row.Cells.get_Item("id").get_Value());
             remitteePaymentOrders.Add(ObjectWithId.FindById<RemitteePaymentOrder>(id));
         }
     }
     services = this.selectServices.Services;
     RemitteePaymentOrderUploading typeUse = (RemitteePaymentOrderUploading) this.bsUseType.get_Current();
     if (typeUse == RemitteePaymentOrderUploading.Null)
     {
         AIS.SN.UI.Messages.ShowWarning("Выберете тип");
     }
     else
     {
         System.Data.DataSet set = RemitteePaymentOrder.Upload(remitteePaymentOrders, services, typeUse);
         if (typeUse.Format != "DBF")
         {
             AIS.SN.UI.Messages.ShowWarning("Данный форма выгрузки пока не поддерживается");
         }
         else
         {
             this.sfdDBF.set_DefaultExt("dbf");
             if (this.sfdDBF.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 System.IO.FileInfo info = new System.IO.FileInfo(this.sfdDBF.get_FileName());
                 string text1 = info.get_DirectoryName() + ((info.get_DirectoryName() == "") ? ((string) "") : ((string) @"\"));
                 DbFileFormat fileFormat = DbFileFormat.dBase3;
                 DBF.WriteToFile((System.Data.DataTable) set.Tables.get_Item(0), info.get_DirectoryName(), info.get_Name(), fileFormat, false, false);
                 AIS.SN.UI.Messages.ShowMessage("Выгрузка выполнена");
             }
         }
     }
 }
Exemplo n.º 39
0
 private void tsbPrepare_Click(object sender, System.EventArgs e)
 {
     ObjectList<PayReester> reestersList = new ObjectList<PayReester>();
     foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvIncludedReesters.Rows)
     {
         if ((bool) (row.Cells.get_Item("IsBound") as System.Windows.Forms.DataGridViewCheckBoxCell).get_Value())
         {
             reestersList.Add(row.get_DataBoundItem() as PayReester);
         }
     }
     if (reestersList.get_Count() != 0)
     {
         new PayReestersForm(reestersList).ShowDialog();
     }
     else
     {
         Messages.ShowMessage("Не выбрано ни одного реестра");
     }
 }
 private void tsbFindLike_Click(object sender, System.EventArgs e)
 {
     this.dgvServices.EndEdit();
     this.dgvServiceNormTypesByProperties.EndEdit();
     this.dgvServiceNormTypes.EndEdit();
     if (this.dgvServices.CurrentRow.Cells.get_Item("NewRateColumn").get_Value() == null)
     {
         System.Windows.Forms.MessageBox.Show("Введите новый норматив", "Ошибка", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
     }
     else
     {
         string newTariff = this.dgvServices.CurrentRow.Cells.get_Item("NewRateColumn").get_Value().ToString();
         decimal num = (decimal) this.dgvServices.CurrentRow.Cells.get_Item("lastRateDataGridViewTextBoxColumn").get_Value();
         long num2 = (long) ((long) this.dgvServices.CurrentRow.Cells.get_Item("Id").get_Value());
         long num3 = (long) ((long) this.dgvServices.CurrentRow.Cells.get_Item("TypeId").get_Value());
         foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvServices.Rows)
         {
             if (((((decimal) row.Cells.get_Item("lastRateDataGridViewTextBoxColumn").get_Value()) == num) && (num2 != ((long) row.Cells.get_Item("Id").get_Value()))) && (this.tsbFindByTypeService.get_Checked() ? (((long) row.Cells.get_Item("TypeId").get_Value()) == num3) : true))
             {
                 if (System.Windows.Forms.MessageBox.Show("Найдены нормативы с совпадающими старыми значениями. Перейти к изменению?", "Предупреждение", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                 {
                     ObjectList<Service> services = new ObjectList<Service>();
                     foreach (Service service in (ObjectList<Service>) this.bsServices.get_DataSource())
                     {
                         if ((service.ServiceNormRate == num) && (service.Id != num2))
                         {
                             services.Add(service);
                         }
                     }
                     System.Data.DataTable table = new System.Data.DataTable();
                     table.Columns.Add("serviceNormTypeId", typeof(long));
                     table.Columns.Add("serviceNormId", typeof(long));
                     table.Columns.Add("rate", typeof(decimal));
                     table.Columns.Add("fasetId", typeof(short));
                     table.Columns.Add("apartmentPropertyId", typeof(int));
                     System.Data.DataTable table2 = new System.Data.DataTable();
                     table2.Columns.Add("serviceNormTypeId", typeof(long));
                     table2.Columns.Add("serviceNormId", typeof(long));
                     table2.Columns.Add("rate", typeof(decimal));
                     table2.Columns.Add("fasetId", typeof(short));
                     table2.Columns.Add("apartmentPropertyId", typeof(int));
                     foreach (System.Windows.Forms.DataGridViewRow row2 in (System.Collections.IEnumerable) this.dgvServiceNormTypesByProperties.Rows)
                     {
                         if (row2.Cells.get_Item("NewValueApartmentProperty").get_Value() != null)
                         {
                             table2.Rows.Add((object[]) new object[] { ((long) row2.Cells.get_Item("ServiceNormTypeId").get_Value()), ((long) row2.Cells.get_Item("ServiceTypeServiceNormId").get_Value()), System.Convert.ToDecimal(row2.Cells.get_Item("dataGridViewTextBoxColumn1").get_Value()), ((short) 1), ((int) row2.Cells.get_Item("ApartmentPropertyId").get_Value()) });
                         }
                     }
                     foreach (System.Windows.Forms.DataGridViewRow row3 in (System.Collections.IEnumerable) this.dgvServiceNormTypes.Rows)
                     {
                         if (row3.Cells.get_Item("NewValueNorm").get_Value() != null)
                         {
                             table.Rows.Add((object[]) new object[] { ((long) row3.Cells.get_Item("ServiceNormType_Id").get_Value()), ((long) row3.Cells.get_Item("ServiceNormType_ServiceNormId").get_Value()), System.Convert.ToDecimal(row3.Cells.get_Item("dataGridViewTextBoxColumn3").get_Value()), 1, ((int) row3.Cells.get_Item("ServiceNormType_ApartmentPropertyId").get_Value()) });
                         }
                     }
                     ChangeAdditionalServiceNormForm form = new ChangeAdditionalServiceNormForm(services, table, table2, this.provider, this.resource, this.holder, this.serviceType, this.isSeason, this.isOpenServicesForArea, this.area, this.dtCanonicalProperties, this.isOpen, this.dateLastTariff, this.houseYear);
                     if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                     {
                         this.FilldgvServices(form.FindServices(), newTariff);
                         this.FilldvgServiceNormTypes(form.FindServiceNormTypes(), table);
                         this.FilldvgServiceNormTypesByProperty(form.FindServiceNormTypesByProperty(), table2);
                     }
                 }
                 return;
             }
         }
         System.Windows.Forms.MessageBox.Show("Подобные нормативы не найдены", "Предупреждение", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
     }
 }
Exemplo n.º 41
0
 public static void OrgDocumentsCacheRefresh()
 {
     ObjectList<OrgDocument> list = new ObjectList<OrgDocument>();
     foreach (OrgDocument document in orgDocumentsCache)
     {
         try
         {
             OrgDocument document2 = Mappers.OrgDocumentMapper.FindById(document.Id);
             if (document2 != null)
             {
                 list.Add(document2);
             }
         }
         catch (ObjectNotFoundException)
         {
         }
     }
     orgDocumentsCache = list;
 }
Exemplo n.º 42
0
 public static void BankAccountCacheRefresh()
 {
     ObjectList<BankAccount> list = new ObjectList<BankAccount>();
     foreach (BankAccount account in bankAccountCache)
     {
         try
         {
             BankAccount account2 = Mappers.BankAccountMapper.FindById(account.Id);
             if (account2 != null)
             {
                 list.Add(account2);
             }
         }
         catch (ObjectNotFoundException)
         {
         }
     }
     bankAccountCache = list;
 }
        /// <summary>
        /// Инициализация реквизитов объекта
        /// </summary>
        protected override void CreatePreDefinedFields()
        {
            #region необходимые операции до создания реквизитов и заполнения полей
            if (NsgSettings.Regime == NsgSoft.Common.NsgViewTypes.Load)
            {
                base.CreatePreDefinedFields();
            }
            #endregion             //необходимые операции до создания реквизитов и заполнения полей
            #region начало инициализации NsgSoft.DataObjects.NsgReportObject



            #endregion             //начало инициализации NsgSoft.DataObjects.NsgReportObject

            #region создание System.Guid Идентификатор
            {
                NsgDataGuid Идентификатор = null;
                if (ObjectList.Contains("Идентификатор"))
                {
                    Идентификатор = ObjectList["Идентификатор"] as NsgDataGuid;
                }
                else
                {
                    Идентификатор = new NsgDataGuid();
                }
                //NsgDataGuid
                Идентификатор.IsLoadedFromDll              = true;
                Идентификатор.StringFormat                 = "";
                Идентификатор.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Идентификатор.IncludeInPredefined          = false;
                Идентификатор.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Идентификатор.Required                     = false;
                Идентификатор.EmptyValue                   = "";
                Идентификатор.NullAllow                    = false;
                Идентификатор.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.UniqueControl;
                Идентификатор.FieldName                    = "_ID";
                Идентификатор.SaveInDatabase               = false;
                Идентификатор.InformMetaDataOnValueChanged = false;
                Идентификатор.Visible                      = true;
                Идентификатор.Name         = "Идентификатор";
                Идентификатор.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                       new System.Object[] { "" });
                Идентификатор.Description   = "Идентификатор";
                Идентификатор.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.ReadOnly;
                Идентификатор.GroupName     = "";
                Идентификатор.Guid          = NsgService.StringToGuid("a59a98b2-07ba-47c6-96d6-73a4578440d3");

                if (!ObjectList.Contains("Идентификатор"))
                {
                    ObjectList.Add(Идентификатор);
                }
            }
            #endregion             //создание System.Guid Идентификатор

            #region создание System.Int64 Автоинкремент
            {
                NsgDataInteger Автоинкремент = null;
                if (ObjectList.Contains("Автоинкремент"))
                {
                    Автоинкремент = ObjectList["Автоинкремент"] as NsgDataInteger;
                }
                else
                {
                    Автоинкремент = new NsgDataInteger();
                }
                //NsgDataInteger
                Автоинкремент.IsLoadedFromDll              = true;
                Автоинкремент.DefaultValue                 = 0M;
                Автоинкремент.MinValue                     = 0M;
                Автоинкремент.MaxValue                     = 0M;
                Автоинкремент.UseCalculator                = true;
                Автоинкремент.StringFormat                 = "";
                Автоинкремент.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Автоинкремент.IncludeInPredefined          = false;
                Автоинкремент.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Автоинкремент.Required                     = false;
                Автоинкремент.EmptyValue                   = "";
                Автоинкремент.NullAllow                    = false;
                Автоинкремент.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.UniqueControl;
                Автоинкремент.FieldName                    = "_AutoInc";
                Автоинкремент.SaveInDatabase               = false;
                Автоинкремент.InformMetaDataOnValueChanged = false;
                Автоинкремент.Visible                      = true;
                Автоинкремент.Name         = "Автоинкремент";
                Автоинкремент.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                       new System.Object[] { "" });
                Автоинкремент.Description   = "Автоинкремент";
                Автоинкремент.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Hidden;
                Автоинкремент.GroupName     = "";
                Автоинкремент.Guid          = NsgService.StringToGuid("7c961ac6-2b90-44cd-bf5b-936483f79d06");

                if (!ObjectList.Contains("Автоинкремент"))
                {
                    ObjectList.Add(Автоинкремент);
                }
            }
            #endregion             //создание System.Int64 Автоинкремент

            #region создание NsgSoft.Forms.NsgServiceWorkObjectForm ФормаЭлемента
            {
                NsgDataForm ФормаЭлемента = null;
                if (ObjectList.Contains("ФормаЭлемента"))
                {
                    ФормаЭлемента = ObjectList["ФормаЭлемента"] as NsgDataForm;
                }
                else
                {
                    ФормаЭлемента = new NsgDataForm();
                }
                //NsgDataForm
                ФормаЭлемента.IsLoadedFromDll              = true;
                ФормаЭлемента.FormClassName                = "NsgSoft.Forms.NsgServiceWorkObjectForm";
                ФормаЭлемента.SaveInDatabase               = false;
                ФормаЭлемента.StringFormat                 = "";
                ФормаЭлемента.SubType                      = NsgSoft.Common.NsgRekvisitSubType.ElementForm;
                ФормаЭлемента.IncludeInPredefined          = false;
                ФормаЭлемента.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                ФормаЭлемента.Required                     = false;
                ФормаЭлемента.EmptyValue                   = "";
                ФормаЭлемента.NullAllow                    = false;
                ФормаЭлемента.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                ФормаЭлемента.FieldName                    = "FormaEHlementa";
                ФормаЭлемента.InformMetaDataOnValueChanged = false;
                ФормаЭлемента.Visible                      = true;
                ФормаЭлемента.Name         = "ФормаЭлемента";
                ФормаЭлемента.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                       new System.Object[] { "" });
                ФормаЭлемента.Description   = "Форма элемента";
                ФормаЭлемента.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.ReadOnly;
                ФормаЭлемента.GroupName     = "";
                ФормаЭлемента.Guid          = NsgService.StringToGuid("8a00ef1a-a178-4a6c-bb8f-78cab2f6c2aa");

                if (!ObjectList.Contains("ФормаЭлемента"))
                {
                    ObjectList.Add(ФормаЭлемента);
                }
            }
            #endregion             //создание NsgSoft.Forms.NsgServiceWorkObjectForm ФормаЭлемента


            #region заполнение полей класса
            //NsgReportObject
            IsLoadedFromDll        = true;
            Name                   = "СервисноеОбслуживание";
            Visible                = true;
            Guid                   = NsgService.StringToGuid("98a908c1-410c-4098-9995-5efc358b26a2");
            DefaultSortingName     = "";
            DefaultElementFormName = "";
            DefaultListFormName    = "";
            ValueMask              = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                               new System.Object[] { "{Представление}" });
            SearchType       = NsgSoft.Database.NsgComparison.Contain;
            SearchFieldName  = "";
            DatabaseName     = "";
            VisibleAdminOnly = true;
            TableName        = "ServiceWorkObject";
            Presentation     = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                         new System.Object[] { "" });
            Description   = "Сервисное обслуживание";
            EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Full;
            GroupName     = "Сервис";

            #endregion             //заполнение полей класса
            #region окончание инициализации NsgSoft.DataObjects.NsgReportObject



            #endregion             //окончание инициализации NsgSoft.DataObjects.NsgReportObject

            #region необходимые операции после создания реквизитов и заполнения полей
            // внести в кэш полей
            this.FieldsCash.Clear();
            foreach (NsgSimpleObject obj in ObjectList.All)
            {
                if (!string.IsNullOrEmpty(obj.FieldName))
                {
                    this.FieldsCash.Add(obj.FieldName, obj.Name);
                }
            }
            #endregion             //необходимые операции после создания реквизитов и заполнения полей
        }
Exemplo n.º 44
0
        private void SplitApartmentForm_Load(object sender, System.EventArgs e)
        {
            this.set_Font(Manager.WindowFont);
            if (!base.get_DesignMode())
            {
                Account account;
                this.SplitApartment = new SplitApartmentDelegate(this.m_OldApartment.SplitApartment);
                this.tpZero.set_Text("0.Начало");
                this.tpFirst.set_Text("1.Лицевые счета");
                this.tpSecond.set_Text("2.Владельцы ПЖ");
                this.tpThird.set_Text("3.Проживающие");
                this.tpFourth.set_Text("4.Оборудование");
                this.tpLast.set_Text("5.Завершение");
                (this.dgvNewApartmentResidents.Columns.get_Item("clmnNumberAprtment") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("Выбыл");
                (this.dgvNewApartmentResidents.Columns.get_Item("clmnNumberAprtment") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("1");
                (this.dgvNewApartmentResidents.Columns.get_Item("clmnNumberAprtment") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("2");
                (this.dgvNewApartmentEquipment.Columns.get_Item("clmnApartmentNumberEq") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("Ликвидирован");
                (this.dgvNewApartmentEquipment.Columns.get_Item("clmnApartmentNumberEq") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("На все");
                (this.dgvNewApartmentEquipment.Columns.get_Item("clmnApartmentNumberEq") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("1");
                (this.dgvNewApartmentEquipment.Columns.get_Item("clmnApartmentNumberEq") as System.Windows.Forms.DataGridViewComboBoxColumn).Items.Add("2");
                (this.dgvAccounts.Columns.get_Item("clmnShare") as DataGridViewNumericColumn).DecimalPlaces = 3;
                (this.dgvAccounts.Columns.get_Item("clmnShare") as DataGridViewNumericColumn).Increment = 0.01M;
                (this.dgvAccounts.Columns.get_Item("clmnShare") as DataGridViewNumericColumn).DefaultValue = 0.5M;
                (this.dgvAccounts.Columns.get_Item("clmnShare") as DataGridViewNumericColumn).Minimum = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnShare") as DataGridViewNumericColumn).Maximum = 1M;
                (this.dgvAccounts.Columns.get_Item("clmnTotalSquare") as DataGridViewNumericColumn).DecimalPlaces = 2;
                (this.dgvAccounts.Columns.get_Item("clmnTotalSquare") as DataGridViewNumericColumn).Increment = 1M;
                (this.dgvAccounts.Columns.get_Item("clmnTotalSquare") as DataGridViewNumericColumn).DefaultValue = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnTotalSquare") as DataGridViewNumericColumn).Minimum = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnTotalSquare") as DataGridViewNumericColumn).Maximum = 100000M;
                (this.dgvAccounts.Columns.get_Item("clmnLivingSquare") as DataGridViewNumericColumn).DecimalPlaces = 2;
                (this.dgvAccounts.Columns.get_Item("clmnLivingSquare") as DataGridViewNumericColumn).Increment = 1M;
                (this.dgvAccounts.Columns.get_Item("clmnLivingSquare") as DataGridViewNumericColumn).DefaultValue = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnLivingSquare") as DataGridViewNumericColumn).Minimum = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnLivingSquare") as DataGridViewNumericColumn).Maximum = 100000M;
                (this.dgvAccounts.Columns.get_Item("clmnHeatingSquare") as DataGridViewNumericColumn).DecimalPlaces = 2;
                (this.dgvAccounts.Columns.get_Item("clmnHeatingSquare") as DataGridViewNumericColumn).Increment = 1M;
                (this.dgvAccounts.Columns.get_Item("clmnHeatingSquare") as DataGridViewNumericColumn).DefaultValue = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnHeatingSquare") as DataGridViewNumericColumn).Minimum = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnHeatingSquare") as DataGridViewNumericColumn).Maximum = 100000M;
                (this.dgvAccounts.Columns.get_Item("clmnBalconySquare") as DataGridViewNumericColumn).DecimalPlaces = 2;
                (this.dgvAccounts.Columns.get_Item("clmnBalconySquare") as DataGridViewNumericColumn).Increment = 1M;
                (this.dgvAccounts.Columns.get_Item("clmnBalconySquare") as DataGridViewNumericColumn).DefaultValue = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnBalconySquare") as DataGridViewNumericColumn).Minimum = 0M;
                (this.dgvAccounts.Columns.get_Item("clmnBalconySquare") as DataGridViewNumericColumn).Maximum = 100000M;
                if (this.m_OldAccount != Account.Null)
                {
                    account = this.m_OldAccount.Clone<Account>();
                    account.ApartmentId = Apartment.Null.Id;
                    account.Number = string.Empty;
                    account.FromDate = account.Created = System.DateTime.Now;
                    this.tbOldApartmentNumber.set_Text(this.m_OldApartment.Number);
                    this.tbOldApartmentAddress.set_Text(this.m_OldApartment.AddressName);
                    if (this.m_OldApartment.FromDate != System.DateTime.MinValue)
                    {
                        this.tbOldApartmentFromDate.set_Text(this.m_OldApartment.FromDate.ToLongDateString());
                    }
                    else
                    {
                        this.tbOldApartmentFromDate.set_Text("");
                    }
                    this.tbOldAccountNumber.set_Text(this.m_OldAccount.Number);
                    this.tbOldAccountOwnerName.set_Text(this.m_OldAccount.OwnerName);
                    this.tbOldAccountFromDate.set_Text(this.m_OldAccount.FromDate.ToLongDateString());
                    this.set_Text("Разделение паспорта жилья по адресу: " + this.m_OldApartment.AddressName);
                }
                else
                {
                    account = new Account();
                }
                this.m_NewApartmentOwners.Add(new ObjectList<ApartmentOwner>());
                this.m_NewApartmentOwners.Add(new ObjectList<ApartmentOwner>());
                foreach (ApartmentOwner owner in this.m_OldApartment.GetApartmentOwners())
                {
                    if ((owner.ToDate == System.DateTime.MinValue) || (owner.ToDate > System.DateTime.Now))
                    {
                        ApartmentOwner owner2 = owner.Clone<ApartmentOwner>();
                        owner2.FromDate = this.dtpSplitDate.Value;
                        owner2.Created = System.DateTime.Now;
                        this.m_NewApartmentOwners.get_Item(0).Add(owner2);
                        this._apartmentOwnerLinks.Add(owner2, owner);
                    }
                }
                ObjectList<Account> list2 = new ObjectList<Account>();
                list2.Add(account);
                Account account2 = new Account {
                    FromDate = this.dtpSplitDate.Value,
                    Created = System.DateTime.Now,
                    HouseHolderId = this.m_OldAccount.HouseHolderId,
                    NeedPrintNotice = this.m_OldAccount.NeedPrintNotice
                };
                list2.Add(account2);
                this.bsNewAccounts.set_DataSource(list2);
                ObjectList<Apartment> list3 = new ObjectList<Apartment> {
                    new Apartment(),
                    new Apartment()
                };
                foreach (Apartment apartment in list3)
                {
                    apartment.AdrId = this.m_OldApartment.AdrId;
                    apartment.HouseId = this.m_OldApartment.HouseId;
                    apartment.FloorHouse = this.m_OldApartment.FloorHouse;
                    apartment.DoorWay = this.m_OldApartment.DoorWay;
                }
                this.bsNewApartments.set_DataSource(list3);
                AccountHouseHolder holder = this.m_OldAccount.FindCurrentAccountHouseHolder().Clone<AccountHouseHolder>();
                holder.Code = 0;
                this.m_AccountHouseHolders.Add(list2.get_Item(0), (list2.get_Item(0).HouseHolderId > 0L) ? holder : new AccountHouseHolder());
                AccountHouseHolder holder2 = this.m_OldAccount.FindCurrentAccountHouseHolder().Clone<AccountHouseHolder>();
                holder2.Code = 0;
                this.m_AccountHouseHolders.Add(list2.get_Item(1), holder2);
                foreach (ApartmentResident resident in this.m_OldApartment.GetApartmentResidents())
                {
                    if ((resident.ToDate == System.DateTime.MinValue) || (resident.ToDate == System.DateTime.Now))
                    {
                        ApartmentResident resident2 = resident.Clone<ApartmentResident>();
                        resident2.FromDate = this.dtpSplitDate.Value;
                        resident2.Created = System.DateTime.Now;
                        resident2.ApartmentId = Apartment.Null.Id;
                        this.m_NewApartmentResidents.Add(resident2);
                        this._apartmentResidentLinks.Add(resident2, resident);
                    }
                }
                this.bsNewApartmentResidents.set_DataSource(this.m_NewApartmentResidents);
                foreach (ApartmentEquipment equipment in this.m_OldApartment.GetApartmentEquipments())
                {
                    if ((equipment.ToDate == System.DateTime.MinValue) || (equipment.ToDate == System.DateTime.Now))
                    {
                        ApartmentEquipment equipment2 = equipment.Clone<ApartmentEquipment>();
                        equipment2.ApartmentId = Apartment.Null.Id;
                        equipment2.Created = System.DateTime.Now;
                        equipment2.FromDate = this.dtpSplitDate.Value;
                        this.m_NewApartmentEquipment.Add(equipment2);
                        this._equipmentLinks.Add(equipment2, equipment);
                    }
                }
                this.bsNewApartmentEquipment.set_DataSource(this.m_NewApartmentEquipment);
                if (AccountCashlessProperty.FindByAccountNumber(this.m_OldAccount.Number) != AccountCashlessProperty.Null)
                {
                    this.cbCashlessAccounts.set_Enabled(true);
                    this.cbCashlessAccounts.Items.Add("Удаление");
                    this.cbCashlessAccounts.Items.Add("1");
                    this.cbCashlessAccounts.Items.Add("2");
                }
                switch (this.m_OldApartment.AddressLevel)
                {
                    case 30:
                        this.m_IsHouse = true;
                        break;

                    case 40:
                        this.m_IsHouse = false;
                        break;

                    default:
                        Messages.ShowError("Ошибка. Адрес разделяемого паспорта жилья не является ни домом, ни квартирой.");
                        base.Close();
                        break;
                }
                if (!this.m_IsHouse)
                {
                    string name = this.m_OldApartment.GetAdr().Name;
                    foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvAccounts.Rows)
                    {
                        row.Cells.get_Item("clmnFlatName").set_Value(name);
                    }
                }
                foreach (System.Windows.Forms.DataGridViewRow row2 in (System.Collections.IEnumerable) this.dgvAccounts.Rows)
                {
                    row2.Cells.get_Item("clmnTotalSquare").set_Value(this.m_OldTotalSquare / 2M);
                    row2.Cells.get_Item("clmnLivingSquare").set_Value(this.m_OldLivingSquare / 2M);
                    row2.Cells.get_Item("clmnHeatingSquare").set_Value(this.m_OldHeatingSquare / 2M);
                    row2.Cells.get_Item("clmnBalconySquare").set_Value(this.m_OldBalconySquare / 2M);
                }
                this.vwAccountSettings.SetAccount(this.bsNewAccounts.get_Current() as Account);
                this.vwAccountSettings.SetAccountHouseHolder(this.m_AccountHouseHolders[this.bsNewAccounts.get_Current() as Account]);
            }
        }
Exemplo n.º 45
0
 /// <summary>
 /// Add a vertex to the queue
 /// </summary>
 /// <param name="passedObject">Vertex to add to the queue</param>
 public void Enqueue(Vertex passedObject)
 {
     ObjectList.Add(passedObject);
 }
        /// <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);
        }
        private IList GetCandidateFixtureTypes(Assembly assembly, IList names)
        {
            IList types = assembly.GetTypes();

            if (names == null || names.Count == 0)
                return types;

            ObjectList result = new ObjectList();

            foreach (string name in names)
            {
                Type fixtureType = assembly.GetType(name);
                if (fixtureType != null)
                    result.Add(fixtureType);
                else
                {
                    string prefix = name + ".";

                    foreach (Type type in types)
                        if (type.FullName.StartsWith(prefix))
                            result.Add(type);
                }
            }

            return result;
        }
Exemplo n.º 48
0
 private void tsbtnSaveDebtAccounts_Click(object sender, System.EventArgs e)
 {
     Organization organization = this.selectOrganizationForDocument.SelectedOrganization ?? Organization.Null;
     OrgDocument document = this.selectOrgDocument1.SelectedOrgDocument ?? OrgDocument.Null;
     if (this.dbxSaveDate.IsNull)
     {
         Messages.ShowWarning("Введите дату для сохранения списка должников");
     }
     else
     {
         bool flag = true;
         foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvDebtors.Rows)
         {
             if ((row.Cells.get_Item("selected").get_Value() != null) && ((bool) row.Cells.get_Item("selected").get_Value()))
             {
                 flag = false;
                 break;
             }
         }
         if (flag)
         {
             Messages.ShowWarning("Выберите лицевые счета");
         }
         else
         {
             DebtDocument document2;
             document2 = new DebtDocument {
                 OrgDocId = document.Id,
                 FromDate = this.dbxSaveDate.Value,
                 HouseHolderId = organization.Id,
                 Created = System.DateTime.Now,
                 PaymentToDate = this.cbPaymentPeriod.get_Checked() ? this.PeriodPayment : document2.Created
             };
             document2.SaveChanges();
             ObjectList<DebtAccount> debtAccounts = new ObjectList<DebtAccount>();
             this.dgvDebtors.EndEdit();
             ObjectList<DebtAccountService> debtAccountServices = new ObjectList<DebtAccountService>();
             this.dgvAccountServices.EndEdit();
             foreach (System.Windows.Forms.DataGridViewRow row2 in (System.Collections.IEnumerable) this.dgvDebtors.Rows)
             {
                 if ((row2.Cells.get_Item("selected").get_Value() != null) && ((bool) row2.Cells.get_Item("selected").get_Value()))
                 {
                     DebtAccount account = new DebtAccount {
                         AccountId = (long) ((long) row2.Cells.get_Item("accountId").get_Value()),
                         DebtSumm = (decimal) row2.Cells.get_Item("debt").get_Value(),
                         MonthCount = (int) ((int) row2.Cells.get_Item("monthCount").get_Value())
                     };
                     debtAccounts.Add(account);
                     Account account2 = Account.FindById((long) ((long) row2.Cells.get_Item("accountId").get_Value()));
                     foreach (System.Data.DataRow row3 in Mappers.DebtorMapper.FindByAccount(this.Providers, this.Holders, this.ServiceTypes, this.Services, account2, this.Period, false, (long) this.selectFasetApartmentType.Id, this.PeriodPayment, this.m_cityBoroughs, this.AccountHolders).Tables.get_Item(0).Rows)
                     {
                         DebtAccountService service = new DebtAccountService {
                             AccountServiceId = System.Convert.ToInt64(row3.get_Item("accountServiceId").ToString()),
                             DebtSumm = System.Convert.ToDecimal(row3.get_Item("debt").ToString()),
                             MonthCount = System.Convert.ToInt16(row3.get_Item("monthCount").ToString()),
                             AccountId = account2.Id
                         };
                         debtAccountServices.Add(service);
                     }
                 }
             }
             DebtAccount.SaveDebtAccounts(document2, debtAccounts, debtAccountServices);
             if (Messages.QuestionYesNo(this, "Список сохранен, сделать групповое заведение исков по сохраненным в список должникам?") != System.Windows.Forms.DialogResult.Yes)
             {
                 document2.SaveDebtActions(false);
             }
             else
             {
                 document2.SaveDebtActions(true);
                 Messages.ShowMessage("Иски по данному документу заведены");
             }
         }
     }
 }
Exemplo n.º 49
0
 private void DebtActionsAddChangeForm_Load(object sender, System.EventArgs e)
 {
     this.set_Font(Manager.WindowFont);
     this.m_DebtAction.BeginEdit();
     this.sfdStatus.Faset = FasetsEnum.ActStatuses;
     this.sfdStatus.RefreshValues();
     ObjectList<DebtActionStatus> list = new ObjectList<DebtActionStatus>();
     list = ObjectWithId.FindAll<DebtActionStatus>();
     list.Add(DebtActionStatus.DebtActionStatusIsNull());
     this.sfdStatusType.set_DataSource(list);
     this.bsDebtAction.set_DataSource(this.m_DebtAction);
     if (this.m_DebtAction.IsNew)
     {
         this.set_Text("Добавление иска");
         this.btnOk.set_Text("Добавить");
         this.bsDebtDocuments.set_DataSource(DebtDocument.GetDocumentNoAction(this.m_DebtAction.DebtAffairId));
     }
     else
     {
         this.set_Text("Изменение иска");
         this.btnOk.set_Text("Изменить");
         this.bsDebtDocuments.set_DataSource(ObjectWithId.FindById<DebtDocument>(this.m_DebtAction.DebtDocumentId));
         this.bsDebtAccounts.set_DataSource(DebtAccount.FindByDebtDocumentId(this.m_DebtAction.DebtDocumentId));
         this.dgvDebtAccounts.set_Enabled(false);
         if (this.m_DebtAction.FromDate == System.DateTime.MinValue)
         {
             this.dpDebtActiop.DateBeginClear();
         }
         else
         {
             this.dpDebtActiop.DateBegin = this.m_DebtAction.FromDate;
         }
         if (this.m_DebtAction.ToDate == System.DateTime.MinValue)
         {
             this.dpDebtActiop.DateEndClear();
         }
         else
         {
             this.dpDebtActiop.DateEnd = this.m_DebtAction.ToDate;
         }
         if (this.m_DebtAction.StatusTypeId != 0)
         {
             DebtActionStatus status = ObjectWithId.FindById<DebtActionStatus>((long) this.m_DebtAction.StatusTypeId);
             this.sfdStatusType.set_SelectedItem(this.sfdStatusType.Items.get_Item(this.sfdStatusType.FindString(status.Name)));
         }
         this.sfdStatus.SetSelectedFasetItem(this.m_DebtAction.StatusId);
         this.tbNameAction.set_Text(this.m_DebtAction.NameAction);
     }
 }
Exemplo n.º 50
0
 private ObjectList<Account> GetSelectedAccounts()
 {
     ObjectList<Account> list = new ObjectList<Account>();
     this.dgvDebtors.EndEdit();
     foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvDebtors.Rows)
     {
         if ((row.Cells.get_Item("selected").get_Value() != null) && ((bool) row.Cells.get_Item("selected").get_Value()))
         {
             Account @null = Account.Null;
             try
             {
                 @null = Account.FindById((long) ((long) row.Cells.get_Item("accountId").get_Value()));
             }
             catch (System.Exception exception)
             {
                 if (exception.GetType() == typeof(ObjectNotFoundException))
                 {
                     continue;
                 }
             }
             list.Add(@null);
         }
     }
     return list;
 }
Exemplo n.º 51
0
 byte[] IGXDLMSBase.Invoke(GXDLMSSettings settings, ValueEventArgs e)
 {
     //Check reply_to_HLS_authentication
     if (e.Index == 1)
     {
         UInt32 ic = 0;
         byte[] secret;
         if (settings.Authentication == Authentication.HighGMAC)
         {
             secret = settings.SourceSystemTitle;
             GXByteBuffer bb = new GXByteBuffer(e.Parameters as byte[]);
             bb.GetUInt8();
             ic = bb.GetUInt32();
         }
         else
         {
             secret = Secret;
         }
         byte[] serverChallenge = GXSecure.Secure(settings, settings.Cipher, ic, settings.StoCChallenge, secret);
         byte[] clientChallenge = (byte[])e.Parameters;
         if (serverChallenge != null && clientChallenge != null && GXCommon.Compare(serverChallenge, clientChallenge))
         {
             if (settings.Authentication == Authentication.HighGMAC)
             {
                 secret = settings.Cipher.SystemTitle;
                 ic     = settings.Cipher.InvocationCounter;
             }
             else
             {
                 secret = Secret;
             }
             AssociationStatus = AssociationStatus.Associated;
             return(GXSecure.Secure(settings, settings.Cipher, ic, settings.CtoSChallenge, secret));
         }
         else //If the password does not match.
         {
             AssociationStatus = AssociationStatus.NonAssociated;
             return(null);
         }
     }
     else if (e.Index == 2)
     {
         byte[] tmp = e.Parameters as byte[];
         if (tmp == null || tmp.Length == 0)
         {
             e.Error = ErrorCode.ReadWriteDenied;
         }
         else
         {
             Secret = tmp;
         }
     }
     else if (e.Index == 3)
     {
         //Add COSEM object.
         GXDLMSObject obj = GetObject(settings, e.Parameters as object[]);
         //Unknown objects are not add.
         if (obj is IGXDLMSBase)
         {
             if (ObjectList.FindByLN(obj.ObjectType, obj.LogicalName) == null)
             {
                 ObjectList.Add(obj);
             }
             if (settings.Objects.FindByLN(obj.ObjectType, obj.LogicalName) == null)
             {
                 settings.Objects.Add(obj);
             }
         }
     }
     else if (e.Index == 4)
     {
         //Remove COSEM object.
         GXDLMSObject obj = GetObject(settings, e.Parameters as object[]);
         //Unknown objects are not removed.
         if (obj is IGXDLMSBase)
         {
             GXDLMSObject t = ObjectList.FindByLN(obj.ObjectType, obj.LogicalName);
             if (t != null)
             {
                 ObjectList.Remove(t);
             }
             //Item is not removed from all objects. It might be that use wants remove object only from association view.
         }
     }
     else if (e.Index == 5)
     {
         object[] tmp = e.Parameters as object[];
         if (tmp == null || tmp.Length != 2)
         {
             e.Error = ErrorCode.ReadWriteDenied;
         }
         else
         {
             UserList.Add(new KeyValuePair <byte, string>(Convert.ToByte(tmp[0]), Convert.ToString(tmp[1])));
         }
     }
     else if (e.Index == 6)
     {
         object[] tmp = e.Parameters as object[];
         if (tmp == null || tmp.Length != 2)
         {
             e.Error = ErrorCode.ReadWriteDenied;
         }
         else
         {
             UserList.Remove(new KeyValuePair <byte, string>(Convert.ToByte(tmp[0]), Convert.ToString(tmp[1])));
         }
     }
     else
     {
         e.Error = ErrorCode.ReadWriteDenied;
     }
     return(null);
 }
Exemplo n.º 52
0
 public static ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress> GetByStatus(ExchangeStatus status, Area filterArea)
 {
     System.Collections.Generic.List<long> addresses = new System.Collections.Generic.List<long>();
     ObjectList<ExchangeRequest> exchangeRequestsGroup = ExchangeRequest.GetExchangeRequestsGroup(ExchangeRequestType.Address, status);
     ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress> list3 = new ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>();
     foreach (ExchangeRequest request in exchangeRequestsGroup)
     {
         AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress address = Serializer.FromXml<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>(request.XmlIn);
         address.DateIn = request.DateIn;
         address.ExchangeRequestId = request.Id;
         address.LocalAddressId = request.AddressId;
         if (address.LocalAddressId != LocalAddress.Null.Id)
         {
             addresses.Add(address.LocalAddressId);
         }
         address.Address = string.Concat((string[]) new string[] { ((address.LastChangeDate != Constants.NullDate) ? ((string) address.LastChangeDate.ToShortDateString()) : ((string) address.DateIn.ToShortDateString())), ";", address.StreetSocr, " ", address.Street, ";", address.HouseSocr, " ", address.House, ";", address.FlatSocr, " ", address.Flat });
         list3.Add(address);
     }
     ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress> list4 = new ObjectList<AIS.SN.Model.DomainObjects.Views.ExchangeRequestAddress>();
     if ((filterArea == null) || (filterArea == Area.Null))
     {
         return list3.ApplySort("Address");
     }
     Area lhs = new Area {
         StatusTemporary = 1
     };
     lhs.SaveChanges();
     lhs.SaveAddresses(addresses);
     System.Collections.Generic.IList<long> filteredApartmentLocalAddresses = Area.GetFilteredApartmentLocalAddresses(lhs, filterArea);
     for (int i = 0; i < list3.get_Count(); i = (int) (i + 1))
     {
         long num2 = (list3.get_Item(i).RemoteAddressId == 0L) ? list3.get_Item(i).LocalAddressId : list3.get_Item(i).RemoteAddressId;
         if (filteredApartmentLocalAddresses.Contains(num2))
         {
             list4.Add(list3.get_Item(i));
         }
     }
     return list4.ApplySort("Address");
 }
Exemplo n.º 53
0
        static void Main(string[] args)
        {
            Console.WriteLine ("Constructing example data ...");
              Foo foo1 = new Foo ();
              foo1.bar = "foobar";
              foo1.answer = "42";

              Foo foo2 = new Foo ();
              foo2.bar = "barfoo";
              foo2.answer = "none";

              ListItem listItem = new ListItem ();
              listItem.foo1 = foo1;
              listItem.foo2 = foo2;

              ObjectList objectList = new ObjectList ();
              objectList.Add ("item1", listItem);
              objectList.Add ("item2", listItem);

              String realJson = "{ \"item1\":{\"foo1\":{\"bar\":\"foobar\",\"answer\":\"42\"},\"foo2\":{\"bar\":\"barfoo\",\"answer\":\"none\"}},";
              realJson = realJson + "\"item2\":{\"foo1\":{\"bar\":\"foobar\",\"answer\":\"42\"},\"foo2\":{\"bar\":\"barfoo\",\"answer\":\"none\"}} }";

              Console.WriteLine ("Serializing data ...");
              Console.WriteLine (String.Format("Expected JSON: `{0}`", realJson));

              JsonSerializer serializer = new JsonSerializer ();
              String json1 = serializer.Serialize (objectList);
              Console.WriteLine (String.Format ("RestSharp JSON: `{0}`", json1));

              Console.WriteLine ("Deserializing data ...");

              // Does not work.
              try {
            Console.WriteLine("Attempting to deserialize RestSharp JSON ...");
            JsonDeserializer deserializer = new JsonDeserializer();
            RestResponse response = new RestResponse();
            response.Content = json1;
            var decoded = deserializer.Deserialize<ObjectList>(response);
            Console.WriteLine("Success ...");
              } catch (Exception ex) {
            Console.WriteLine ("Deserialization failed:");
            Console.WriteLine (ex.Message);
            Console.WriteLine (ex.StackTrace);
              }

              // Does not work.
              try {
            Console.WriteLine("Attempting to deserialize expected JSON with RestSharp ...");
            JsonDeserializer deserializer = new JsonDeserializer();
            RestResponse response = new RestResponse();
            response.Content = realJson;
            var decoded = deserializer.Deserialize<ObjectList>(response);
            Console.WriteLine("Success ...");
              } catch (Exception ex) {
            Console.WriteLine ("Deserialization failed:");
            Console.WriteLine (ex.Message);
            Console.WriteLine (ex.StackTrace);
              }

              // Does not work.
              try {
            Console.WriteLine("Attempting to deserialize RestSharp JSON with JSON.NET ...");
            ObjectList list = Newtonsoft.Json.JsonConvert.DeserializeObject<ObjectList>(json1);
            Console.WriteLine("Success ...");
              } catch (Exception ex) {
            Console.WriteLine ("Deserialization failed:");
            Console.WriteLine (ex.Message);
            Console.WriteLine (ex.StackTrace);
              }

              // Works.
              try {
            Console.WriteLine("Attempting to deserialize expected JSON with JSON.NET ...");
            ObjectList list = Newtonsoft.Json.JsonConvert.DeserializeObject<ObjectList>(realJson);
            Console.WriteLine("Success ...");
              } catch (Exception ex) {
            Console.WriteLine ("Deserialization failed:");
            Console.WriteLine (ex.Message);
            Console.WriteLine (ex.StackTrace);
              }
        }
Exemplo n.º 54
0
 private void bckWrkrProcessSpliting_DoWork(object sender, DoWorkEventArgs e)
 {
     int num3;
     int num4;
     ObjectList<Apartment> list = new ObjectList<Apartment>();
     foreach (Apartment apartment in this.bsNewApartments)
     {
         list.Add(apartment);
     }
     ObjectList<Account> list2 = new ObjectList<Account>();
     foreach (Account account in this.bsNewAccounts)
     {
         list2.Add(account);
     }
     int num = System.Convert.ToInt32(this.numApartmentCount.Value);
     decimal[] numArray = new decimal[num];
     System.Collections.Generic.Dictionary<Apartment, ApartmentArea> dictionary = new System.Collections.Generic.Dictionary<Apartment, ApartmentArea>(num);
     string[] strArray = new string[num];
     int index = 0;
     foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvAccounts.Rows)
     {
         numArray[index] = System.Convert.ToDecimal(row.Cells.get_Item("clmnShare").get_Value());
         ApartmentArea area = new ApartmentArea {
             Total = System.Convert.ToDecimal(row.Cells.get_Item("clmnTotalSquare").get_Value()),
             Living = System.Convert.ToDecimal(row.Cells.get_Item("clmnLivingSquare").get_Value()),
             Heating = System.Convert.ToDecimal(row.Cells.get_Item("clmnHeatingSquare").get_Value()),
             Balcony = System.Convert.ToDecimal(row.Cells.get_Item("clmnBalconySquare").get_Value())
         };
         dictionary.Add(list.get_Item(index), area);
         strArray[index] = (row.Cells.get_Item("clmnFlatName").get_Value() == null) ? string.Empty : row.Cells.get_Item("clmnFlatName").get_Value().ToString();
         index = (int) (index + 1);
     }
     System.Collections.Generic.List<ObjectList<ApartmentResident>> list3 = new System.Collections.Generic.List<ObjectList<ApartmentResident>>(num);
     for (index = 0; index < num; index = (int) (index + 1))
     {
         list3.Add(new ObjectList<ApartmentResident>());
     }
     foreach (System.Windows.Forms.DataGridViewRow row2 in (System.Collections.IEnumerable) this.dgvNewApartmentResidents.Rows)
     {
         if (int.TryParse(row2.Cells.get_Item("clmnNumberAprtment").get_Value().ToString(), ref num3))
         {
             list3.get_Item((int) (num3 - 1)).Add(this.bsNewApartmentResidents.get_Item(this.dgvNewApartmentResidents.Rows.IndexOf(row2)) as ApartmentResident);
         }
     }
     System.Collections.Generic.List<ObjectList<ApartmentEquipment>> list4 = new System.Collections.Generic.List<ObjectList<ApartmentEquipment>>(num);
     for (index = 0; index < num; index = (int) (index + 1))
     {
         list4.Add(new ObjectList<ApartmentEquipment>());
     }
     foreach (System.Windows.Forms.DataGridViewRow row3 in (System.Collections.IEnumerable) this.dgvNewApartmentEquipment.Rows)
     {
         if (int.TryParse(row3.Cells.get_Item("clmnApartmentNumberEq").get_Value().ToString(), ref num3))
         {
             list4.get_Item((int) (num3 - 1)).Add(this.bsNewApartmentEquipment.get_Item(this.dgvNewApartmentEquipment.Rows.IndexOf(row3)) as ApartmentEquipment);
         }
         else if (row3.Cells.get_Item("clmnApartmentNumberEq").get_Value().ToString() == "На все")
         {
             foreach (ObjectList<ApartmentEquipment> list5 in list4)
             {
                 list5.Add((this.bsNewApartmentEquipment.get_Item(this.dgvNewApartmentEquipment.Rows.IndexOf(row3)) as ApartmentEquipment).Clone<ApartmentEquipment>());
             }
         }
     }
     if ((this.cbCashlessAccounts.get_Enabled() && (this.cbCashlessAccounts.get_SelectedItem() != null)) && int.TryParse(this.cbCashlessAccounts.get_SelectedItem().ToString(), ref num4))
     {
         num4 = (int) (num4 - 1);
     }
     else
     {
         num4 = -1;
     }
     try
     {
         object[] objArray = new object[] { this.m_OldAccount, this.dtpSplitDate.Value, list, list2, this.m_NewApartmentOwners, list3, list4, numArray, dictionary, strArray, (int) num4, this._apartmentOwnerLinks, this._apartmentResidentLinks, this._equipmentLinks, this.m_AccountHouseHolders };
         base.Invoke(this.SplitApartment, objArray);
         e.set_Result(null);
     }
     catch (System.Exception exception)
     {
         e.set_Result(exception);
     }
 }
        /// <summary>
        /// Инициализация реквизитов объекта
        /// </summary>
        protected override void CreatePreDefinedFields()
        {
            #region необходимые операции до создания реквизитов и заполнения полей
            if (NsgSettings.Regime == NsgSoft.Common.NsgViewTypes.Load)
            {
                base.CreatePreDefinedFields();
            }
            #endregion             //необходимые операции до создания реквизитов и заполнения полей
            #region начало инициализации NsgSoft.DataObjects.NsgDataTable



            #endregion             //начало инициализации NsgSoft.DataObjects.NsgDataTable

            #region создание System.Guid Идентификатор
            {
                NsgDataGuid Идентификатор = null;
                if (ObjectList.Contains("Идентификатор"))
                {
                    Идентификатор = ObjectList["Идентификатор"] as NsgDataGuid;
                }
                else
                {
                    Идентификатор = new NsgDataGuid();
                }
                //NsgDataGuid
                Идентификатор.IsLoadedFromDll              = true;
                Идентификатор.StringFormat                 = "";
                Идентификатор.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Идентификатор.IncludeInPredefined          = false;
                Идентификатор.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Идентификатор.Required                     = false;
                Идентификатор.EmptyValue                   = "";
                Идентификатор.NullAllow                    = false;
                Идентификатор.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.UniqueControl;
                Идентификатор.FieldName                    = "_ID";
                Идентификатор.SaveInDatabase               = true;
                Идентификатор.InformMetaDataOnValueChanged = false;
                Идентификатор.Visible                      = true;
                Идентификатор.Name         = "Идентификатор";
                Идентификатор.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                       new System.Object[] { "" });
                Идентификатор.Description   = "Идентификатор";
                Идентификатор.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.ReadOnly;
                Идентификатор.GroupName     = "";
                Идентификатор.Guid          = NsgService.StringToGuid("60bfd858-473b-4882-b5e3-e82b8195954b");

                if (!ObjectList.Contains("Идентификатор"))
                {
                    ObjectList.Add(Идентификатор);
                }
            }
            #endregion             //создание System.Guid Идентификатор

            #region создание System.Int64 Автоинкремент
            {
                NsgDataInteger Автоинкремент = null;
                if (ObjectList.Contains("Автоинкремент"))
                {
                    Автоинкремент = ObjectList["Автоинкремент"] as NsgDataInteger;
                }
                else
                {
                    Автоинкремент = new NsgDataInteger();
                }
                //NsgDataInteger
                Автоинкремент.IsLoadedFromDll              = true;
                Автоинкремент.DefaultValue                 = 0M;
                Автоинкремент.MinValue                     = 0M;
                Автоинкремент.MaxValue                     = 0M;
                Автоинкремент.UseCalculator                = true;
                Автоинкремент.StringFormat                 = "";
                Автоинкремент.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Автоинкремент.IncludeInPredefined          = false;
                Автоинкремент.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Автоинкремент.Required                     = false;
                Автоинкремент.EmptyValue                   = "";
                Автоинкремент.NullAllow                    = false;
                Автоинкремент.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.UniqueControl;
                Автоинкремент.FieldName                    = "_AutoInc";
                Автоинкремент.SaveInDatabase               = true;
                Автоинкремент.InformMetaDataOnValueChanged = false;
                Автоинкремент.Visible                      = true;
                Автоинкремент.Name         = "Автоинкремент";
                Автоинкремент.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                       new System.Object[] { "" });
                Автоинкремент.Description   = "Автоинкремент";
                Автоинкремент.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Hidden;
                Автоинкремент.GroupName     = "";
                Автоинкремент.Guid          = NsgService.StringToGuid("370b4c7a-62eb-4378-999d-e84205a97b21");

                if (!ObjectList.Contains("Автоинкремент"))
                {
                    ObjectList.Add(Автоинкремент);
                }
            }
            #endregion             //создание System.Int64 Автоинкремент

            #region создание NsgSoft.DataObjects.NsgReferencedObject Владелец
            {
                NsgDataUntypedReference Владелец = null;
                if (ObjectList.Contains("Владелец"))
                {
                    Владелец = ObjectList["Владелец"] as NsgDataUntypedReference;
                }
                else
                {
                    Владелец = new NsgDataUntypedReference();
                }
                //NsgDataUntypedReference
                Владелец.IsLoadedFromDll           = true;
                Владелец.FilterTypeForConfigurator = NsgSoft.DataObjects.NsgFiltration.List;
                Владелец.FilterForConfigurator     = "";
                Владелец.ReferentName                 = "";
                Владелец.ReferentGroup                = "";
                Владелец.TypeSelectorName             = "";
                Владелец.SaveInDatabase               = true;
                Владелец.OwnerName                    = "";
                Владелец.AllowEmptyOwner              = false;
                Владелец.StringFormat                 = "";
                Владелец.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Владелец.IncludeInPredefined          = false;
                Владелец.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Владелец.Required                     = false;
                Владелец.EmptyValue                   = "";
                Владелец.NullAllow                    = false;
                Владелец.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.Sort;
                Владелец.FieldName                    = "_Owner";
                Владелец.InformMetaDataOnValueChanged = false;
                Владелец.Visible                      = true;
                Владелец.Name         = "Владелец";
                Владелец.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                  new System.Object[] { "Владелец" });
                Владелец.Description   = "Владелец";
                Владелец.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Владелец.GroupName     = "";
                Владелец.Guid          = NsgService.StringToGuid("8cc27a82-3252-4675-ac8a-81bd03f13e17");

                if (!ObjectList.Contains("Владелец"))
                {
                    ObjectList.Add(Владелец);
                }
            }
            #endregion             //создание NsgSoft.DataObjects.NsgReferencedObject Владелец

            #region создание System.Int64 НомерСтроки
            {
                NsgDataInteger НомерСтроки = null;
                if (ObjectList.Contains("НомерСтроки"))
                {
                    НомерСтроки = ObjectList["НомерСтроки"] as NsgDataInteger;
                }
                else
                {
                    НомерСтроки = new NsgDataInteger();
                }
                //NsgDataInteger
                НомерСтроки.IsLoadedFromDll              = true;
                НомерСтроки.DefaultValue                 = 0M;
                НомерСтроки.MinValue                     = 0M;
                НомерСтроки.MaxValue                     = 0M;
                НомерСтроки.UseCalculator                = true;
                НомерСтроки.StringFormat                 = "";
                НомерСтроки.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                НомерСтроки.IncludeInPredefined          = false;
                НомерСтроки.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                НомерСтроки.Required                     = false;
                НомерСтроки.EmptyValue                   = "";
                НомерСтроки.NullAllow                    = false;
                НомерСтроки.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                НомерСтроки.FieldName                    = "_RowNumber";
                НомерСтроки.SaveInDatabase               = true;
                НомерСтроки.InformMetaDataOnValueChanged = false;
                НомерСтроки.Visible                      = true;
                НомерСтроки.Name         = "НомерСтроки";
                НомерСтроки.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                     new System.Object[] { "" });
                НомерСтроки.Description   = "Номер строки";
                НомерСтроки.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Hidden;
                НомерСтроки.GroupName     = "";
                НомерСтроки.Guid          = NsgService.StringToGuid("dbb58292-156c-4fbc-b73b-dec01e4cbbf3");

                if (!ObjectList.Contains("НомерСтроки"))
                {
                    ObjectList.Add(НомерСтроки);
                }
            }
            #endregion             //создание System.Int64 НомерСтроки

            #region создание System.Guid ИдентификаторОбъекта
            {
                NsgDataGuid ИдентификаторОбъекта = null;
                if (ObjectList.Contains("ИдентификаторОбъекта"))
                {
                    ИдентификаторОбъекта = ObjectList["ИдентификаторОбъекта"] as NsgDataGuid;
                }
                else
                {
                    ИдентификаторОбъекта = new NsgDataGuid();
                }
                //NsgDataGuid
                ИдентификаторОбъекта.IsLoadedFromDll              = true;
                ИдентификаторОбъекта.StringFormat                 = "";
                ИдентификаторОбъекта.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                ИдентификаторОбъекта.IncludeInPredefined          = false;
                ИдентификаторОбъекта.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                ИдентификаторОбъекта.Required                     = false;
                ИдентификаторОбъекта.EmptyValue                   = "";
                ИдентификаторОбъекта.NullAllow                    = false;
                ИдентификаторОбъекта.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                ИдентификаторОбъекта.FieldName                    = "_ObjectID";
                ИдентификаторОбъекта.SaveInDatabase               = true;
                ИдентификаторОбъекта.InformMetaDataOnValueChanged = false;
                ИдентификаторОбъекта.Visible                      = true;
                ИдентификаторОбъекта.Name         = "ИдентификаторОбъекта";
                ИдентификаторОбъекта.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                              new System.Object[] { "Идентификатор объекта" });
                ИдентификаторОбъекта.Description   = "Идентификатор объекта";
                ИдентификаторОбъекта.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                ИдентификаторОбъекта.GroupName     = "";
                ИдентификаторОбъекта.Guid          = NsgService.StringToGuid("c2db9833-8589-4107-a879-55f2ded9fe91");

                if (!ObjectList.Contains("ИдентификаторОбъекта"))
                {
                    ObjectList.Add(ИдентификаторОбъекта);
                }
            }
            #endregion             //создание System.Guid ИдентификаторОбъекта

            #region создание System.Guid ОбъектМетаданных
            {
                NsgDataGuid ОбъектМетаданных = null;
                if (ObjectList.Contains("ОбъектМетаданных"))
                {
                    ОбъектМетаданных = ObjectList["ОбъектМетаданных"] as NsgDataGuid;
                }
                else
                {
                    ОбъектМетаданных = new NsgDataGuid();
                }
                //NsgDataGuid
                ОбъектМетаданных.IsLoadedFromDll              = true;
                ОбъектМетаданных.StringFormat                 = "";
                ОбъектМетаданных.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                ОбъектМетаданных.IncludeInPredefined          = false;
                ОбъектМетаданных.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                ОбъектМетаданных.Required                     = false;
                ОбъектМетаданных.EmptyValue                   = "";
                ОбъектМетаданных.NullAllow                    = false;
                ОбъектМетаданных.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                ОбъектМетаданных.FieldName                    = "_MetaObject";
                ОбъектМетаданных.SaveInDatabase               = true;
                ОбъектМетаданных.InformMetaDataOnValueChanged = false;
                ОбъектМетаданных.Visible                      = true;
                ОбъектМетаданных.Name         = "ОбъектМетаданных";
                ОбъектМетаданных.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                          new System.Object[] { "Объект метаданных" });
                ОбъектМетаданных.Description   = "Объект метаданных";
                ОбъектМетаданных.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                ОбъектМетаданных.GroupName     = "";
                ОбъектМетаданных.Guid          = NsgService.StringToGuid("e4139d16-0052-46ce-b93f-1d4ffac371fb");

                if (!ObjectList.Contains("ОбъектМетаданных"))
                {
                    ObjectList.Add(ОбъектМетаданных);
                }
            }
            #endregion             //создание System.Guid ОбъектМетаданных

            #region создание System.String Наименование
            {
                NsgDataString Наименование = null;
                if (ObjectList.Contains("Наименование"))
                {
                    Наименование = ObjectList["Наименование"] as NsgDataString;
                }
                else
                {
                    Наименование = new NsgDataString();
                }
                //NsgDataString
                Наименование.IsLoadedFromDll              = true;
                Наименование.Length                       = 50;
                Наименование.StringFormat                 = "";
                Наименование.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                Наименование.IncludeInPredefined          = false;
                Наименование.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                Наименование.Required                     = false;
                Наименование.EmptyValue                   = "";
                Наименование.NullAllow                    = false;
                Наименование.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                Наименование.FieldName                    = "_Name";
                Наименование.SaveInDatabase               = true;
                Наименование.InformMetaDataOnValueChanged = false;
                Наименование.Visible                      = true;
                Наименование.Name         = "Наименование";
                Наименование.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                      new System.Object[] { "Имя настройки" });
                Наименование.Description   = "Имя настройки";
                Наименование.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                Наименование.GroupName     = "";
                Наименование.Guid          = NsgService.StringToGuid("3c1d3a6b-9cfd-4717-bc66-8d9ed5b1da48");

                if (!ObjectList.Contains("Наименование"))
                {
                    ObjectList.Add(Наименование);
                }
            }
            #endregion             //создание System.String Наименование

            #region создание System.String XmlText
            {
                NsgDataString XmlText = null;
                if (ObjectList.Contains("XmlText"))
                {
                    XmlText = ObjectList["XmlText"] as NsgDataString;
                }
                else
                {
                    XmlText = new NsgDataString();
                }
                //NsgDataString
                XmlText.IsLoadedFromDll              = true;
                XmlText.Length                       = 0;
                XmlText.StringFormat                 = "";
                XmlText.SubType                      = NsgSoft.Common.NsgRekvisitSubType.Common;
                XmlText.IncludeInPredefined          = false;
                XmlText.PeriodicType                 = NsgSoft.Database.PeriodicTypes.None;
                XmlText.Required                     = false;
                XmlText.EmptyValue                   = "";
                XmlText.NullAllow                    = false;
                XmlText.IndexType                    = NsgSoft.Database.NsgRekvisitIndexType.None;
                XmlText.FieldName                    = "_XmlText";
                XmlText.SaveInDatabase               = true;
                XmlText.InformMetaDataOnValueChanged = false;
                XmlText.Visible                      = true;
                XmlText.Name         = "XmlText";
                XmlText.Presentation = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                                 new System.Object[] { "Xml текст" });
                XmlText.Description   = "Xml текст";
                XmlText.EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
                XmlText.GroupName     = "";
                XmlText.Guid          = NsgService.StringToGuid("fc1dfc7b-4eab-40cb-a04a-359a7275fc9d");

                if (!ObjectList.Contains("XmlText"))
                {
                    ObjectList.Add(XmlText);
                }
            }
            #endregion             //создание System.String XmlText


            #region заполнение полей класса
            //NsgDataTable
            IsLoadedFromDll     = true;
            OwnerFullName       = "";
            RegisterPeriod      = NsgSoft.Common.NsgPeriod.None;
            RegisterPeriodCount = 0;
            TableSubType        = NsgSoft.Common.NsgTableSubType.TablePart;
            EntityType          = NsgSoft.DataObjects.NsgInterfacedObject.EntityTypes.Object;
            Name                   = "НастройкиПользователей";
            Visible                = true;
            Guid                   = NsgService.StringToGuid("ca787d30-8f2f-424b-9611-685ac18e87b2");
            DefaultSortingName     = "";
            DefaultElementFormName = "";
            DefaultListFormName    = "";
            ValueMask              = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                               new System.Object[] { "{Представление}" });
            SearchType       = NsgSoft.Database.NsgComparison.Contain;
            SearchFieldName  = "Идентификатор";
            DatabaseName     = "";
            VisibleAdminOnly = false;
            TableName        = "UserSettingsTable";
            Presentation     = new NsgSoft.DataObjects.NsgLanguageString(new System.String[] { "(Default)" },
                                                                         new System.Object[] { "Настройки пользователей" });
            Description   = "Настройки пользователей";
            EditorVisible = NsgSoft.DataObjects.NsgDataObjectEditorAccess.Limited;
            GroupName     = "Сервис";

            #endregion             //заполнение полей класса
            #region окончание инициализации NsgSoft.DataObjects.NsgDataTable



            #endregion             //окончание инициализации NsgSoft.DataObjects.NsgDataTable

            #region необходимые операции после создания реквизитов и заполнения полей
            // внести в кэш полей
            initFieldsCash();
            #endregion             //необходимые операции после создания реквизитов и заполнения полей
        }
Exemplo n.º 56
0
 public static ObjectList<CalcPeriod> AddIntervalPeriods(System.DateTime fromDate, System.DateTime toDate)
 {
     ObjectList<CalcPeriod> list = new ObjectList<CalcPeriod>();
     for (System.DateTime time = fromDate; time <= toDate; time = time.AddMonths(1))
     {
         CalcPeriod period = new CalcPeriod {
             FromDate = time
         };
         try
         {
             period.SaveChanges();
         }
         catch (System.Exception)
         {
             continue;
         }
         list.Add(period);
     }
     return list;
 }
 public ObjectList<Service> FindServicesSelected()
 {
     ObjectList<Service> list = new ObjectList<Service>();
     if (this.Selected.get_Visible())
     {
         foreach (System.Windows.Forms.DataGridViewRow row in (System.Collections.IEnumerable) this.dgvServices.Rows)
         {
             if (((row.Cells.get_Item("Selected").get_Value() == null) ? 0 : 1) != 0)
             {
                 list.Add((Service) this.bsServices.get_Item(this.bsServices.Find("Id", (long) row.Cells.get_Item("Id").get_Value())));
             }
         }
     }
     return list;
 }
 private void btChangeDate_Click(object sender, System.EventArgs e)
 {
     bool flag = this.cbSaveDuplicateIndications.get_Checked();
     if ((this.bsApartmentCounterIndicationInputView.get_DataSource() != null) && (this.bsApartmentCounterIndicationInputView.get_Count() != 0))
     {
         ObjectList<ApartmentCounterIndicationInputView> list = (ObjectList<ApartmentCounterIndicationInputView>) this.bsApartmentCounterIndicationInputView.get_DataSource();
         ObjectList<ApartmentCounterIndicationInputView> list2 = new ObjectList<ApartmentCounterIndicationInputView>();
         foreach (ApartmentCounterIndicationInputView view in list)
         {
             if (((view.Val != view.NewVal) || flag) || view.IsSaveDuplicateIndication)
             {
                 view.NewValDate = this.dtpDateIndications.Value;
             }
             list2.Add(view);
         }
         this.bsApartmentCounterIndicationInputView.set_DataSource(list2);
     }
 }
Exemplo n.º 59
0
 private void serviceTypeBindingSource_CurrentChanged(object sender, System.EventArgs e)
 {
     ObjectList<CanonicalService> canonicalServices = ((ServiceTypeOld) this.serviceTypeBindingSource.get_Current()).GetCanonicalServices();
     canonicalServices.ApplySort("LongName");
     ObjectList<CanonicalService> list2 = new ObjectList<CanonicalService> {
         CanonicalService.Null
     };
     foreach (CanonicalService service in canonicalServices)
     {
         list2.Add(service);
     }
     this.canonicalServiceBindingSource.set_DataSource(list2);
 }
 private void btnSave_Click(object sender, System.EventArgs e)
 {
     bool isSaveDuplicateIndications = this.cbSaveDuplicateIndications.get_Checked();
     if ((System.Windows.Forms.Application.OpenForms.get_Item(0).GetType().ToString() == "AIS.SN.UI.Provider.ProviderMainForm") && !User.IsMemberOf(RightsEnum.ПравоНеограниченнойРаботыСПоказаниями))
     {
         string valueByName = Setting.GetValueByName("Работа с приборами учета", "Диапазон в который разрешено редактирование в Поставщике");
         if ((System.Convert.ToInt32(valueByName.Substring(0, valueByName.IndexOf('-'))) > System.DateTime.Now.get_Day()) || (System.Convert.ToInt32(valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1))) < System.DateTime.Now.get_Day()))
         {
             System.Windows.Forms.MessageBox.Show(string.Concat((string[]) new string[] { "Вам разрешено редактирование данных только с ", valueByName.Substring(0, valueByName.IndexOf('-')), " по ", valueByName.Substring((int) (valueByName.IndexOf('-') + 1), (int) ((valueByName.get_Length() - valueByName.IndexOf('-')) - 1)), " числа месяца" }), "Редактирование запрещено", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
             return;
         }
     }
     this.dgvApartmentCounterIndicationsView.EndEdit();
     if (System.Windows.Forms.DialogResult.No != System.Windows.Forms.MessageBox.Show(null, "Сохранить показания?", "Внимание", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation, System.Windows.Forms.MessageBoxDefaultButton.Button2))
     {
         ObjectList<ApartmentCounterIndicationInputView> list = (ObjectList<ApartmentCounterIndicationInputView>) this.bsApartmentCounterIndicationInputView.get_DataSource();
         ObjectList<ApartmentCounterIndicationInputView> counterIndications = new ObjectList<ApartmentCounterIndicationInputView>();
         foreach (ApartmentCounterIndicationInputView view in list)
         {
             if ((((view.Val != view.NewVal) || isSaveDuplicateIndications) || view.IsSaveDuplicateIndication) && view.ValidationMultiChangeIndication())
             {
                 counterIndications.Add(view);
             }
         }
         if (counterIndications.get_Count() > 0)
         {
             try
             {
                 DALSql.ExecuteNonQuery("begin transaction", null);
                 ApartmentCounterIndicationInputView.MultiSaveRecalc(0L, counterIndications, isSaveDuplicateIndications);
                 DALSql.ExecuteNonQuery("commit transaction", null);
                 Messages.ShowMessage("Данные успешно сохранены");
             }
             catch (System.Exception exception)
             {
                 DALSql.ExecuteNonQuery("IF (XACT_STATE()) = -1\r\n                                                BEGIN\r\n                                                    ROLLBACK TRANSACTION;\r\n                                                END;\r\n\r\n                                                -- Test whether the transaction is active and valid.\r\n                                                IF (XACT_STATE()) = 1\r\n                                                BEGIN\r\n                                                    COMMIT TRANSACTION;   \r\n                                                END;\r\n                                            ", null);
                 System.Windows.Forms.MessageBox.Show(exception.get_Message());
             }
         }
     }
 }