Exemple #1
0
 public string GetMarkingNoByUserId(string userId)
 {
     try
     {
         if (EnumAppConfig.IsLocal)
         {
             DBContext.Label label = _localUnitOfWork.DataContext.Labels.FirstOrDefault(d => d.UserId == userId);
             if (label == null)
             {
                 return(string.Empty);
             }
             else
             {
                 return(label.MarkingNo);
             }
         }
         else
         {
             DBContext.Label label = _centralizedUnitOfWork.DataContext.Labels.FirstOrDefault(d => d.UserId == userId);
             if (label == null)
             {
                 return(string.Empty);
             }
             else
             {
                 return(label.MarkingNo);
             }
         }
     }
     catch (Exception e)
     {
         return(string.Empty);
     }
 }
Exemple #2
0
 public DBContext.Label GetByDateAndUserId(DateTime Date, string UserId)
 {
     try
     {
         if (EnumAppConfig.IsLocal)
         {
             DBContext.Label label = _localUnitOfWork.DataContext.Labels.FirstOrDefault(d => DbFunctions.TruncateTime(d.Date).Value == Date && d.UserId == UserId);
             if (label != null || EnumAppConfig.ByPassCentralizedDB)
             {
                 return(label);
             }
             else
             {
                 bool centralizeStatus;
                 var  centralUpdate = CallCentralized.Get <Label>(EnumAPIParam.Label, "GetByDateAndUserId", out centralizeStatus, "date=" + Date.ToString(), "UserId=" + UserId);
                 if (centralizeStatus)
                 {
                     return(centralUpdate);
                 }
                 return(null);
             }
         }
         else
         {
             return(_centralizedUnitOfWork.DataContext.Labels.FirstOrDefault(d => DbFunctions.TruncateTime(d.Date).Value == Date && d.UserId == UserId));
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }