예제 #1
0
파일: Program.cs 프로젝트: caglary/Demo
        private static void InsertCiftcilerToDb()
        {
            //insert ciftciler to db
            string        people    = File.ReadAllText(@"C:\Users\caglar\Google Drive\YesilyurtProjects\Archive\Yesilyurt.UI.2021\bin\Debug\Backup\People.json");
            var           liste     = DeserializeObject <Person>(people);
            List <Ciftci> ciftciler = new List <Ciftci>();

            foreach (var item in liste)
            {
                Ciftci ciftci = new Ciftci();
                ciftci.TcKimlikNo    = item.TcKimlikNo;
                ciftci.NameSurname   = item.NameSurname;
                ciftci.FatherName    = item.FatherName;
                ciftci.MotherName    = item.MotherName;
                ciftci.Birthday      = item.Birthday.ToString();
                ciftci.DateOfDeath   = item.DateOfDeath.ToString();
                ciftci.Gender        = item.Gender;
                ciftci.MaritalStatus = item.MaritalStatus;
                ciftci.MobilePhone   = item.MobilePhone;
                ciftci.HomePhone     = item.HomePhone;
                ciftci.Email         = item.Email;
                ciftci.City          = item.City;
                ciftci.Town          = item.Town;
                ciftci.Village       = item.Village;
                //ciftci.Note = item.Note;
                ciftciler.Add(ciftci);
            }
            CiftciDal ciftciDal = new CiftciDal();

            foreach (var _ciftci in ciftciler)
            {
                try
                {
                    int result = ciftciDal.Add(_ciftci);
                    Console.WriteLine($"{result} Row efected  {_ciftci.TcKimlikNo} {_ciftci.NameSurname} {_ciftci.Village}");
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                    Console.ReadLine();
                }
            }
            Console.WriteLine("Bitti....");
            Console.ReadLine();
        }
예제 #2
0
 //CiftciDal dal;
 public CiftcilerManager()
 {
     _dal = new CiftciDal();
 }