Exemplo n.º 1
0
        /// <summary>
        /// 数据更新
        /// </summary>
        /// <param name="newValue">更新后对象</param>
        /// <returns>影响记录条数</returns>
        public int Update(ModelView.MesFbInfoView newValue)
        {
            Model.TableModel.Mes_fb_info        model     = View2Model(newValue);
            List <Model.TableModel.Mes_fb_info> modelList = new List <Model.TableModel.Mes_fb_info>();

            modelList.Add(model);
            return(DbEngine.QueryInt <Model.TableModel.Mes_fb_info>("update", modelList));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 实体类转视图类
 /// </summary>
 /// <param name="model">实体类</param>
 /// <returns>视图类</returns>
 private ModelView.MesFbInfoView Model2View(Model.TableModel.Mes_fb_info model)
 {
     ModelView.MesFbInfoView view = new ModelView.MesFbInfoView();
     view.id                = model.id;
     view.serial_no         = model.serial_no;
     view.eqm_no            = model.eqm_no;
     view.part_no           = model.part_no;
     view.information       = model.information;
     view.information_value = model.information_value;
     view.create_time       = model.create_time.HasValue?((DateTime)model.create_time).ToString("yyyy-MM-dd HH:mm:ss.fff"):string.Empty;
     return(view);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="where">where子句</param>
        /// <param name="orderBy">排序子句</param>
        /// <param name="pageSize">页面大小</param>
        /// <param name="pageIndex">页面索引</param>
        /// <param name="total">out参数,返回总记录条数</param>
        /// <returns>视图对象列表</returns>
        public List <ModelView.MesFbInfoView> GetListPage(string where, Dictionary <string, string> orderBy, int pageSize, int pageIndex, out int total)
        {
            List <Model.TableModel.Mes_fb_info> list = DbEngine.QueryPage <Model.TableModel.Mes_fb_info>("mes_fb_info", pageIndex, pageSize, where, orderBy, out total);
            List <ModelView.MesFbInfoView>      res  = new List <ModelView.MesFbInfoView>();

            foreach (Model.TableModel.Mes_fb_info item in list)
            {
                ModelView.MesFbInfoView model = Model2View(item);
                res.Add(model);
            }
            return(res);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="where">where子句</param>
        /// <param name="orderBy">排序子句</param>
        /// <param name="pageSize">页面大小</param>
        /// <param name="pageIndex">页面索引</param>
        /// <returns>最终结果字符串</returns>
        public string GetListPage(string where, Dictionary <string, string> orderBy, int pageSize, int pageIndex)
        {
            int total = 0;
            List <Model.TableModel.Mes_fb_info> list = DbEngine.QueryPage <Model.TableModel.Mes_fb_info>("mes_fb_info", pageIndex, pageSize, where, orderBy, out total);
            List <ModelView.MesFbInfoView>      res  = new List <ModelView.MesFbInfoView>();

            foreach (Model.TableModel.Mes_fb_info item in list)
            {
                ModelView.MesFbInfoView model = Model2View(item);
                res.Add(model);
            }
            return(Common.JsonHelper.SerializeObject(new { total = total, rows = res }));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 视图类转实体类
        /// </summary>
        /// <param name="view">视图类</param>
        /// <returns>实体类</returns>
        private Model.TableModel.Mes_fb_info View2Model(ModelView.MesFbInfoView view)
        {
            Model.TableModel.Mes_fb_info model = new Model.TableModel.Mes_fb_info();
            if (string.IsNullOrEmpty(view.id))
            {
                model.id = Common.Md5Operate.CreateGuidId();
            }
            else
            {
                model.id = view.id;
            }
            model.serial_no         = string.IsNullOrEmpty(view.serial_no) ? null : view.serial_no;
            model.eqm_no            = string.IsNullOrEmpty(view.eqm_no) ? null : view.eqm_no;
            model.information       = string.IsNullOrEmpty(view.information) ? null : view.information;
            model.information_value = string.IsNullOrEmpty(view.information_value) ? null : view.information_value;
            model.part_no           = view.part_no;
            DateTime dt = DateTime.Now;

            model.create_time = string.IsNullOrEmpty(view.create_time) ? DateTime.Now : DateTime.TryParse(view.create_time, out dt) ? dt.Date : DateTime.Now;
            return(model);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 更新操作
 /// </summary>
 /// <param name="jsonStr">更新后对象的json序列化字符串</param>
 /// <returns>影响记录条数</returns>
 public int Update(string jsonStr)
 {
     ModelView.MesFbInfoView model = Common.JsonHelper.DeserializeJsonToObject <ModelView.MesFbInfoView>(jsonStr);
     return(Update(model));
 }