/// <summary>Adds the specified item.</summary>
 /// <param name="item">The item.</param>
 public void Add(T item)
 {
     lock (Base)
     {
         Base.Add(item);
     }
 }
Example #2
0
        public void Test_AddMethod()
        {
            Base   b   = new Base();
            double res = b.Add(10, 10);

            Assert.AreEqual(res, 20);
        }
Example #3
0
        private void buttonOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string   name      = openFileDialog1.FileName;
                string   File      = _FileString.MyFileString.ReadF(name);
                string[] arrstring = File.Split(new char[] { ' ', ',', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                Newbase = new Base();
                for (int i = 0; i < arrstring.Length; i += 5)
                {
                    Newbase.Add(new Room(arrstring[i], Convert.ToInt32(arrstring[i + 1]), Convert.ToDouble(arrstring[i + 2]), Convert.ToDouble(arrstring[i + 3]), Convert.ToDouble(arrstring[i + 4])));
                }
                dataGridView231 = MyDataGridView.ClearDataGridView(dataGridView231);

                dataGridView231.Columns.Add("Название района", "Название района");
                dataGridView231.Columns.Add("Количество комнат", "Количество комнат");
                dataGridView231.Columns.Add("Общая площадь", "Общая площадь");
                dataGridView231.Columns.Add("Площадь кухни", "Площадь кухни");
                dataGridView231.Columns.Add("Цена", "Цена");
                for (int i = 0; i < Newbase.MainBase.Count; i++)
                {
                    dataGridView231.Rows.Add(Newbase.MainBase[i].name, Convert.ToString(Newbase.MainBase[i].Nroom), Convert.ToString(Newbase.MainBase[i].Smax), Convert.ToString(Newbase.MainBase[i].Scook), Convert.ToString(Newbase.MainBase[i].Price));
                }
            }
        }
Example #4
0
        public virtual void Add([NotNull] TKey key, [NotNull] TValue value)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (ContainsKey(key))
            {
                throw new ArgumentException(@"Already exists", nameof(key));
            }

            if (ContainsValue(value))
            {
                throw new ArgumentException(@"Already exists", nameof(value));
            }

            Base.Add(key, value);
            Reversed.Add(value, key);
        }
Example #5
0
 public Characteristics(Dictionary <CharType, float> baseChars) : this()
 {
     foreach (var item in baseChars)
     {
         Base.Add(item.Key, item.Value);
         Current.Add(item.Key, item.Value);
     }
 }
        public ConflictDialogBak(Conflict conflict)
        {
            InitializeComponent();
            this.DataContext = this;

            if (conflict.Base != null)
            {
                BaseTable.Columns.Add(new DataGridTextColumn());

                DataGridTextColumn column;
                foreach (var item in conflict.Base.Keys)
                {
                    column         = new DataGridTextColumn();
                    column.Header  = item;
                    column.Binding = new Binding("[" + item + "]");
                    BaseTable.Columns.Add(column);
                }
            }

            Base.Add(conflict.Base);


            if (conflict.Theirs != null)
            {
                TheirsTable.Columns.Add(new DataGridTextColumn());

                DataGridTextColumn column;
                foreach (var item in conflict.Theirs.Keys)
                {
                    column         = new DataGridTextColumn();
                    column.Header  = item;
                    column.Binding = new Binding("[" + item + "]");
                    TheirsTable.Columns.Add(column);
                }
            }

            Theirs.Add(conflict.Theirs);

            if (conflict.Mine != null)
            {
                MineTable.Columns.Add(new DataGridTextColumn());

                DataGridTextColumn column;
                foreach (var item in conflict.Mine.Keys)
                {
                    column         = new DataGridTextColumn();
                    column.Header  = item;
                    column.Binding = new Binding("[" + item + "]");
                    MineTable.Columns.Add(column);
                }
            }
            LocalVersion.Add(conflict.Mine);

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                LoadDesignTimeData();
            }
        }
Example #7
0
 private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e)
 {
     if (k < dataGridView1.RowCount)
     {
         k++;
         Room room = new Room("", -1, -1, -1, -1);
         newbase.Add(room);
     }
 }
Example #8
0
 public void AddItem(CharType type, float value)
 {
     if (!Base.ContainsKey(type))
     {
         Base.Add(type, value);
     }
     if (!Current.ContainsKey(type))
     {
         Current.Add(type, value);
     }
 }
Example #9
0
 public Characteristics(Characteristics chars) : this()
 {
     foreach (var item in chars.Base)
     {
         Base.Add(item.Key, item.Value);
     }
     /**/
     foreach (var item in chars.Current)
     {
         Current.Add(item.Key, item.Value);
     }
 }
Example #10
0
        private void Table_Insert(string _Surname, double _dollars, double _euros, double _rubs, double _golds)
        {
            int key = 0;    int index = 0;

            foreach (Human _human in Base)
            {
                if ((_human.surname == _Surname))
                {
                    _dollars += _human.dollars;     _human.dollars = _dollars;
                    _euros   += _human.euros;       _human.euros = _euros;
                    _rubs    += _human.rubs;        _human.rubs = _rubs;
                    _golds   += _human.golds;       _human.golds = _golds;

                    _human.all_in_rubs = (_human.Kurs_dollar * _dollars) + (_human.Kurs_euro * _euros) + (_human.Kurs_gold * _golds) + _human.rubs;

                    for (int j = 0; j < allinbase; j++)
                    {
                        if (dataGridView_Total[0, j].Value.ToString() == _Surname)
                        {
                            index = j;
                        }
                    }

                    dataGridView_Total[1, index].Value = _dollars;
                    dataGridView_Total[2, index].Value = _euros;
                    dataGridView_Total[3, index].Value = _rubs;
                    dataGridView_Total[4, index].Value = _golds;
                    dataGridView_Total[5, index].Value = _human.all_in_rubs;
                    key = 1;
                    break;
                }
            }
            if (key == 0)
            {
                Human _human = new Human(_Surname, _dollars, _euros, _rubs, _golds);
                Base.Add(_human);
                allinbase++;
                _human.all_in_rubs = (_human.Kurs_dollar * _dollars) +
                                     (_human.Kurs_euro * _euros) +
                                     (_human.Kurs_gold * _golds) +
                                     _human.rubs;
                dataGridView_Total.Rows.Insert(0, 1);
                dataGridView_Total[0, 0].Value = _Surname;
                dataGridView_Total[1, 0].Value = _dollars;
                dataGridView_Total[2, 0].Value = _euros;
                dataGridView_Total[3, 0].Value = _rubs;
                dataGridView_Total[4, 0].Value = _golds;
                dataGridView_Total[5, 0].Value = _human.all_in_rubs;
            }
        }
Example #11
0
        public Base(string _name, string _type, Base _parent = null)
        {
            name = _name;
            type = _type;

            if (_parent != null)
            {
                while (_parent.subNodes.ContainsKey(name))
                {
                    name += "*";
                }
                _parent.Add(this);
            }
        }
        //Редактирует ID в базе, при ошибке
        private void Edit()
        {
            UnicData tmp = DataSelected;

            if (tmp == null)
            {
                MessageBox.Show("Выбирете, что-нибудь");
                return;
            }

            for (int i = 0; i < Base.Count; i++)
            {
                if (Base[i].Value == tmp.Value)
                {
                    Base.Remove(DataSelected);
                    tmp.Id = NewId;
                    Base.Add(tmp);
                    break;
                }
            }
        }
        //Добавляем данные из нижнего списка
        private void Add(object id)
        {
            string siteName = id.ToString();

            UnicData dt = null;

            if (siteName == "Fonbet")
            {
                if (FonbetSelected == null)
                {
                    MessageBox.Show("Выбирете, что-нибудь");
                    return;
                }
                dt = new UnicData(FonbetId, FonbetSelected.TeamName, StaticData.Shared.Enums.ParserType.Fonbet);
                FonbetData.Remove(FonbetSelected);
                Fonbet.Remove(FonbetSelected);
            }

            else if (siteName == "Olimp")
            {
                if (OlimpSelected == null)
                {
                    MessageBox.Show("Выбирете, что-нибудь");
                    return;
                }

                dt = new UnicData(OlimpId, OlimpSelected.TeamName, StaticData.Shared.Enums.ParserType.Olimp);
                OlimpData.Remove(OlimpSelected);
                Olimp.Remove(OlimpSelected);
            }

            else if (siteName == "Marafon")
            {
                if (MarafonSelected == null)
                {
                    MessageBox.Show("Выбирете, что-нибудь");
                    return;
                }

                dt = new UnicData(MarafonId, MarafonSelected.TeamName, StaticData.Shared.Enums.ParserType.Marafon);
                MarafonData.Remove(MarafonSelected);
                Marafon.Remove(MarafonSelected);
            }
            else if (siteName == "Zenit")
            {
                if (ZenitSelected == null)
                {
                    MessageBox.Show("Выбирете, что-нибудь");
                    return;
                }

                dt = new UnicData(ZenitId, ZenitSelected.TeamName, StaticData.Shared.Enums.ParserType.Zenit);
                ZenitData.Remove(ZenitSelected);
                Zenit.Remove(ZenitSelected);
            }

            else if (siteName == "PariMatch")
            {
                if (PariMacthSelected == null)
                {
                    MessageBox.Show("Выбирете, что-нибудь");
                    return;
                }

                dt = new UnicData(PariMatchId, PariMacthSelected.TeamName, StaticData.Shared.Enums.ParserType.PariMatch);
                PariMatchData.Remove(PariMacthSelected);
                PariMatch.Remove(PariMacthSelected);
            }

            Base.Add(dt);
        }
 public void Add(KeyValuePair <TKey, TValue> item)
 {
     Base.Add(item);
     ItemChanged?.Invoke(this, new NotifyItemChangedEventArgs <TKey>(item.Key));
 }
 public void Add(TKey key, TValue value)
 {
     Base.Add(key, value);
     ItemChanged?.Invoke(this, new NotifyItemChangedEventArgs <TKey>(key));
 }
Example #16
0
    public Base BaseFromGameObject(GameObject target)
    {
        Matrix4x4 world = target.transform.localToWorldMatrix;

        Vector3 lastPos = target.transform.position;

        PdxAnimationPlayer player = target.GetComponent <PdxAnimationPlayer>();

        if (player != null)
        {
            player.SetTpose();
        }

        target.transform.position = Vector3.zero;

        List <Transform> shapes = new List <Transform>();

        FindTagInChildren(shapes, target.transform, "Shape", target.transform);

        Base _base = new Base("PdxData", "object");

        Base _pdxasset = new Base("pdxasset", "int", _base);

        _pdxasset.value = new List <Base.Data>()
        {
            Base.Data.Int(1), Base.Data.Int(0)
        };

        Base _object = new Base("object", "object", _base);

        foreach (Transform sh in shapes)
        {
            MeshFilter          mf  = sh.GetComponent <MeshFilter>();
            MeshRenderer        mr  = sh.GetComponent <MeshRenderer>();
            SkinnedMeshRenderer smr = sh.GetComponent <SkinnedMeshRenderer>();

            PdxShape shapeData = sh.GetComponent <PdxShape>();

            bool isCollider = sh.gameObject.tag == "Collider";
            bool skinned    = smr != null;

            Mesh     mesh;
            Material mat;
            if (isCollider)
            {
                mesh = mf.mesh;
                mat  = null;
            }
            else if (skinned)
            {
                mesh = smr.sharedMesh;
                mat  = smr.material;
            }
            else
            {
                mesh = mf.mesh;
                mat  = mr.material;
            }

            Base _shape = _object.subNodes.ContainsKey(sh.name) ? _object.subNodes[sh.name] : new Base(sh.name.Replace(" Instance", ""), "object", _object);

            Base _mesh = new Base("mesh", "object", _shape);

            Base _p = new Base("p", "float", _mesh);
            foreach (Vector3 p in mesh.vertices)
            {
                Vector3 pW = world.MultiplyPoint3x4(p);
                _p.value.Add(Base.Data.Float(pW.x)); _p.value.Add(Base.Data.Float(pW.y)); _p.value.Add(Base.Data.Float(pW.z));
            }

            if (!isCollider)
            {
                Base _n = new Base("n", "float", _mesh);
                foreach (Vector3 n in mesh.normals)
                {
                    Vector3 nW = world.MultiplyPoint3x4(n);
                    _n.value.Add(Base.Data.Float(nW.x)); _n.value.Add(Base.Data.Float(nW.y)); _n.value.Add(Base.Data.Float(nW.z));
                }

                Base _ta = new Base("ta", "float", _mesh);
                foreach (Vector4 ta in mesh.tangents)
                {
                    Vector4 taW = world * ta;
                    _ta.value.Add(Base.Data.Float(taW.x)); _ta.value.Add(Base.Data.Float(taW.y)); _ta.value.Add(Base.Data.Float(taW.z)); _ta.value.Add(Base.Data.Float(taW.w));
                }

                Base _uv = new Base("u0", "float", _mesh);
                foreach (Vector2 uv in mesh.uv)
                {
                    _uv.value.Add(Base.Data.Float(uv.x)); _uv.value.Add(Base.Data.Float(uv.y));
                }

                if (mesh.uv2 != null && mesh.uv2.Length > 0)
                {
                    Base _uv1 = new Base("u1", "float", _mesh);
                    foreach (Vector2 uv2 in mesh.uv2)
                    {
                        _uv1.value.Add(Base.Data.Float(uv2.x)); _uv1.value.Add(Base.Data.Float(uv2.y));
                    }
                }
            }

            Base _tri = new Base("tri", "int", _mesh);
            foreach (int tri in mesh.triangles)
            {
                _tri.value.Add(Base.Data.Int(tri));
            }

            Base _aabb = new Base("aabb", "object", _mesh);

            Base _min = new Base("min", "float", _aabb);

            _min.value.Add(Base.Data.Float(mesh.bounds.min.x));
            _min.value.Add(Base.Data.Float(mesh.bounds.min.y));
            _min.value.Add(Base.Data.Float(mesh.bounds.min.z));

            Base _max = new Base("max", "float", _aabb);

            _max.value.Add(Base.Data.Float(mesh.bounds.max.x));
            _max.value.Add(Base.Data.Float(mesh.bounds.max.y));
            _max.value.Add(Base.Data.Float(mesh.bounds.max.z));

            Base _material = new Base("material", "object", _mesh);

            Base _shader = new Base("shader", "string", _material); _shader.nullByteString = true;

            if (!isCollider)
            {
                _shader.value.Add(Base.Data.String(shapeData.shader));

                if (!string.IsNullOrEmpty(shapeData.diffuse))
                {
                    Base _diff = new Base("diff", "string", _material); _diff.nullByteString = true;
                    _diff.value.Add(Base.Data.String(Path.GetFileName(shapeData.diffuse)));
                }

                if (!string.IsNullOrEmpty(shapeData.normal))
                {
                    Base _normal = new Base("n", "string", _material); _normal.nullByteString = true;
                    _normal.value.Add(Base.Data.String(Path.GetFileName(shapeData.normal)));
                }

                if (!string.IsNullOrEmpty(shapeData.specular))
                {
                    Base _spec = new Base("spec", "string", _material); _spec.nullByteString = true;
                    _spec.value.Add(Base.Data.String(Path.GetFileName(shapeData.specular)));
                }
            }
            else
            {
                _shader.value.Add(Base.Data.String("Collision"));
            }

            if (skinned)
            {
                Dictionary <Transform, int> newBoneIndices = new Dictionary <Transform, int>();
                Dictionary <int, Transform> oldBoneIndices = new Dictionary <int, Transform>();

                if (!_shape.subNodes.ContainsKey("skeleton"))
                {
                    Transform root = null;

                    Base _skeleton = new Base("skeleton", "object", _shape);
                    Dictionary <string, Base> nameBones = new Dictionary <string, Base>();

                    foreach (Transform b in smr.bones)
                    {
                        oldBoneIndices.Add(Array.IndexOf(smr.bones, b), b);

                        if (b.name.ToLower().Equals("root"))
                        {
                            root = b;
                        }
                        Base _bone = new Base(b.name, "object");
                        Base _btx  = new Base("tx", "float", _bone);

                        Matrix4x4 m = b.localToWorldMatrix.inverse;

                        _btx.value = new List <Base.Data>()
                        {
                            new Base.Data()
                            {
                                f = m.m00
                            }, new Base.Data()
                            {
                                f = m.m10
                            }, new Base.Data()
                            {
                                f = m.m20
                            },                                                                                        //new Base.Data() { f = m.m03 },
                            new Base.Data()
                            {
                                f = m.m01
                            }, new Base.Data()
                            {
                                f = m.m11
                            }, new Base.Data()
                            {
                                f = m.m21
                            },                                                                                        //new Base.Data() { f = m.m13 },
                            new Base.Data()
                            {
                                f = m.m02
                            }, new Base.Data()
                            {
                                f = m.m12
                            }, new Base.Data()
                            {
                                f = m.m22
                            },                                                                                        //new Base.Data() { f = m.m23 },
                            new Base.Data()
                            {
                                f = m.m03
                            }, new Base.Data()
                            {
                                f = m.m13
                            }, new Base.Data()
                            {
                                f = m.m23
                            },                                                                                        //new Base.Data() { f = m.m33 },
                        };

                        nameBones.Add(b.name, _bone);
                    }

                    List <Transform> hierBones = new List <Transform>();
                    ObjectHierarchy(hierBones, root);

                    foreach (var hb in hierBones)
                    {
                        newBoneIndices.Add(hb, hierBones.IndexOf(hb));

                        Base _bone = nameBones[hb.name];
                        Base _bix  = new Base("ix", "int", _bone);
                        _bix.value.Add(Base.Data.Int(hierBones.IndexOf(hb)));
                        _skeleton.Add(_bone);

                        if (hb != smr.rootBone)
                        {
                            Base _bpa = new Base("pa", "int", _bone);
                            _bpa.value.Add(Base.Data.Int(hierBones.IndexOf(hb.parent)));
                        }
                    }
                }

                Base _skin = new Base("skin", "object", _mesh);

                Base _bonesPerVert = new Base("bones", "int", _skin);

                int num = 1;

                foreach (BoneWeight bw in mesh.boneWeights)
                {
                    if (num < 2 && bw.weight1 > 0)
                    {
                        num = 2;
                    }
                    if (num < 3 && bw.weight2 > 0)
                    {
                        num = 3;
                    }
                    if (num < 4 && bw.weight3 > 0)
                    {
                        num = 4;
                        break;
                    }
                }

                _bonesPerVert.value.Add(Base.Data.Int(num));

                int ixCount = mesh.vertexCount;

                Base _ix = new Base("ix", "int", _skin);
                Base _w  = new Base("w", "float", _skin);

                for (int i = 0; i < ixCount; i++)
                {
                    BoneWeight w = mesh.boneWeights[i];

                    int bi0 = newBoneIndices[oldBoneIndices[w.boneIndex0]];
                    int bi1 = newBoneIndices[oldBoneIndices[w.boneIndex1]];
                    int bi2 = newBoneIndices[oldBoneIndices[w.boneIndex2]];
                    int bi3 = newBoneIndices[oldBoneIndices[w.boneIndex3]];

                    _ix.value.Add(Base.Data.Int((bi0 == 0 && w.weight0 == 0) ? -1 : bi0));
                    _ix.value.Add(Base.Data.Int((bi1 == 0 && w.weight1 == 0) ? -1 : bi1));
                    _ix.value.Add(Base.Data.Int((bi2 == 0 && w.weight2 == 0) ? -1 : bi2));
                    _ix.value.Add(Base.Data.Int((bi3 == 0 && w.weight3 == 0) ? -1 : bi3));

                    _w.value.Add(Base.Data.Float(w.weight0));
                    _w.value.Add(Base.Data.Float(w.weight1));
                    _w.value.Add(Base.Data.Float(w.weight2));
                    _w.value.Add(Base.Data.Float(w.weight3));
                }
            }
        }

        Base _locator = new Base("locator", "object", _base);

        List <Transform> locators = new List <Transform>();

        FindTagInChildren(locators, target.transform, "Locator", target.transform);

        foreach (Transform loc in locators)
        {
            Base _loc = new Base(loc.name, "object", _locator);

            Base _p  = new Base("p", "float", _loc);
            Base _q  = new Base("q", "float", _loc);
            Base _pa = new Base("pa", "string", _loc); _pa.nullByteString = true;

            Vector3    pos = loc.transform.localPosition;
            Quaternion rot = loc.transform.localRotation;

            _p.value.Add(Base.Data.Float(pos.x)); _p.value.Add(Base.Data.Float(pos.y)); _p.value.Add(Base.Data.Float(pos.z));

            _q.value.Add(Base.Data.Float(rot.x)); _q.value.Add(Base.Data.Float(rot.y)); _q.value.Add(Base.Data.Float(rot.z)); _q.value.Add(Base.Data.Float(rot.w));

            _pa.value.Add(Base.Data.String(loc.transform.parent.name));
        }

        target.transform.position = lastPos;

        return(_base);
    }
Example #17
0
 public ImmutableMap <TKey, TValue> Add(TKey key, TValue value)
 {
     return(new ImmutableMap <TKey, TValue>(Base.Add(key, value), Reversed.Add(value, key)));
 }
Example #18
0
        static void Main(string[] args)
        {
            Console.Write("Открыть данные с файла? Введите Да или Нет: ");
            string comand  = Console.ReadLine();
            Base   Newbase = new Base();

            string[] arrstring;
            if (comand == "Да")
            {
                Console.Write("Введите путь к файлу: ");
                string name = Console.ReadLine();
                string File = _FileString.MyFileString.ReadF(name);
                arrstring = File.Split(new char[] { ' ', ',', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < arrstring.Length; i += 5)
                {
                    Newbase.Add(new Room(arrstring[i], Convert.ToInt32(arrstring[i + 1]), Convert.ToDouble(arrstring[i + 2]), Convert.ToDouble(arrstring[i + 3]), Convert.ToDouble(arrstring[i + 4])));
                }
            }
            else if (comand == "Нет")
            {
                Console.Write("Введите количество квартир: ");
                int n = Convert.ToInt32(Console.ReadLine());
                arrstring = new string[5];
                for (int i = 0; i < n; i++)
                {
                    Console.WriteLine("Введите через пробел название района, количество комнат, общую площадь, площать кухни и цену для {0}-ой квартиры", i + 1);
                    arrstring[i] = Console.ReadLine();
                }
                for (int i = 0; i < n; i++)
                {
                    string[] a = arrstring[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    Newbase.Add(new Room(a[0], Convert.ToInt32(a[1]), Convert.ToDouble(a[2]), Convert.ToDouble(a[3]), Convert.ToDouble(a[4])));
                }
            }
            Console.Write("Введите необходимое количество комнат: ");
            int N = Convert.ToInt32(Console.ReadLine());

            Console.Write("Введите минимальную площадь: ");
            double      Smin   = Convert.ToDouble(Console.ReadLine());
            List <Room> Result = Newbase.Find(N, Smin);

            Console.Write("Сохранить данные в файл? Введите Да или Нет: ");
            comand = Console.ReadLine();
            if (comand == "Да")
            {
                Console.Write("Введите путь к файлу: ");
                string name = Console.ReadLine();
                _FileString.MyFileString.ClearF(name);
                for (int i = 0; i < Result.Count; i++)
                {
                    _FileString.MyFileString.WriteF(name, ("Район: " + Result[i].name + " кол -во комнат: " + Convert.ToString(Result[i].Nroom) + " площадь: " + Convert.ToString(Result[i].Smax) + " площадь кухни: " + Convert.ToString(Result[i].Scook) + " цена: " + Convert.ToString(Result[i].Price) + '\r' + '\n'));
                }
            }
            else if (comand == "Нет")
            {
                for (int i = 0; i < Result.Count; i++)
                {
                    Console.WriteLine("Район: {0}, кол-во комнат: {1}, площадь: {2}, площадь кухни: {3}, цена: {4}", Result[i].name, Result[i].Nroom, Result[i].Smax, Result[i].Scook, Result[i].Price);
                }
            }
        }
Example #19
0
 private void dataGridView1_UserAddedRow(object sender, DataGridViewRowEventArgs e)
 {
     Newbase.Add(new Room("", -1, -1, -1, -1));
 }
Example #20
0
        //把预约信息存进数据库
        public void SaveReservation(PatientInfo ptinfo)
        {
            Base sr = new Base();

            sr.Add(ptinfo.PatientName);
        }
        //Делет добавление в базу выделенных элементов
        private void Adding()
        {
            int id = 1;

            if (Base.Count != 0)
            {
                id = Base.Select(x => x.Id).Max();
                id++;
            }

            //Это для работы базы с чистого листа
            if (id != 1)
            {
                //Проверяем есть ли такой элемент уже в базе.
                int temp = 0;
                if (FonbetSelected != null)
                {
                    temp = CheckValue(FonbetSelected.TeamName);
                }
                if (OlimpSelected != null && temp == 0)
                {
                    temp = CheckValue(OlimpSelected.TeamName);
                }
                if (MarafonSelected != null && temp == 0)
                {
                    temp = CheckValue(MarafonSelected.TeamName);
                }
                if (ZenitSelected != null && temp == 0)
                {
                    temp = CheckValue(ZenitSelected.TeamName);
                }
                if (PariMacthSelected != null && temp == 0)
                {
                    temp = CheckValue(PariMacthSelected.TeamName);
                }
                if (temp != 0)
                {
                    id = temp;
                }
            }

            //Создаем записи для нужных элементов
            if (FonbetSelected != null)
            {
                Base.Add(new UnicData(id, FonbetSelected.TeamName, StaticData.Shared.Enums.ParserType.Fonbet));
            }
            if (OlimpSelected != null)
            {
                Base.Add(new UnicData(id, OlimpSelected.TeamName, StaticData.Shared.Enums.ParserType.Olimp));
            }
            if (MarafonSelected != null)
            {
                Base.Add(new UnicData(id, MarafonSelected.TeamName, StaticData.Shared.Enums.ParserType.Marafon));
            }
            if (ZenitSelected != null)
            {
                Base.Add(new UnicData(id, ZenitSelected.TeamName, StaticData.Shared.Enums.ParserType.Zenit));
            }
            if (PariMacthSelected != null)
            {
                Base.Add(new UnicData(id, PariMacthSelected.TeamName, StaticData.Shared.Enums.ParserType.PariMatch));
            }

            //Удаляем из источника данных
            FonbetData.Remove(FonbetSelected);
            OlimpData.Remove(OlimpSelected);
            MarafonData.Remove(MarafonSelected);
            ZenitData.Remove(ZenitSelected);
            PariMatchData.Remove(PariMacthSelected);

            //Удаляем из отображаемой коллекции
            Fonbet.Remove(FonbetSelected);
            Olimp.Remove(OlimpSelected);
            Marafon.Remove(MarafonSelected);
            Zenit.Remove(ZenitSelected);
            PariMatch.Remove(PariMacthSelected);

            Clear();
        }