Beispiel #1
0
 /// <summary>
 /// Добавление данных
 /// </summary>
 /// <param name="listViewsRows"></param>
 public void AddItem(ListViewRows listViewsRows)
 {
     for (int i = 0; i < listViewsRows.Count(); i++)
     {
         var RegistryLine = new RegistryLine()
         {
             NumDog        = listViewsRows[i].Cells[1].Text
             , DateDog     = listViewsRows[i].Cells[2].Text
             , Division    = listViewsRows[i].Cells[3].Text
             , NSICode     = listViewsRows[i].Cells[4].Text
             , Strah       = listViewsRows[i].Cells[5].Text
             , SaleChannel = listViewsRows[i].Cells[6].Text
             , VidSatrah   = listViewsRows[i].Cells[7].Text
             , StrSumm     = listViewsRows[i].Cells[8].Text
             , KT          = product == ProductEnum.DS ? (listViewsRows[i].Cells[9].Text.Replace(",", ".") != ""?
                                                          listViewsRows[i].Cells[9].Text.Replace(",", "."): null) :
                             null
             , Power = product == ProductEnum.DS ? listViewsRows[i].Cells[10].Text.Replace(",", ".") :
                       null
             , TypeTS = product == ProductEnum.DS ? listViewsRows[i].Cells[11].Text :
                        null
             , CelIspolzovania = product == ProductEnum.DS ? listViewsRows[i].Cells[12].Text :
                                 null
             , KBC = product == ProductEnum.DS ? listViewsRows[i].Cells[13].Text.Replace(",", ".") :
                     null
             , VozrastTS = product == ProductEnum.DS ? listViewsRows[i].Cells[14].Text :
                           null
             , VozrastLica = product == ProductEnum.DS ?  listViewsRows[i].Cells[15].Text:
                             null
             , PlatehzDoc = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[9].Text :
                            product == ProductEnum.DS ? listViewsRows[i].Cells[16].Text :
                            null
             , Vznos = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[10].Text :
                       product == ProductEnum.DS ? listViewsRows[i].Cells[17].Text :
                       null
             , DataVznosa = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[11].Text :
                            product == ProductEnum.DS ? listViewsRows[i].Cells[18].Text :
                            null
             , KV = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[12].Text :
                    product == ProductEnum.DS ? listViewsRows[i].Cells[19].Text :
                    null
             , MaxKV = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[13].Text :
                       product == ProductEnum.DS ? listViewsRows[i].Cells[20].Text :
                       null
             , Stavka = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[14].Text :
                        product == ProductEnum.DS ? listViewsRows[i].Cells[21].Text :
                        null
             , Summ = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[15].Text :
                      product == ProductEnum.DS ? listViewsRows[i].Cells[22].Text :
                      null
             , Primachanie = product == ProductEnum.KaskoOpoZv ? listViewsRows[i].Cells[16].Text :
                             product == ProductEnum.DS ? listViewsRows[i].Cells[23].Text :
                             null
         };
         item.Add(RegistryLine);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Удаление дублей
        /// </summary>
        /// <returns></returns>
        public void Distinct()
        {
            ReadDataCalc DistinctCollection = new ReadDataCalc();

            this.item.Sort(SortDelegat);
            RegistryLine AddRow = this.item[0];

            DistinctCollection.item.Add(AddRow);
            foreach (RegistryLine i in this.item)
            {
                if (AddRow.CompareTo(i) != 0)
                {
                    DistinctCollection.item.Add(i);
                    AddRow = i;
                }
            }
            this.item = DistinctCollection.item;
        }
Beispiel #3
0
 /// <summary>
 /// Делигат для сортировки данных
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="obj2"></param>
 /// <returns></returns>
 public int SortDelegat(RegistryLine obj, RegistryLine obj2)
 {
     if (obj == null && obj2 == null)
     {
         return(0);
     }
     else if (obj == null)
     {
         return(-1);
     }
     else if (obj2 == null)
     {
         return(1);
     }
     else
     {
         return(obj.CompareTo(obj2));
     }
 }