Esempio n. 1
0
        /// <summary>
        /// Log any executed command by user
        /// </summary>
        /// <param name="module"></param>
        /// <param name="status"></param>
        /// <param name="command"></param>
        /// <param name="account"></param>
        /// <param name="newValue"></param>
        /// <param name="oldValue"></param>
        public static void CommandLog(bool status, ClinicEnums.Module module, string command, AccountModel account, object newValue = null, object oldValue = null)
        {
            try
            {
                var log = new LogModel
                {
                    Start        = DateTime.Now,
                    Module       = module.ToString(),
                    Status       = status ? "SUCCESS" : "ERROR",
                    Command      = command,
                    UserName     = account.UserName,
                    Organization = account.Organization,
                    OldValue     = oldValue is null ? null : JsonConvert.SerializeObject(oldValue),
                    NewValue     = newValue is null ? null : JsonConvert.SerializeObject(newValue),
                    CreatedBy    = account.UserCode,
                    CreatedDate  = DateTime.Now
                };

                var _entity = Mapper.Map <LogModel, Log>(log);

                using (var context = new KlinikDBEntities())
                {
                    context.Logs.Add(_entity);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                using (EventLog eventLog = new EventLog("Application"))
                {
                    eventLog.Source = "Application";
                    eventLog.WriteEntry(ex.GetAllMessages(), EventLogEntryType.Error, 101, 1);
                }
            }
        }
Esempio n. 2
0
        private void BtnEkle_Click(object sender, EventArgs e)
        {
            btnEkle.Visible = true;
            if (yeniKayit == false)
            {
                Yenile();
                btnEkle.Text        = "Kaydet";
                btnGuncelle.Visible = false;
                bynSil.Visible      = false;
                yeniKayit           = true;
            }
            else
            {
                try
                {
                    Hasta yeniHasta = new Hasta();
                    yeniHasta.H_CID    = Convert.ToByte(cmbCinsiyet.SelectedIndex);
                    yeniHasta.H_AD     = txtAd.Text;
                    yeniHasta.H_SOYAD  = txtSoyad.Text;
                    yeniHasta.H_EMAIL  = txtEmail.Text;
                    yeniHasta.H_ADRES  = txtAdres.Text;
                    yeniHasta.H_DTARIH = dateTimeDogumTarihi.Value;
                    yeniHasta.H_DURUM  = true;
                    yeniHasta.H_TC     = txtTC.Text;
                    yeniHasta.H_TEL    = txtTel.Text;

                    db.Hasta.Add(yeniHasta);
                    try
                    {
                        db.SaveChanges();
                        MessageBox.Show("Hasta Kayıt Edildi", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Yenile();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Hasta Kayıt Edilemedi !! Veri Girişlerini Kontrol Edin", "Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Veritabanına Ulaşılamıyor. Ağ Bağlantınızı Kontrol Edin ve Verileri Düzgün girdiğinizden emin olun", "Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Esempio n. 3
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            #region "Run Voice"

            string _sortNumbCd = string.Empty;
            int    _poliId     = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PoliID"].ToString());
            using (KlinikDBEntities context = new KlinikDBEntities())
            {
                try
                {
                    var qry = context.PanggilanPolis.Where(x => x.PoliID == _poliId).OrderBy(x => x.SortNumber).FirstOrDefault();
                    if (qry != null && isSpeak == false)
                    {
                        isSpeak        = true;
                        richTxtNo.Text = qry.QueueCode;


                        char[] arrays = richTxtNo.Text.ToCharArray();
                        foreach (char c in arrays)
                        {
                            if (c != '-')
                            {
                                string strC = c.ToString();
                                GetWav(strC);
                            }
                        }


                        var toBeDel = context.PanggilanPolis.SingleOrDefault(x => x.Id == qry.Id);
                        if (toBeDel != null)
                        {
                            context.PanggilanPolis.Remove(toBeDel);
                            context.SaveChanges();
                        }

                        isSpeak = false;
                    }
                }
                catch (Exception ex)
                {
                    isSpeak = false;
                    throw new Exception(ex.Message);
                }
                #endregion
            }
        }
Esempio n. 4
0
 int IUnitOfWork.Save()
 {
     return(_context.SaveChanges());
 }