Ejemplo n.º 1
0
        public static void RefreshData(BankaSubeTumListe values)
        {
            GetMappingData();

            foreach (var value in values.BankaSubeleri)
            {
                foreach (var data in mappingData)
                {
                    if (value.Banka.BKd == data.BankCode && value.Banka.BAd != data.BankName)
                    {
                        value.Banka.BAd = data.BankName; 
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (filePath != String.Empty)
            {
                try
                {
                    list = SerializeConfig <BankaSubeTumListe> .DeSerialize(filePath);

                    DbOperations.AddDatabase(list);
                    if (DbOperations.result)
                    {
                        MessageBox.Show("Veritabanına başarıyla kaydedildi.");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Dosyadan veriler alınamadı.");
                }
            }
            else
            {
                MessageBox.Show("Lütfen bir dosya seçiniz...");
            }
        }
Ejemplo n.º 3
0
        public static void AddDatabase(BankaSubeTumListe values)
        {
            RefreshData(values);

            foreach (var value in values.BankaSubeleri)
            {               
                temp = @"          
			            Insert into XML_PARSER_BANKS (bKd,bAd,bIlAd,adr,sonIslemTuru, sonIslemZamani)
                        Values('@bKd','@bAd','@bIlAd','@adr','@sonIslemTuru','@sonIslemZamani')
			    ";

                temp = temp.Replace("@bKd", value.Banka.BKd.Trim());
                temp = temp.Replace("@bAd", value.Banka.BAd.Trim());
                temp = temp.Replace("@bIlAd", value.Banka.BIlAd.Trim());
                temp = temp.Replace("@adr", value.Banka.Adr.Trim());
                temp = temp.Replace("@sonIslemTuru", value.Banka.SonIslemTuru.Trim());
                temp = temp.Replace("@sonIslemZamani", value.Banka.SonIslemZamani.Trim());
                sqlStatement += temp;

                branchs = value.Sube;
                foreach (var branch in branchs)
                {
                    temp = @"
                          Insert into XML_PARSER_BRANCHS (sKd,bKd,sAd,sIlAd,sIlcAd,sIlcKd,sIlKd,tlf,adr,fks,epst,sonIslemTuru,sonIslemZamani)
                          Values('@sKd','@bKd','@sAd','@sIlAd','@sIlcAd','@sIlcKd','@sIlKd','@tlf','@adr','@fks','@epst','@sonIslemTuru','@sonIslemZamani')
                    ";

                    temp = temp.Replace("@sKd", branch.SKd.Trim());
                    temp = temp.Replace("@bKd", branch.BKd.Trim());
                    temp = temp.Replace("@sAd", branch.SAd.Trim());
                    temp = temp.Replace("@sIlAd", branch.SIlAd);
                    temp = temp.Replace("@sIlcAd", branch.SIlcAd);
                    temp = temp.Replace("@sIlcKd", branch.SIlcKd);
                    temp = temp.Replace("@sIlKd", branch.SIlKd.Trim());
                    temp = temp.Replace("@tlf", branch.Tlf);
                    temp = temp.Replace("@adr", branch.Adr);
                    temp = temp.Replace("@fks", branch.Fks);
                    temp = temp.Replace("@epst", branch.Epst);
                    temp = temp.Replace("@sonIslemTuru", branch.SonIslemTuru.Trim());
                    temp = temp.Replace("@sonIslemZamani", branch.SonIslemZamani.Trim());
                    sqlStatement += temp;
                }

                try
                {
                    using (SqlConnection connection = new SqlConnection("data source=yourDb;persist security info=True;initial catalog=yourcatalog;User id=yourid;Password=yourpass")
                    {
                        SqlCommand command = new SqlCommand(sqlStatement, connection);
                        connection.Open();
                        command.ExecuteNonQuery();
                        connection.Close();
                    }
                    sqlStatement = String.Empty;
                    result = true;
                }
                catch
                {
                    MessageBox.Show("Dosyada sorunlu veri var.");
                    result = false;
                    sqlStatement = String.Empty;
                    break;
                }
            }      
        }