Ejemplo n.º 1
0
        public virtual DEF_TestJobsModel GetById(string id)
        {
            if (IsExists(id))
            {
                DEF_TestJobs      entity = m_Rep.GetById(id);
                DEF_TestJobsModel model  = new DEF_TestJobsModel();
                model.VerCode     = entity.VerCode;
                model.Name        = entity.Name;
                model.Result      = entity.Result;
                model.Description = entity.Description;
                model.Creator     = entity.Creator;
                model.CrtDt       = entity.CrtDt;
                model.CloseState  = entity.CloseState;
                model.Closer      = entity.Closer;
                model.CloseDt     = entity.CloseDt;
                model.Def         = entity.Def;
                model.CheckFlag   = entity.CheckFlag;

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        //新增
        public override bool Create(ref ValidationErrors errors, DEF_TestJobsModel model)
        {
            try
            {
                //测试关键数值是否有效
                if (entityIsExist(model.VerCode))
                {
                    errors.Add("测试任务已存在");
                    return(false);
                }
                //新建对象
                DEF_TestJobs entity = new DEF_TestJobs();

                //实现从模型到对象设置值

                entity.VerCode     = model.VerCode;
                entity.Name        = model.Name;
                entity.Result      = model.Result;
                entity.Description = model.Description;
                entity.Creator     = model.Creator;
                entity.CrtDt       = model.CrtDt;
                entity.CloseState  = false;
                entity.Closer      = null;
                entity.CloseDt     = null;
                entity.CheckFlag   = true;

                if (repository.Create(entity))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public virtual bool Create(ref ValidationErrors errors, DEF_TestJobsModel model)
        {
            try
            {
                DEF_TestJobs entity = m_Rep.GetById(model.VerCode);
                if (entity != null)
                {
                    errors.Add(Resource.PrimaryRepeat);
                    return(false);
                }
                entity             = new DEF_TestJobs();
                entity.VerCode     = model.VerCode;
                entity.Name        = model.Name;
                entity.Result      = model.Result;
                entity.Description = model.Description;
                entity.Creator     = model.Creator;
                entity.CrtDt       = model.CrtDt;
                entity.CloseState  = model.CloseState;
                entity.Closer      = model.Closer;
                entity.CloseDt     = model.CloseDt;
                entity.Def         = model.Def;
                entity.CheckFlag   = model.CheckFlag;


                if (m_Rep.Create(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Resource.InsertFail);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(false);
            }
        }
Ejemplo n.º 4
0
        public virtual bool Edit(ref ValidationErrors errors, DEF_TestJobsModel model)
        {
            try
            {
                DEF_TestJobs entity = m_Rep.GetById(model.VerCode);
                if (entity == null)
                {
                    errors.Add(Resource.Disable);
                    return(false);
                }
                entity.VerCode     = model.VerCode;
                entity.Name        = model.Name;
                entity.Result      = model.Result;
                entity.Description = model.Description;
                entity.Creator     = model.Creator;
                entity.CrtDt       = model.CrtDt;
                entity.CloseState  = model.CloseState;
                entity.Closer      = model.Closer;
                entity.CloseDt     = model.CloseDt;
                entity.Def         = model.Def;
                entity.CheckFlag   = model.CheckFlag;



                if (m_Rep.Edit(entity))
                {
                    return(true);
                }
                else
                {
                    errors.Add(Resource.NoDataChange);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);
                return(false);
            }
        }