示例#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 klinikEntities())
                {
                    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);
                }
            }
        }
 public List <BakimTip> KlinikYeniGiris(BakimTip veri)
 {
     try
     {
         bakim b = new bakim();
         b.hastaID  = veri.hastaID;
         b.doktorID = veri.doktorID;
         b.ilacID   = veri.ilacID;
         _ent.bakim.Add(b);
         _ent.SaveChanges();
         return(BakilanHastalar(veri.hastaID));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
示例#3
0
 public List <IlacTip> YeniIlac(ilac giris)
 {
     try
     {
         ilac i = new ilac();
         i.ilacID  = giris.ilacID;
         i.ilacAd  = giris.ilacAd;
         i.ilacDoz = giris.ilacDoz;
         _ent.ilac.Add(i);
         _ent.SaveChanges();
         return(IlaclariGetir());
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
 public List <DoktorTip> YeniDoktor(doktor kayit)
 {
     try
     {
         doktor d = new doktor();
         d.doktorID    = kayit.doktorID;
         d.doktorAd    = kayit.doktorAd;
         d.doktorSoyad = d.doktorSoyad;
         _ent.doktor.Add(d);
         _ent.SaveChanges();
         return(DoktorlariGetir());
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
示例#5
0
 public List <HastaTip> YeniHasta(hasta kayit)
 {
     try
     {
         hasta h = new hasta();
         h.hastaID          = kayit.hastaID;
         h.hastaAd          = kayit.hastaAd;
         h.hastaSoyad       = kayit.hastaSoyad;
         h.hastaGelisNedeni = kayit.hastaGelisNedeni;
         _ent.hasta.Add(h);
         _ent.SaveChanges();
         return(HastalariGetir());
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
示例#6
0
 int IUnitOfWork.Save()
 {
     return(_context.SaveChanges());
 }