Esempio n. 1
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="oldValue">要删除的值</param>
        /// <returns>影响记录条数</returns>
        public int Delete(ModelView.SysGroupView oldValue)
        {
            Model.TableModel.Sys_group        model     = View2Model(oldValue);
            List <Model.TableModel.Sys_group> modelList = new List <Model.TableModel.Sys_group>();

            modelList.Add(model);
            return(DbEngine.QueryInt <Model.TableModel.Sys_group>("Delete", modelList));
        }
Esempio n. 2
0
        /// <summary>
        /// 数据插入
        /// </summary>
        /// <param name="newValue">新插入的值</param>
        /// <returns>影响记录条数</returns>
        public int Insert(ModelView.SysGroupView newValue)
        {
            Model.TableModel.Sys_group        model     = View2Model(newValue);
            List <Model.TableModel.Sys_group> modelList = new List <Model.TableModel.Sys_group>();

            modelList.Add(model);
            return(DbEngine.QueryInt <Model.TableModel.Sys_group>("Insert", modelList));
        }
Esempio n. 3
0
 /// <summary>
 /// 实体类转视图类
 /// </summary>
 /// <param name="model">实体类</param>
 /// <returns>视图类</returns>
 private ModelView.SysGroupView Model2View(Model.TableModel.Sys_group model)
 {
     ModelView.SysGroupView view = new ModelView.SysGroupView();
     view.id          = model.id;
     view.group_no    = model.group_no;
     view.group_name  = model.group_name;
     view.status_name = model.status_name;
     view.status_no   = model.status_no;
     return(view);
 }
Esempio n. 4
0
        /// <summary>
        /// 删除操作
        /// </summary>
        /// <param name="oldValues">要删除的多个值</param>
        /// <returns>影响记录条数</returns>
        public int Delete(List <ModelView.SysGroupView> oldValues)
        {
            List <Model.TableModel.Sys_group> modelList = new List <Model.TableModel.Sys_group>();

            foreach (ModelView.SysGroupView item in oldValues)
            {
                Model.TableModel.Sys_group model = View2Model(item);
                modelList.Add(model);
            }
            return(DbEngine.QueryInt <Model.TableModel.Sys_group>("Delete", modelList));
        }
Esempio n. 5
0
        /// <summary>
        /// 视图类转实体类
        /// </summary>
        /// <param name="view">视图类</param>
        /// <returns>实体类</returns>
        private Model.TableModel.Sys_group View2Model(ModelView.SysGroupView view)
        {
            Model.TableModel.Sys_group model = new Model.TableModel.Sys_group();
            if (string.IsNullOrEmpty(view.id))
            {
                model.id = Common.Md5Operate.CreateGuidId();
            }
            else
            {
                model.id = view.id;
            }
            GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl();

            model.group_no    = string.IsNullOrEmpty(view.group_no)?globalDataCtrl.GetNextNoByTblName("sys_group"):view.group_no;
            model.group_name  = view.group_name;
            model.status_name = view.status_name;
            model.status_no   = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no;
            return(model);
        }