private void btn_kaydet_Click(object sender, EventArgs e) // FORUMKONULARI_TBL ye kayıt atar ya da kayıt günceller.
        {
            if (txt_konu.Text == "")
            {
                MessageBox.Show("Lütfen Konu belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_konu.Focus();
                return;
            }

            try
            {
                FORUMKONULARI_TBL kayit;
                if (frid == 0)
                {
                    kayit = new FORUMKONULARI_TBL();
                }
                else
                {
                    kayit = (from p in veri.FORUMKONULARI_TBL where p.FR_ID == frid select p).SingleOrDefault();
                }
                kayit.FR_ADI      = txt_konu.Text;
                kayit.FR_ACIKLAMA = txt_aciklama.Text;
                kayit.FR_AKTIF    = chk_aktif.Checked;

                if (frid == 0)
                {
                    veri.FORUMKONULARI_TBL.Add(kayit);
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (frid == 0)
                {
                    AnaForm.logkaydet("Forum Konusu", "Ekleme (" + txt_konu.Text + ")");
                }
                else
                {
                    AnaForm.logkaydet("Forum Konusu", "Güncelleme (" + txt_konu.Text + ")");
                }

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void btn_kaydet_Click(object sender, EventArgs e) // GENELAYARLAR_TBL deki kaydı günceller.
        {
            if ((TimeSpan)tsp_gunbaslamasaati.EditValue >= (TimeSpan)tsp_gunbitissaati.EditValue)
            {
                MessageBox.Show("Gün bitiş saati, başlama saatinden küçük ya da eşit olamaz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tsp_gunbitissaati.Focus();
                return;
            }
            try
            {
                var sonuc = (from p in veri.GENELAYARLAR_TBL select p).ToList();
                sonuc[0].GA_GUNBASLAMASAAT    = (TimeSpan)tsp_gunbaslamasaati.EditValue;
                sonuc[0].GA_GUNBITISSAAT      = (TimeSpan)tsp_gunbitissaati.EditValue;
                sonuc[0].GA_CUMARTESICALIS    = chk_cumartesicalis.Checked;
                sonuc[0].GA_PAZARCALIS        = chk_pazarcalis.Checked;
                sonuc[0].GA_ANASAYFA_BASLIK   = txt_baslik.Text;
                sonuc[0].GA_CIHAZIP           = txt_domainadi.Text;
                sonuc[0].GA_YAKLASANRANDEVUDK = (TimeSpan)tsp_yaklasanrandk.EditValue;

                sonuc[0].GA_FTP_IP        = txt_sunucu.Text;
                sonuc[0].GA_FTP_KULLANICI = txt_ftpkul.Text;
                sonuc[0].GA_FTP_SIFRE     = txt_ftpsifre.Text;
                sonuc[0].GA_FTP_DIZIN     = txt_ftpdizin.Text;

                if (rd_ranlist.Checked == true)
                {
                    sonuc[0].GA_RANDEVUISTEKSAYFA = "TAKVIM";
                }
                else
                {
                    sonuc[0].GA_RANDEVUISTEKSAYFA = "EKLE";
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Application.OpenForms["AnaForm"].Text = txt_baslik.Text;


                AnaForm.logkaydet("Genel Ayarlar", "Güncelleme");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private void button_sil_Click(object sender, EventArgs e) // CALISMATAKVIMI_TBL den kayıt siler.
        {
            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                ctid = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("CT_ID"));
                var kayit = (from p in veri.CALISMATAKVIMI_TBL where p.CT_ID == ctid select p).SingleOrDefault();
                if (kayit != null)
                {
                    veri.CALISMATAKVIMI_TBL.Remove(kayit);
                    veri.SaveChanges();
                }
                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (sayfacal_id == 0)
                {
                    AnaForm.logkaydet("Genel Tatil/Ek Mesai", "Silme (" + Convert.ToString(grdview_list.GetFocusedRowCellValue("CT_ADI")) + ")");
                }
                else
                {
                    AnaForm.logkaydet("Tatil/Ek Mesai", "Silme (" + Convert.ToString(grdview_list.GetFocusedRowCellValue("CT_ADI")) + ")" + "(" + lbl_calisma.Text + ")");
                }

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button_msjduzenle_Click(object sender, EventArgs e) // seçili mesajı düzenleme ekranını açar
        {
            if (grdview_mesaj.GetFocusedRow() == null)
            {
                return;
            }

            MesajDuzenle dlg = new CallCenter.MesajDuzenle(Convert.ToInt32(grdview_mesaj.GetFocusedRowCellValue("MSJ_ID")));

            dlg.txt_mesaj.Text = grdview_mesaj.GetFocusedRowCellValue("MSJ_MESAJ").ToString();
            if (dlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            AnaForm.logkaydet("Forum Mesajı", "Güncelleme (" + grdview_list.GetFocusedRowCellValue("FR_ADI").ToString() + ")");

            listelemesajlar();
        }
        private void SchedulerDataStorage1_AppointmentsDeleted(object sender, PersistentObjectsEventArgs e)
        {
            AppointmentBaseCollection appts = (AppointmentBaseCollection)e.Objects;

            foreach (Appointment apt in appts)
            {
                int id    = Convert.ToInt32(apt.Id);
                var kayıt = (from inc in veri.RANDEVULAR_TBL  where inc.RAN_ID == id select inc).SingleOrDefault();
                kayıt.RAN_KAPANMA = AnaForm.tarihsaatgetir();
                //veri.RANDEVULAR_TBL.Remove(kayıt);
                veri.SaveChanges();


                int calid   = Convert.ToInt32(kayıt.RAN_CAL_ID);
                int istid   = Convert.ToInt32(kayıt.RAN_IST_ID);
                var calisma = (from p in veri.CALISMALAR_TBL where p.CAL_ID == calid select p).SingleOrDefault();
                var istek   = (from p in veri.ISTEKLER_TBL where p.IST_ID == istid select p).SingleOrDefault();
                AnaForm.logkaydet("Randevu", "Silme (" + calisma.CAL_CALISMAID + " " + calisma.CAL_ADI + ")(" + istek.IST_TELNO + ")");
            }
        }
        private void SchedulerDataStorage1_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
        {
            AppointmentBaseCollection appts = (AppointmentBaseCollection)e.Objects;

            foreach (Appointment apt in appts)
            {
                int id    = Convert.ToInt32(apt.Id);
                var kayıt = (from inc in veri.RANDEVULAR_TBL where inc.RAN_ID == id select inc).SingleOrDefault();

                kayıt.RAN_ACIKLAMA     = apt.Description;
                kayıt.RAN_BASLAMATARIH = apt.Start;
                kayıt.RAN_BITISTARIH   = apt.End;
                kayıt.RAN_TELNO        = apt.Subject;
                kayıt.RAN_DURUMID      = Convert.ToInt32(apt.LabelKey); //apt.LabelId yerine  apt.LabelKey yazdırdı
                veri.SaveChanges();

                int calid   = Convert.ToInt32(kayıt.RAN_CAL_ID);
                var calisma = (from p in veri.CALISMALAR_TBL where p.CAL_ID == calid select p).SingleOrDefault();
                AnaForm.logkaydet("Randevu", "Düzenleme (" + calisma.CAL_CALISMAID + " " + calisma.CAL_ADI + ")(" + apt.Subject + ")");
            }
        }
        private void button_sil_Click(object sender, EventArgs e) //CALISMAPERIYOTLARI_TBL den kayıt siler.
        {
            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                cpid = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("CP_ID"));
                var kayit = (from p in veri.CALISMAPERIYOTLARI_TBL where p.CP_ID == cpid select p).SingleOrDefault();
                if (kayit != null)
                {
                    veri.CALISMAPERIYOTLARI_TBL.Remove(kayit);
                    veri.SaveChanges();
                }

                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                AnaForm.logkaydet("Çalışma Aktif Periyodu", "Silme (" + lbl_calisma.Text + ")");

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
        private void button_sil_Click(object sender, EventArgs e) //RANDEVULISTERENKLERI_TBL den kayıt siler.
        {
            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }
            br_id = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("BR_ID"));

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                var kayit = (from p in veri.RANDEVULISTERENKLERI_TBL where p.BR_ID == br_id select p).SingleOrDefault();
                if (kayit != null)
                {
                    veri.RANDEVULISTERENKLERI_TBL.Remove(kayit);
                    veri.SaveChanges();
                }

                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                AnaForm.logkaydet("Bekleyen Randevu Renkleri", "Liste Düzenleme ");

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button_sil_Click(object sender, EventArgs e) // FORUMKONULARI_TBL den kayıt siler
        {
            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Foruma ait tüm mesajlar silinecektir.Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                frid = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("FR_ID"));
                var kayit = (from p in veri.FORUMKONULARI_TBL where p.FR_ID == frid select p).SingleOrDefault();
                if (kayit != null)
                {
                    veri.FORUMKONULARI_TBL.Remove(kayit);
                    veri.SaveChanges();
                }
                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                AnaForm.logkaydet("Forum Konusu", "Silme (" + Convert.ToString(grdview_list.GetFocusedRowCellValue("FR_ADI")) + ")");

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #10
0
        private void button_msjsil_Click(object sender, EventArgs e) // seçili mesajı siler.
        {
            if (grdview_mesaj.GetFocusedRow() == null)
            {
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Seçili mesaj silinecektir.Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                msjid = Convert.ToInt32(grdview_mesaj.GetFocusedRowCellValue("MSJ_ID"));
                var kayit = (from p in veri.MESAJLAR_TBL where p.MSJ_ID == msjid select p).SingleOrDefault();
                if (kayit != null)
                {
                    veri.MESAJLAR_TBL.Remove(kayit);
                    veri.SaveChanges();
                }
                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                AnaForm.logkaydet("Forum Mesajı", "Silme (" + grdview_list.GetFocusedRowCellValue("FR_ADI").ToString() + ")");

                listelemesajlar();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #11
0
        private void button_sil_Click(object sender, EventArgs e) //SSS_TBL deki kaydı siler.
        {
            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                ssid = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("SS_ID"));
                var kayit = (from p in veri.SSS_TBL  where p.SS_ID == ssid select p).SingleOrDefault();
                if (kayit != null)
                {
                    veri.SSS_TBL.Remove(kayit);
                    veri.SaveChanges();
                }
                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AnaForm.logkaydet("Sık Sorulan Sorular", "Silme (" + Convert.ToString(grdview_list.GetFocusedRowCellValue("CAL_CALISMAID")) + " " + Convert.ToString(grdview_list.GetFocusedRowCellValue("CAL_ADI")) + ")(" +
                                  Convert.ToString(grdview_list.GetFocusedRowCellValue("SS_SORU")) + ")"
                                  );
                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_kaydet_Click(object sender, EventArgs e)  // CALISMALAR_TBL ye kayıt ekler ya da günceller
        {
            string calismaid = "";

            if (cmb_periyot.Text == "Manuel Aralık")
            {
                calismaid = txt_mancalismaid.Text;
            }
            else
            {
                calismaid = cmb_calismaid.Text;
            }

            if (calismaid == "")
            {
                MessageBox.Show("Lütfen Çalışma ID belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cmb_periyot.Text == "Manuel Aralık")
                {
                    txt_mancalismaid.Focus();;
                }
                else
                {
                    cmb_calismaid.Focus();
                }
                return;
            }

            var varmi = (from p in veri.CALISMALAR_TBL where p.CAL_CALISMAID == calismaid && p.CAL_ID != cal_id select p).SingleOrDefault();

            if (varmi != null)
            {
                string msj = "";
                if (varmi.CAL_SIL == true)
                {
                    msj = "Bu Çalışma ID daha önce silinmiştir, tanımlanamaz";
                }
                else
                {
                    msj = "Aynı Çalışma ID birden fazla tanımlanamaz...";
                }

                MessageBox.Show(msj, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                if (cmb_periyot.Text == "Manuel Aralık")
                {
                    txt_mancalismaid.Focus();;
                }
                else
                {
                    cmb_calismaid.Focus();
                }
                return;
            }

            if (txt_adi.Text == "")
            {
                MessageBox.Show("Lütfen Çalışma Adı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_adi.Focus();
                return;
            }

            if (dt_yili.Text == "")
            {
                MessageBox.Show("Lütfen Çalışma Yılı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_yili.Focus();
                return;
            }
            if (cmb_periyot.Text == "")
            {
                MessageBox.Show("Lütfen Çalışma Periyodu belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmb_periyot.Focus();
                return;
            }
            if (dt_baslama.Text == "")
            {
                MessageBox.Show("Lütfen Başlama Tarihi belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_baslama.Focus();
                return;
            }

            if (dt_bitis.Text == "")
            {
                MessageBox.Show("Lütfen Bitiş Tarihi belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_bitis.Focus();
                return;
            }

            if (Convert.ToDateTime(dt_baslama.DateTime) >= Convert.ToDateTime(dt_bitis.DateTime))
            {
                MessageBox.Show("Bitiş Tarihi, Başlama Tarihinden küçük ya da eşit olamaz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_bitis.Focus();
                return;
            }


            //if (tsp_gunbaslamasaati.EditValue == null )
            //{
            //    MessageBox.Show("Lütfen Gün Başlama Saati belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    tsp_gunbaslamasaati.Focus();
            //    return;
            //}

            //if (tsp_gunbitissaati.EditValue == null)
            //{
            //    MessageBox.Show("Lütfen Gün Bitiş Saati belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    tsp_gunbitissaati.Focus();
            //    return;
            //}

            if (t_randevudk.EditValue == null)
            {
                MessageBox.Show("Lütfen Randevu Aralığı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                t_randevudk.Focus();
                return;
            }

            if (tsp_gunbaslamasaati.EditValue != null && tsp_gunbitissaati.EditValue != null)
            {
                if ((TimeSpan)tsp_gunbaslamasaati.EditValue >= (TimeSpan)tsp_gunbitissaati.EditValue)
                {
                    MessageBox.Show("Gün Bitiş Saati, Başlama Saatinden küçük ya da eşit olamaz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    tsp_gunbitissaati.Focus();
                    return;
                }
            }



            try
            {
                CALISMALAR_TBL kayit;
                if (cal_id == 0)
                {
                    kayit = new CALISMALAR_TBL();
                }
                else
                {
                    kayit = (from p in veri.CALISMALAR_TBL where p.CAL_ID == cal_id select p).SingleOrDefault();
                }
                kayit.CAL_CALISMAID    = calismaid; //cmb_calismaid.Text;
                kayit.CAL_ADI          = txt_adi.Text;
                kayit.CAL_PERIYOT      = cmb_periyot.Text;
                kayit.CAL_YIL          = dt_yili.DateTime;
                kayit.CAL_BASLAMATARIH = dt_baslama.DateTime;
                kayit.CAL_BITISTARIH   = dt_bitis.DateTime;
                if (tsp_gunbaslamasaati.EditValue != null)
                {
                    kayit.CAL_GUNBASLAMASAAT = (TimeSpan)tsp_gunbaslamasaati.EditValue;
                }
                if (tsp_gunbitissaati.EditValue != null)
                {
                    kayit.CAL_GUNBITISSAAT = (TimeSpan)tsp_gunbitissaati.EditValue;
                }
                kayit.CAL_RANDEVUARALIK = (TimeSpan)t_randevudk.EditValue;
                kayit.CAL_MANUELARAMA   = chk_manuelara.Checked;
                kayit.CAL_SEC           = false;
                kayit.CAL_SIL           = false;

                if (cal_id == 0)
                {
                    veri.CALISMALAR_TBL.Add(kayit);
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (cal_id == 0)
                {
                    AnaForm.logkaydet("Çalışma", "Ekleme (" + calismaid + " " + txt_adi.Text + ")");
                }
                else
                {
                    AnaForm.logkaydet("Çalışma", "Güncelleme (" + calismaid + " " + txt_adi.Text + ")");
                }

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #13
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            dt_bitis.DateTime = edtStartDate.DateTime.Date.AddHours(edtStartTime.Time.Hour).AddMinutes(edtStartTime.Time.Minute).AddMinutes(AnaForm.randk);


            if (edtLabel.AppointmentLabel == null)
            {
                MessageBox.Show("Lütfen Durum belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (edtStartDate.DateTime.Date.AddHours(edtStartTime.Time.Hour).AddMinutes(edtStartTime.Time.Minute) < AnaForm.tarihsaatgetir())
            {
                MessageBox.Show("Geçmiş tarihe randevu alınamaz", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //string sonuc = AnaForm.CalismaAktifPeriyotMu (dt_baslama.DateTime);
            //if (sonuc!= "")
            //{
            //    MessageBox.Show(sonuc, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}

            if (AnaForm.CalismaAktifPeriyotMu(edtStartDate.DateTime.Date.AddHours(edtStartTime.Time.Hour).AddMinutes(edtStartTime.Time.Minute), AnaForm.ist_id, AnaForm.cal_id, 0) == false)
            {
                return;
            }

            DateTime baslama = edtStartDate.DateTime.Date.AddHours(edtStartTime.Time.Hour).AddMinutes(edtStartTime.Time.Minute);
            DateTime bitis   = edtEndDate.DateTime.Date.AddHours(edtEndTime.Time.Hour).AddMinutes(edtEndTime.Time.Minute);

            var dolumu = (from p in veri.RANDEVULAR_TBL where p.RAN_KUL_ID == AnaForm.userid &&
                          ((p.RAN_BASLAMATARIH >= baslama && p.RAN_BASLAMATARIH <= bitis) ||
                           (p.RAN_BITISTARIH >= baslama && p.RAN_BITISTARIH <= bitis) ||
                           (baslama >= p.RAN_BASLAMATARIH && baslama <= p.RAN_BITISTARIH) ||
                           (bitis >= p.RAN_BASLAMATARIH && bitis <= p.RAN_BITISTARIH)

                          )

                          select p).ToList();

            if (dolumu.Count() > 0)
            {
                MessageBox.Show(dolumu[0].RAN_BASLAMATARIH.ToString() + " - " + dolumu[0].RAN_BITISTARIH.ToString() + " aralığında randevunuz bulunmaktadır.", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                RANDEVULAR_TBL ekle = new RANDEVULAR_TBL();

                ekle.RAN_IST_ID = AnaForm.ist_id;
                ekle.RAN_KUL_ID = AnaForm.userid;
                ekle.RAN_CAL_ID = AnaForm.cal_id;

                ekle.RAN_ACIKLAMA = tbDescription.Text;
                //ekle.RAN_BASLAMATARIH = edtStartDate.DateTime.AddHours(edtStartTime.Time.Hour).AddMinutes(edtStartTime.Time.Minute);
                //ekle.RAN_BITISTARIH = edtEndDate.DateTime.AddHours(edtEndTime.Time.Hour).AddMinutes(edtEndTime.Time.Minute);
                ekle.RAN_BASLAMATARIH = baslama;
                ekle.RAN_BITISTARIH   = bitis;
                ekle.RAN_TELNO        = tbSubject.Text;
                ekle.RAN_DURUMID      = Convert.ToInt32(edtLabel.AppointmentLabel.Id);
                ekle.RAN_SEC          = false;
                veri.RANDEVULAR_TBL.Add(ekle);
                veri.SaveChanges();


                var calisma = (from p in veri.CALISMALAR_TBL where p.CAL_ID == AnaForm.cal_id select p).SingleOrDefault();

                AnaForm.logkaydet("Randevu", "Ekleme (" + calisma.CAL_CALISMAID + " " + calisma.CAL_ADI + ")");

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #14
0
        private void btn_mesajgonder_Click(object sender, EventArgs e) // MESAJLAR_TBL ye kayıt atar.
        {
            if (forumlist.Count() < 1)
            {
                MessageBox.Show("Kayıtlı konu yok...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_mesaj.Focus();
                return;
            }

            if (grdview_list.GetFocusedRow() == null)
            {
                MessageBox.Show("Kayıtlı konu yok...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_mesaj.Focus();
                return;
            }


            if (txt_mesaj.Text == "")
            {
                MessageBox.Show("Lütfen mesajınızı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_mesaj.Focus();
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Mesajınız '" + grdview_list.GetFocusedRowCellValue("FR_ADI").ToString().ToUpper() + "' başlığında listelenecektir. Devam etmek istiyor musunuz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }


            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }
            try
            {
                MESAJLAR_TBL kayit;
                kayit            = new MESAJLAR_TBL();
                kayit.MSJ_KUL_ID = AnaForm.userid;
                kayit.MSJ_FR_ID  = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("FR_ID"));
                kayit.MSJ_TARIH  = AnaForm.tarihsaatgetir();
                kayit.MSJ_MESAJ  = txt_mesaj.Text;
                kayit.MSJ_OKUNDU = false;
                if (frid == 0)
                {
                    veri.MESAJLAR_TBL.Add(kayit);
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Gönderildi" : "Gönderilemedi!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                AnaForm.logkaydet("Forum Mesajı", "Gönderme (" + grdview_list.GetFocusedRowCellValue("FR_ADI").ToString() + ")");

                listelemesajlar();
                txt_mesaj.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #15
0
        private void btn_kaydet_Click(object sender, EventArgs e) // CALISMATAKVIMI_TBL a kayıt atar.
        {
            if (txt_adi.Text == "")
            {
                MessageBox.Show("Lütfen Tatil/Ek Mesai Adı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_adi.Focus();
                return;
            }
            if (Convert.ToDateTime(dt_1.DateTime) >= Convert.ToDateTime(dt_2.DateTime))
            {
                MessageBox.Show("Bitiş tarihi, başlama tarihinden küçük ya da eşit olamaz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_2.Focus();
                return;
            }

            try
            {
                CALISMATAKVIMI_TBL kayit;
                if (ctid == 0)
                {
                    kayit = new CALISMATAKVIMI_TBL();
                }
                else
                {
                    kayit = (from p in veri.CALISMATAKVIMI_TBL where p.CT_ID == ctid select p).SingleOrDefault();
                }

                if (sayfacal_id != 0)              //genel ise null kalır ct_cal_id
                {
                    kayit.CT_CAL_ID = sayfacal_id; //bu bir defa gelir bir daha değişmez.
                }
                kayit.CT_ADI     = txt_adi.Text;
                kayit.CT_BASLAMA = dt_1.DateTime;
                kayit.CT_BITIS   = dt_2.DateTime;
                kayit.CT_CALIS   = chk_calis.Checked;

                if (ctid == 0)
                {
                    veri.CALISMATAKVIMI_TBL.Add(kayit);
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                string islem = "";
                islem = ctid == 0 ? "Ekleme " : "Güncelleme ";

                if (sayfacal_id == 0) //genel ise null kalır ct_cal_id
                {
                    AnaForm.logkaydet("Genel Tatil/Ek Mesai", islem + "(" + txt_adi.Text + ")");
                }
                else
                {
                    AnaForm.logkaydet("Tatil/Ek Mesai", islem + "(" + txt_adi.Text + ")" + "(" + lbl_calisma.Text + ")");
                }

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_kaydet_Click(object sender, EventArgs e) //KULLANICILAR_TBL a kayıt atar ya da günceller.
        {
            if (cmb_kulid.Text == "")
            {
                MessageBox.Show("Lütfen Kullanıcı ID belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmb_kulid.Focus();
                return;
            }

            if (cmb_rol.Text == "")
            {
                MessageBox.Show("Lütfen Rol belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmb_rol.Focus();
                return;
            }

            if (txt_kuladi.Text == "")
            {
                MessageBox.Show("Lütfen Kullanıcı Adı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_kuladi.Focus();
                return;
            }

            if (txt_sifre.Text == "")
            {
                MessageBox.Show("Lütfen Şifre belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_sifre.Focus();
                return;
            }

            var varmi = (from p in veri.KULLANICILAR_TBL where p.KUL_KULLANICIID == cmb_kulid.Text && p.KUL_ID != kulid select p).SingleOrDefault();

            if (varmi != null)
            {
                string msj = "";
                if (varmi.KUL_SIL == true)
                {
                    msj = "Bu Kullanıcı ID daha önce silinmiştir, tanımlanamaz...";
                }
                else
                {
                    msj = "Aynı Kullanıcı ID birden fazla tanımlanamaz...";
                }
                MessageBox.Show(msj, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmb_kulid.Focus();
                return;
            }

            try
            {
                KULLANICILAR_TBL kayit;
                if (kulid == 0)
                {
                    kayit = new KULLANICILAR_TBL();
                    kayit.KUL_HOPARLORDUZEYI = 100;
                    kayit.KUL_MIKROFONDUZEYI = 100;
                }
                else
                {
                    kayit = (from p in veri.KULLANICILAR_TBL where p.KUL_ID == kulid select p).SingleOrDefault();
                }

                kayit.KUL_ADI           = txt_kuladi.Text;
                kayit.KUL_SIFRE         = txt_sifre.Text;
                kayit.KUL_SANTRALUSERID = txt_santralkuladi.Text;
                kayit.KUL_SANTRALSIFRE  = txt_santralsifre.Text;
                kayit.KUL_ROL_ID        = Convert.ToInt32(cmb_rol.EditValue);
                kayit.KUL_KULLANICIID   = cmb_kulid.Text;
                kayit.KUL_SEC           = false;
                kayit.KUL_SIL           = false;

                if (kulid == 0)
                {
                    veri.KULLANICILAR_TBL.Add(kayit);
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (kulid == 0)
                {
                    AnaForm.logkaydet("Kullanıcı", "Ekleme (" + cmb_kulid.Text + " " + txt_kuladi.Text + ")");
                }
                else
                {
                    AnaForm.logkaydet("Kullanıcı", "Güncelleme (" + cmb_kulid.Text + " " + txt_kuladi.Text + ")");
                }

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button_sil_Click(object sender, EventArgs e) //  KULLANICILAR_TBL den kayıt siler.
        {
            if (grdview_list.GetFocusedRow() == null)
            {
                return;
            }

            if (Convert.ToInt32(grdview_list.GetFocusedRowCellValue("KUL_ID")) == AnaForm.userid)
            {
                MessageBox.Show("Kendi kullanıcınızı silemezsiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (Convert.ToString(grdview_list.GetFocusedRowCellValue("ROL_ANAROL")) == "Admin")
            {
                List <KULLANICILAR_V> kullistsorgu;
                using (conn = new NpgsqlConnection(AnaForm.cstr))
                {
                    conn.Open();
                    kullistsorgu = conn.Query <KULLANICILAR_V>("select * from public.\"KULLANICILAR_V\" where \"KUL_SIL\"=FALSE  and \"ROL_ANAROL\"='Admin' and \"KUL_ID\"<> " + Convert.ToInt32(grdview_list.GetFocusedRowCellValue("KUL_ID")) + "").ToList();
                }

                if (kullistsorgu.Count() == 0) //silmek istediği admin anarollü kullanıcıdan başka, admin anarollü kullanıcı yok.
                {
                    MessageBox.Show("En az bir Admin Ana Rolü olmalı, bu yüzden silinemez...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Silmek istediğinizden emin misiniz?", "Uyarı!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (cikis == DialogResult.No)
            {
                return;
            }

            try
            {
                kulid = Convert.ToInt32(grdview_list.GetFocusedRowCellValue("KUL_ID"));
                var kayit = (from p in veri.KULLANICILAR_TBL where p.KUL_ID == kulid select p).SingleOrDefault();
                if (kayit != null)
                {
                    //veri.KULLANICILAR_TBL.Remove(kayit);
                    //veri.SaveChanges();

                    kayit.KUL_SIL          = true;
                    kayit.KUL_SILME_TARIH  = AnaForm.tarihsaatgetir();
                    kayit.KUL_SILME_KUL_ID = AnaForm.userid;
                    veri.SaveChanges();
                }
                MessageBox.Show("Silindi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                AnaForm.logkaydet("Kullanıcı", "Silme (" + Convert.ToString(grdview_list.GetFocusedRowCellValue("KUL_KULLANICIID")) + " " + Convert.ToString(grdview_list.GetFocusedRowCellValue("KUL_ADI")) + ")");

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Silinemedi, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (cmb_calismaid.Text == "")
            {
                MessageBox.Show("Lütfen Çalışma ID belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                cmb_calismaid.Focus();
                return;
            }

            //if (cmb_kulid.Text == "")
            //{
            //    MessageBox.Show("Lütfen Kullanıcı ID belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    cmb_kulid.Focus();
            //    return;
            //}

            if (txt_brmno.Text == "")
            {
                MessageBox.Show("Lütfen Birim No belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_brmno.Focus();
                return;
            }

            if (txt_altbrmno.Text == "")
            {
                MessageBox.Show("Lütfen Alt Birim No belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_altbrmno.Focus();
                return;
            }
            //if (txt_yil.Text == "")
            //{
            //    MessageBox.Show("Lütfen Referans Yıl belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    txt_yil.Focus();
            //    return;
            //}


            if (txt_tel.Text.Contains("_"))
            {
                MessageBox.Show("Lütfen Telefon No belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_tel.Focus();
                return;
            }

            string cumle = "";

            if (cmb_kulid.Visible == true)
            {
                cumle = "select * from public.\"KULLANICICALISMALAR_V\" WHERE (\"KUL_KULLANICIID\" = '" + cmb_kulid.EditValue.ToString() + "' and \"CAL_CALISMAID\" = '" + cmb_calismaid.EditValue.ToString() + "') ORDER BY \"CAL_CALISMAID\"";
            }
            else
            {
                cumle = "select * from public.\"KULLANICICALISMALAR_V\" WHERE (\"KC_KUL_ID\" = " + AnaForm.userid + " and \"CAL_CALISMAID\" = '" + cmb_calismaid.EditValue.ToString() + "') ORDER BY \"CAL_CALISMAID\"";
            }
            using (conn = new NpgsqlConnection(AnaForm.cstr))
            {
                conn.Open();
                kullanicicalismalarlist = conn.Query <KULLANICICALISMALAR_V>(cumle).ToList();
            }

            if (kullanicicalismalarlist.Count() < 1)
            {
                MessageBox.Show("Çalışma ve kullanıcı bağlantısı bulunamadı...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txt_donem.Text == "")
            {
                //MessageBox.Show("Lütfen Referans Dönem belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //txt_donem.Focus();
                //return;
            }
            if (txt_ay.Text == "")
            {
                //MessageBox.Show("Lütfen Referans Ay belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //txt_ay.Focus();
                //return;
            }
            if (txt_hafta.Text == "")
            {
                //MessageBox.Show("Lütfen Referans Hafta belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //txt_hafta.Focus();
                //return;
            }
            try
            {
                ISTEKLER_TBL kayit;
                kayit = new ISTEKLER_TBL();

                kayit.IST_TARIH       = AnaForm.tarihsaatgetir();
                kayit.IST_CALISMAID   = cmb_calismaid.Text;
                kayit.IST_KULLANICIID = AnaForm.userkullaniciid; //cmb_kulid.Text;
                kayit.IST_BIRIMNO     = Convert.ToInt32(txt_brmno.Text);
                kayit.IST_ALTBIRIMNO  = Convert.ToInt32(txt_altbrmno.Text);
                if (txt_yil.Text != "")
                {
                    kayit.IST_REFYIL = Convert.ToInt32(txt_yil.Text);
                }
                if (txt_donem.Text != "" && txt_donem.Text != "0")
                {
                    kayit.IST_REFDONEM = Convert.ToInt32(txt_donem.Text);
                }
                if (txt_ay.Text != "" && txt_ay.Text != "0")
                {
                    kayit.IST_REFAY = Convert.ToInt32(txt_ay.Text);
                }
                if (txt_hafta.Text != "" && txt_hafta.Text != "0")
                {
                    kayit.IST_REFHAFTA = Convert.ToInt32(txt_hafta.Text);
                }
                kayit.IST_TELNO = txt_tel.Text.Replace("(", "").Replace(")", "").Replace("_", "").Replace(" ", "");
                //txt_tel.Text;
                kayit.IST_IL            = txt_il.Text;
                kayit.IST_ACIKLAMA      = txt_aciklama.Text;
                kayit.IST_RANDEVUTERCIH = txt_randevutercih.Text;
                if (rd_cagri.Checked == true)
                {
                    kayit.IST_NEDIR = "C";
                }
                else
                {
                    kayit.IST_NEDIR = "R";
                }


                kayit.IST_ICERDEN = true;
                veri.ISTEKLER_TBL.Add(kayit);

                string calismaadi = cmb_calismaid.Text;

                var calisma = (from p in veri.CALISMALAR_TBL where p.CAL_SIL != true && p.CAL_CALISMAID == cmb_calismaid.Text select p).SingleOrDefault();
                if (calisma != null)
                {
                    calismaadi = cmb_calismaid.Text + " " + calisma.CAL_ADI;
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AnaForm.logkaydet("İstek", "Ekleme (" + calismaadi + ")" + "(" + txt_tel.Text + ")");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btn_kaydet_Click(object sender, EventArgs e) // CALISMAPERIYOTLARI_TBL tablosuna kayıt atar ya da günceller.
        {
            if (dt_yil.Text == "" && dt_yil.Visible == true)
            {
                MessageBox.Show("Lütfen Çalışma Yılı belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                dt_yil.Focus();
                return;
            }
            if (sp_donem.Text == "" && sp_donem.Visible == true && sp_ay.Visible == false && sp_hafta.Visible == false) //ay ve haftada dönem zorunlu değil. tabi dönemlikte zorunlu
            {
                MessageBox.Show("Lütfen Dönem belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                sp_donem.Focus();
                return;
            }

            if (sp_ay.Text == "" && sp_ay.Visible == true)
            {
                MessageBox.Show("Lütfen Ay belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                sp_ay.Focus();
                return;
            }

            if (sp_hafta.Text == "" && sp_hafta.Visible == true)
            {
                MessageBox.Show("Lütfen Hafta belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                sp_hafta.Focus();
                return;
            }


            if (tbl_referans_panel.Visible == true)
            {
                if (dt_manuel_basla.Text == "" && dt_manuel_basla.Visible == true)
                {
                    MessageBox.Show("Lütfen Manuel Başlama Tarihi belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    dt_manuel_basla.Focus();
                    return;
                }

                if (dt_manuel_bitis.Text == "" && dt_manuel_bitis.Visible == true)
                {
                    MessageBox.Show("Lütfen Manuel Bitiş Tarihi belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    dt_manuel_bitis.Focus();
                    return;
                }
            }
            if (dt_baslama.Text == "")
            {
                MessageBox.Show("Lütfen Başlama Tarihi belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_baslama.Focus();
                return;
            }

            if (dt_bitis.Text == "")
            {
                MessageBox.Show("Lütfen Bitiş Tarihi belirtiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                dt_bitis.Focus();
                return;
            }



            try
            {
                CALISMAPERIYOTLARI_TBL kayit;
                if (cpid == 0)
                {
                    kayit = new CALISMAPERIYOTLARI_TBL();
                }
                else
                {
                    kayit = (from p in veri.CALISMAPERIYOTLARI_TBL where p.CP_ID == cpid select p).SingleOrDefault();
                }
                if (dt_yil.Visible == true)
                {
                    kayit.CP_REFYIL = dt_yil.DateTime;
                }
                if (sp_donem.Visible == true && sp_donem.Text != null && sp_donem.Text != "" && sp_donem.Text != "0")
                {
                    kayit.CP_REFDONEM = Convert.ToInt32(sp_donem.Text);
                }
                else
                {
                    kayit.CP_REFDONEM = null;
                }

                if (sp_ay.Visible == true && sp_ay.Text != null && sp_ay.Text != "" && sp_ay.Text != "0")
                {
                    kayit.CP_REFAY = Convert.ToInt32(sp_ay.Text);
                }
                else
                {
                    kayit.CP_REFAY = null;
                }
                if (sp_hafta.Visible == true && sp_hafta.Text != null && sp_hafta.Text != "" && sp_hafta.Text != "0")
                {
                    kayit.CP_REFHAFTA = Convert.ToInt32(sp_hafta.Text);
                }
                else
                {
                    kayit.CP_REFHAFTA = null;
                }

                if (dt_manuel_basla.Visible == true)
                {
                    kayit.CP_REF_MA_BASLANGIC = dt_manuel_basla.DateTime;
                }
                if (dt_manuel_bitis.Visible == true)
                {
                    kayit.CP_REF_MA_BITIS = dt_manuel_bitis.DateTime;
                }
                kayit.CP_BASLAMATARIH = dt_baslama.DateTime;
                kayit.CP_BITISTARIH   = dt_bitis.DateTime;
                kayit.CP_AKTIF        = chk_aktif.Checked;
                kayit.CP_CAL_ID       = sayfacal_id;

                if (cpid == 0)
                {
                    veri.CALISMAPERIYOTLARI_TBL.Add(kayit);
                }

                MessageBox.Show(veri.SaveChanges() > 0 ? "Kaydedildi" : "Değişiklik yok!", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (cpid == 0)
                {
                    AnaForm.logkaydet("Çalışma Aktif Periyodu", "Ekleme (" + lbl_calisma.Text + ")");
                }
                else
                {
                    AnaForm.logkaydet("Çalışma Aktif Periyodu", "Güncelleme (" + lbl_calisma.Text + ")");
                }

                listele();
                temizle();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Kaydedilemedi, Hata:" + ex.Message, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #20
0
        private void btn_mesajgonder_Click(object sender, EventArgs e) // MESAJLAR_TBL ye kayıt atar.
        {
            if (kullist == null)
            {
                return;
            }

            int secilen = kullist.Where(p => p.KUL_SEC == true).Count();

            if (secilen == 0)
            {
                MessageBox.Show("Lütfen mesaj göndermek istediğiniz kullanıcı(ları) seçiniz...", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (txt_mesaj.Text == "")
            {
                MessageBox.Show("Lütfen mesajınızı belirtiniz");
                txt_mesaj.Focus();
                return;
            }

            DialogResult cikis = new DialogResult();

            cikis = MessageBox.Show("Mesajınız " + secilen + " kişiye gönderilecektir. Devam etmek istiyor musunuz?", "Uyarı!", MessageBoxButtons.YesNo);
            if (cikis == DialogResult.No)
            {
                return;
            }


            CallCenterEntities veri2 = new CallCenterEntities(); //kullanıcılar tablosuna seç durumlarını kaydetmesin diye...

            veri2.Database.Connection.ConnectionString = AnaForm.cstr;

            try
            {
                MESAJLAR_TBL kayit;
                kayit            = new MESAJLAR_TBL();
                kayit.MSJ_KUL_ID = AnaForm.userid;
                //kayit.MSJ_FR_ID = 0;
                kayit.MSJ_TARIH  = AnaForm.tarihsaatgetir(); //DateTime.Now;
                kayit.MSJ_MESAJ  = txt_mesaj.Text;
                kayit.MSJ_OKUNDU = false;
                veri2.MESAJLAR_TBL.Add(kayit);
                veri2.SaveChanges();

                //kul_sec field inden çalışıyordu:
                //foreach (var item in kullist.Where(p => p.KUL_SEC == true).ToList())
                //{
                //    MESAJALICILARI_TBL alici= new MESAJALICILARI_TBL();
                //    alici.MA_ALICI_KUL_ID = item.KUL_ID;
                //    alici.MA_MSJ_ID = kayit.MSJ_ID;
                //    veri2.MESAJALICILARI_TBL.Add(alici);
                //    veri2.SaveChanges();
                //}
                //kul_sec field inden çalışıyordu.

                int[] selectedRowHandles = grdview_list.GetSelectedRows();
                if (selectedRowHandles.Length > 0)
                {
                    for (int i = 0; i < selectedRowHandles.Length; i++)
                    {// MessageBox.Show(grdview_list.GetRowCellDisplayText(selectedRowHandles[i], KULADI).ToString());
                        MESAJALICILARI_TBL alici = new MESAJALICILARI_TBL();
                        alici.MA_ALICI_KUL_ID = Convert.ToInt32(grdview_list.GetRowCellDisplayText(selectedRowHandles[i], KUL_ID));
                        alici.MA_MSJ_ID       = kayit.MSJ_ID;
                        veri2.MESAJALICILARI_TBL.Add(alici);
                        veri2.SaveChanges();
                    }
                }

                MessageBox.Show("Gönderildi", "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AnaForm.logkaydet("Mesaj", "Gönderme ");

                txt_mesaj.Text = "";
                //foreach (var item in kullist.Where(p => p.KUL_SEC == true).ToList())
                //{
                //    item.KUL_SEC = false;
                //}
                //mesajlaşma devam ediyor olabilir, seçimini kendisi kaldırsın.
                sayfaokunmayanlar = false;
                listelemesajlar();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Gönderme Tamamlanamadı, Hata:" + ex.Message, "Uyarı!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }