Esempio n. 1
0
 public bool UpdateDeathLine(DateTime ym, DateTime deathLine, int modifyUserId, out string error)
 {
     try
     {
         error = string.Empty;
         DeathLine updateDeathLine = GetDeathLineByKeyValues(ym);
         if (updateDeathLine != null)
         {
             updateDeathLine.DeathLineDate = deathLine;
             updateDeathLine.ModifyUserId  = modifyUserId;
             updateDeathLine.ModifyDate    = DateTime.Now;
             _ctx.SaveChanges();
             return(true);
         }
         else
         {
             error = "No DeathLine data in database";
             return(false);
         }
     }
     catch (Exception ex)
     {
         error = ex.Message;
         return(false);
     }
 }
Esempio n. 2
0
 public bool DeleteDeathLine(DateTime ym, out string error)
 {
     try
     {
         error = string.Empty;
         DeathLine removeDeathLine = GetDeathLineByKeyValues(ym);
         _ctx.DeathLines.Remove(removeDeathLine);
         _ctx.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         error = ex.Message;
         return(false);
     }
 }
Esempio n. 3
0
        public DeathLineListModel(DeathLine deathLine, string nameOfUser)
        {
            if (deathLine != null)
            {
                YM = deathLine.YM;
                if (deathLine.DeathLineDate.HasValue)
                {
                    DeathLineDate = deathLine.DeathLineDate.Value;
                }
                if (deathLine.ModifyDate.HasValue)
                {
                    ModifyDate = deathLine.ModifyDate.Value;
                }

                if (deathLine.ModifyUserId.HasValue)
                {
                    ModifyName = nameOfUser;
                }
            }
        }
Esempio n. 4
0
        public bool InsertDeathLine(DateTime ym, DateTime deathLine, int modifyUserId, out string error)
        {
            try
            {
                error = string.Empty;
                DeathLine newDeathLine = new DeathLine();
                newDeathLine.YM            = ym;
                newDeathLine.DeathLineDate = deathLine;
                newDeathLine.ModifyUserId  = modifyUserId;
                newDeathLine.ModifyDate    = DateTime.Now;

                _ctx.DeathLines.Add(newDeathLine);
                _ctx.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }