Ejemplo n.º 1
0
        public virtual bool Create(ref ValidationErrors errors, SysModuleRightModel model)
        {
            try
            {
                SysModuleRight entity = m_Rep.GetById(model.Id);
                if (entity != null)
                {
                    errors.Add(Resource.PrimaryRepeat);
                    return(false);
                }
                entity           = new SysModuleRight();
                entity.Id        = model.Id;
                entity.ModuleId  = model.ModuleId;
                entity.UserId    = model.UserId;
                entity.Rightflag = model.Rightflag;


                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.º 2
0
        public virtual bool Edit(ref ValidationErrors errors, SysModuleRightModel model)
        {
            try
            {
                SysModuleRight entity = m_Rep.GetById(model.Id);
                if (entity == null)
                {
                    errors.Add(Resource.Disable);
                    return(false);
                }
                entity.Id        = model.Id;
                entity.ModuleId  = model.ModuleId;
                entity.UserId    = model.UserId;
                entity.Rightflag = model.Rightflag;



                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);
            }
        }
Ejemplo n.º 3
0
        public virtual SysModuleRightModel GetById(string id)
        {
            if (IsExists(id))
            {
                SysModuleRight      entity = m_Rep.GetById(id);
                SysModuleRightModel model  = new SysModuleRightModel();
                model.Id        = entity.Id;
                model.ModuleId  = entity.ModuleId;
                model.UserId    = entity.UserId;
                model.Rightflag = entity.Rightflag;

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