Exemple #1
0
        void btnbakanligagezicigonder_Click(object sender, EventArgs e)
        {
            try
            {
                if (Current.AktifDoktorId == 0)
                {
                    MessageBox.Show("Aktif Doktor belirsiz devam edemezsiniz.", "Hata");
                }
                Cursor.Current = Cursors.WaitCursor;
                CMvs mvs = new CMvs();
                foreach (DataRow item in dtgezici.Rows)
                {
                    if (!Convert.ToBoolean(item["Seç"]))
                        continue;
                    Hasta hasta = Persistence.Read<Hasta>(item["TckNo"]);
                    btnbakanligagezicigonder.Text = hasta.TckNo + ":" + hasta.Adi + " " + hasta.Soyadi + " bakanlığa *Gezici Hizmet bildirimi* yapılıyor...";

                    BebekCocukBilgi[] bebekcocukbilgi =
                            Persistence.ReadList<BebekCocukBilgi>(
                                    @"select top 1 * from BebekCocukBilgi where aktif=1 and Hasta_Id=@prm0", Convert.ToInt64(item["TckNo"]));
                    Application.DoEvents();

                    int sonuc = -1;
                    string[] IletisimKod = new string[1];
                    string[] IletisimDegeri = new string[1];
                    int[] AdresTipiKodu = new int[1];
                    string[] AcikAdres = new string[1];
                    int[] MahalleKodu = new int[1];
                    string[] MahalleAdi = new string[1];
                    int[] IlKodu = new int[1];
                    string[] IlAdi = new string[1];
                    int[] IlceKodu = new int[1];
                    string[] IlceAdi = new string[1];
                    int[] UlkeKodu = new int[1];
                    string[] UlkeAdi = new string[1];
                    string[] PostaKodu = new string[1];

                    IletisimKod[0] = "65";// ((int)hasta.IletisimTip).ToString();
                    IletisimDegeri[0] = "Telefon";// hasta.IletisimTip.ToString();
                    AdresTipiKodu[0] = 71;// (int)hasta.AdresTip;
                    AcikAdres[0] = "";


                    if (rbbeyan.Checked)
                    {
                        if (hasta.LokasyonMahalleKoy.Id > 0)
                        {
                            MahalleKodu[0] = (int)hasta.LokasyonMahalleKoy.Id;
                            Lokasyon lkm = Persistence.Read<Lokasyon>(hasta.LokasyonMahalleKoy.Id);
                            MahalleAdi[0] = lkm.Adi;
                        }
                        else
                            if (hasta.LokasyonMahalle.Id > 0)
                            {
                                MahalleKodu[0] = (int)hasta.LokasyonMahalle.Id;
                                Lokasyon lm = Persistence.Read<Lokasyon>(hasta.LokasyonMahalle.Id);
                                MahalleAdi[0] = lm.Adi;
                            }
                            else
                            {
                                MahalleKodu[0] = 0;
                                MahalleAdi[0] = "";
                            }

                        if (hasta.LokasyonSehir.Id > 0)
                        {
                            IlKodu[0] = (int)hasta.LokasyonSehir.Id;
                            Lokasyon li = Persistence.Read<Lokasyon>(hasta.LokasyonSehir.Id);
                            IlAdi[0] = li.Adi;
                        }
                        else
                        {
                            IlKodu[0] = 0;
                            IlAdi[0] = "";
                        }

                        if (hasta.Lokasyonilce.Id > 0)
                        {
                            IlceKodu[0] = (int)hasta.Lokasyonilce.Id;
                            Lokasyon lic = Persistence.Read<Lokasyon>(hasta.Lokasyonilce.Id);
                            IlceAdi[0] = lic.Adi;
                        }
                        else
                        {
                            IlceKodu[0] = 0;
                            IlceAdi[0] = "";
                        }
                    }
                    else //rbTUIK.checked
                    {
                        if (hasta.TUIKMahalle.Length > 0)
                        {
                            Lokasyon[] lmh =
                            Persistence.ReadList<Lokasyon>(
                                    @"select top 1 * from Lokasyon 
                                        where adi=@prm0", hasta.TUIKMahalle.Replace(" KÖYÜ", "").Replace(" MAH.", ""));
                            if (lmh != null)
                                if (lmh.Length > 0)
                                {
                                    MahalleAdi[0] = lmh[0].Adi;
                                    MahalleKodu[0] = (int)lmh[0].Id;
                                }
                        }
                        else
                            if (hasta.TUIKKoy.Length > 0)
                            {
                                Lokasyon[] lkoy =
                                Persistence.ReadList<Lokasyon>(
                                        @"select top 1 * from Lokasyon 
                                        where adi=@prm0", hasta.TUIKKoy.Replace(" KÖYÜ", "").Replace(" MAH.", ""));
                                if (lkoy != null)
                                    if (lkoy.Length > 0)
                                    {
                                        MahalleAdi[0] = lkoy[0].Adi;
                                        MahalleKodu[0] = (int)lkoy[0].Id;
                                    }
                            }

                        if (hasta.TUIKIl.Length > 0)
                        {
                            Lokasyon[] lil =
                            Persistence.ReadList<Lokasyon>(
                                    @"select top 1 * from Lokasyon 
                                        where adi=@prm0", hasta.TUIKIl);
                            if (lil != null)
                                if (lil.Length > 0)
                                {
                                    IlAdi[0] = lil[0].Adi;
                                    IlKodu[0] = (int)lil[0].Id;
                                }
                        }
                        else
                        {
                            IlKodu[0] = 0;
                            IlAdi[0] = "";
                        }

                        if (hasta.TUIKIlce.Length > 0)
                        {
                            Lokasyon[] lilce =
                            Persistence.ReadList<Lokasyon>(
                                    @"select top 1 * from Lokasyon 
                                        where adi=@prm0", hasta.TUIKIlce);
                            if (lilce != null)
                                if (lilce.Length > 0)
                                {
                                    IlceAdi[0] = lilce[0].Adi;
                                    IlceKodu[0] = (int)lilce[0].Id;
                                }
                        }
                        else
                        {
                            IlceKodu[0] = 0;
                            IlceAdi[0] = "";
                        }
                    }

                    if (hasta.Ulke.Id > 0)
                    {
                        UlkeKodu[0] = (int)hasta.Ulke.Id;
                        Ulke u = Persistence.Read<Ulke>(hasta.Ulke.Id);
                        UlkeAdi[0] = "";
                    }
                    else
                    {
                        UlkeKodu[0] = 10221;
                        UlkeAdi[0] = "";
                    }
                    PostaKodu[0] = "00000";

                    string kangrup = ((int)myenum.KanGrubu.Belirtilmemis).ToString();
                    if (hasta.KanGrubu != 0)
                        kangrup = ((int)hasta.KanGrubu).ToString();

                    string medenihal = ((int)myenum.MedeniHali.Belirtilmemis).ToString();
                    if (hasta.MedeniHali != 0)
                        medenihal = ((int)hasta.MedeniHali).ToString();

                    string egitim = ((int)myenum.EgitimDurumu.Belirtilmemis).ToString();
                    if (hasta.EgitimDurumu != 0)
                        egitim = ((int)hasta.EgitimDurumu).ToString();

                    string kurumtip = ((int)myenum.SosyalGuvenlikKurumTipi.Yok).ToString();
                    if (hasta.KurumTipi != 0)
                        kurumtip = ((int)hasta.KurumTipi).ToString();

                    Current.globalresmessage = mvs.fHastaGuncelle(
                            Calismatur,
                            Current.AktifDoktor.TckNo.ToString(),
                            Current.AktifDoktor.TckNo.ToString(),
                            Current.AktifDoktor.WebServisSifre,
                            Current.AktifDoktor.Adi,
                            Current.AktifDoktor.Soyadi,
                            Current.AktifDoktor.TckNo.ToString(),
                            Current.AktifDoktor.Adi,
                            Current.AktifDoktor.Soyadi,
                            Current.AktifDoktor.Diplomano,
                            DateTime.Now.ToString("yyyyMMdd"),
                            hasta.TckNo.ToString(),
                            hasta.Adi,
                            hasta.Soyadi,
                            hasta.BabaAdi,
                            hasta.AnneAdi,
                            hasta.Cinsiyeti.ToString(),
                            hasta.DogumTarihi.ToString("yyyyMMdd"),
                            ((int)hasta.KayitDurumu).ToString(),
                            egitim,
                            kangrup,
                            medenihal,
                            kurumtip,
                            hasta.Uyruk.ToString(),
                            hasta.Uyruk.ToString(),//uyrukadi
                            null,//meslek
                            0,//hastatipi
                            IletisimKod,
                            IletisimDegeri,
                            AdresTipiKodu,
                            AcikAdres,
                            MahalleKodu,
                            MahalleAdi,
                            IlKodu,
                            IlAdi,
                            IlceKodu,
                            IlceAdi,
                            UlkeKodu,
                            UlkeAdi,
                            PostaKodu,
                            0,//bebekcocukbilgi[0].Agirligi,
                            0,//bebekcocukbilgi[0].Boyu,
                            0,//bebekcocukbilgi[0].BasCevresi,
                            "0",//(Convert.ToByte(bebekcocukbilgi[0].FenilKetonuriIcinKanAlindimi)).ToString(),
                            "0",//(Convert.ToByte(bebekcocukbilgi[0].BebekDogumKomplikasyonVarmi)).ToString(),
                            0,//(int)bebekcocukbilgi[0].EkGidaBaslamaAy,
                            out sonuc
                        );

                    if (sonuc == 0)
                    {
                        hasta.GeziciHizmetVerilenHasta = true;
                        hasta.TransferDurumu = myenum.TransferDurumu.Alindi;
                    }
                    else
                        hasta.TransferDurumu = (myenum.TransferDurumu)10 + sonuc;

                    if (Current.globalresmessage.Length > 1950)
                        hasta.TransferSonuc = "Gezici bildirimi  " + Current.globalresmessage.Substring(1, 950);
                    else
                        hasta.TransferSonuc = "Gezici bildirimi  " + Current.globalresmessage;
                    item["SonTransferSonuc"] = "Gezici bildirimi  " + Current.globalresmessage;

                    if (Current.globalresmessage == "HastaKimlikKayitBilgisiKapali")
                        hasta.Aktif = false;

                    Application.DoEvents();
                    hasta.Update();
                }
            }

            finally
            {
                btnbakanligagezicigonder.Text = "Bakanlığa Gezici Bildir[3]";
                Application.DoEvents();
                Cursor.Current = Cursors.Default;
            }

        }