示例#1
0
        public static void List2ListView(ListView lstVw, List <Kisayol> kisayollar)
        {
            try
            {
                lstVw.Items.Clear();

                foreach (Kisayol ks in kisayollar)
                {
                    lstVw.Items.Add(
                        new ListViewItem(new string[] {
                        ks.KisayolAdi,
                        ks.Yol,
                        ObjectUtility.Date2String(ks.Tarih)
                    }));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public static List <Kisayol> ToList(DataTable dt)
 {
     try
     {
         List <Kisayol> list = new List <Kisayol>();
         Kisayol        ks   = null;
         foreach (DataRow row in dt.Rows)
         {
             ks = new Kisayol()
             {
                 Id         = ObjectUtility.Str2Int(row["Id"].ToString()),
                 KisayolAdi = row["KisayolAdi"].ToString(),
                 Yol        = row["Yol"].ToString(),
                 Tarih      = ObjectUtility.Str2Date(row["Tarih"].ToString())
             };
             list.Add(ks);
         }
         return(list);
     }
     catch (Exception)
     {
         throw;
     }
 }