Beispiel #1
0
        public DeskSettSor()
        {
            context = new DeskSetContext();
            if (context.DeskSets.Select(s => s).Count() == 0)
            {
                DeskSet dispset = new DeskSet()
                {
                    Name = "default", isSelected = true
                };
                context.DeskSets.Add(dispset);
                context.SaveChanges();

                var defid = context.DeskSets.Where(s => s.Name == "default").Select(s => s.Id).FirstOrDefault();

                ColStor firstName = new ColStor()
                {
                    Name = "FirstName", DeskSetId = defid
                };
                ColStor lastName = new ColStor()
                {
                    Name = "LastName", DeskSetId = defid
                };
                ColStor Company = new ColStor()
                {
                    Name = "Company", DeskSetId = defid
                };
                context.ColStors.Add(firstName);
                context.ColStors.Add(lastName);
                context.ColStors.Add(Company);
                context.SaveChanges();

                int fnid = context.ColStors.Where(s => s.Name == "Firstname").Select(s => s.Id).FirstOrDefault();
                int lnid = context.ColStors.Where(s => s.Name == "LastName").Select(s => s.Id).FirstOrDefault();
                int coid = context.ColStors.Where(s => s.Name == "Company").Select(s => s.Id).FirstOrDefault();


                ColSet firstname = new ColSet()
                {
                    Alias = "Имя", Visible = true, Width = 100, ColStorId = fnid
                };
                ColSet lastname = new ColSet {
                    Alias = "Фамилия", Visible = true, Width = 100, ColStorId = lnid
                };
                ColSet company = new ColSet {
                    Alias = "Компания", Visible = true, Width = 100, ColStorId = coid
                };
                context.ColSets.Add(firstname);
                context.ColSets.Add(lastname);
                context.ColSets.Add(company);
                context.SaveChanges();
            }
            deskSets = context.DeskSets.Select(s => s).ToList();
            var sel_set_id = context.DeskSets.Where(s => s.isSelected == true).Select(s => s.Id).FirstOrDefault();

            colStors = context.ColStors.Where(s => s.DeskSetId == sel_set_id).Select(s => s).ToList();
            colSets  = context.ColSets.ToList();
        }
Beispiel #2
0
 public VMDeskSet()
 {
     storage                 = new DeskSettSor();
     collection_setting      = storage.DeskSets;
     collection_column       = storage.ColStors;
     selected_column         = collection_column.FirstOrDefault();
     selected_setting        = collection_setting.Where(s => s.isSelected = true).FirstOrDefault();
     selected_column_setting = storage.ColSets.Where(s => s.ColStorId == selected_column.Id).FirstOrDefault();
 }
Beispiel #3
0
            public void updateRange(long start, long end)
            {
                if (list.Count == 0)
                {
                    list.Add(new ColSet(start, end));
                    return;
                }
                ColSet        cs              = new ColSet(start, end);
                List <ColSet> updatedList     = new List <ColSet>();
                bool          isIsolatedFound = false;

                for (int i = 0; i < list.Count; i++)
                {
                    ColSet csint = list[i];
                    //
                    // exist           -------                    --------
                    // input                    -----       ----
                    if (cs.Start > csint.End || cs.End < csint.Start)
                    {
                        updatedList.Add(csint);
                        //isIsolatedFound=true;
                        continue;
                    }
                    //
                    // exist           ------------------
                    // input                --------
                    if (cs.Start >= csint.Start && cs.End <= csint.End)
                    {
                        cs = new ColSet(csint.Start, csint.End);
                        continue;
                    }
                    //
                    // exist           ------------------
                    // input         ---------------------
                    if (cs.Start < csint.Start && cs.End > csint.End)
                    {
                        cs = new ColSet(cs.Start, cs.End);
                        continue;
                    }
                    //
                    // exist           ---------------
                    // input                       -----------
                    if (cs.Start <= csint.End && cs.End > csint.End)
                    {
                        cs = new ColSet(csint.Start, cs.End);
                        continue;
                    }
                    //
                    // exist           ---------------
                    // input    -----------
                    if (cs.Start < csint.Start && cs.End >= csint.Start)
                    {
                        cs = new ColSet(cs.Start, csint.End);
                        continue;
                    }
                }
                updatedList.Add(cs);
                list = new List <ColSet>();
                list.AddRange(updatedList);
                Console.WriteLine(list.Count);
            }