Example #1
0
 public bool creatall(ref ValidationErrors errors, JOBTestScoreModel model)
 {
     try
     {
         JOBTestScore entity = m_Rep.GetById(model.Id);
         if (entity != null)
         {
             errors.Add(Suggestion.PrimaryRepeat);
             return(false);
         }
         entity           = new JOBTestScore();
         entity.Id        = model.Id;
         entity.Name      = model.Name;
         entity.Score     = model.Score;
         entity.StudentId = model.StudentId;
         if (m_Rep.Create(entity))
         {
             return(true);
         }
         else
         {
             errors.Add(Suggestion.InsertFail);
             return(false);
         }
     }
     catch (Exception ex)
     {
         errors.Add(ex.Message);
         ExceptionHander.WriteException(ex);
         return(false);
     }
 }
Example #2
0
        public virtual bool Edit(ref ValidationErrors errors, JOBTestScoreModel model)
        {
            try
            {
                JOBTestScore entity = m_Rep.GetById(model.Id);
                if (entity == null)
                {
                    errors.Add(Suggestion.Disable);
                    return(false);
                }
                entity.Id        = model.Id;
                entity.Name      = model.Name;
                entity.StudentId = model.StudentId;
                entity.Score     = model.Score;



                if (m_Rep.Edit(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Suggestion.NoDataChange);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(false);
            }
        }
Example #3
0
        public virtual JOBTestScoreModel GetById(string id)
        {
            if (IsExists(id))
            {
                JOBTestScore      entity = m_Rep.GetById(id);
                JOBTestScoreModel model  = new JOBTestScoreModel();
                model.Id        = entity.Id;
                model.Name      = entity.Name;
                model.StudentId = entity.StudentId;
                model.Score     = entity.Score;

                return(model);
            }
            else
            {
                return(null);
            }
        }