/// <summary> /// 删除操作 /// </summary> /// <param name="oldValue">要删除的值</param> /// <returns>影响记录条数</returns> public int Delete(ModelView.QcmQualityView oldValue) { Model.TableModel.Qcm_quality model = View2Model(oldValue); List <Model.TableModel.Qcm_quality> modelList = new List <Model.TableModel.Qcm_quality>(); modelList.Add(model); return(DbEngine.QueryInt <Model.TableModel.Qcm_quality>("Delete", modelList)); }
/// <summary> /// 数据插入 /// </summary> /// <param name="newValue">新插入的值</param> /// <returns>影响记录条数</returns> public int Insert(ModelView.QcmQualityView newValue) { Model.TableModel.Qcm_quality model = View2Model(newValue); List <Model.TableModel.Qcm_quality> modelList = new List <Model.TableModel.Qcm_quality>(); modelList.Add(model); return(DbEngine.QueryInt <Model.TableModel.Qcm_quality>("Insert", modelList)); }
/// <summary> /// 实体类转视图类 /// </summary> /// <param name="model">实体类</param> /// <returns>视图类</returns> private ModelView.QcmQualityView Model2View(Model.TableModel.Qcm_quality model) { ModelView.QcmQualityView view = new ModelView.QcmQualityView(); view.id = model.id; view.status_name = model.status_name; view.status_no = model.status_no; view.quality_no = model.quality_no; view.quality_name = model.quality_name; return(view); }
/// <summary> /// 删除操作 /// </summary> /// <param name="oldValues">要删除的多个值</param> /// <returns>影响记录条数</returns> public int Delete(List <ModelView.QcmQualityView> oldValues) { List <Model.TableModel.Qcm_quality> modelList = new List <Model.TableModel.Qcm_quality>(); foreach (ModelView.QcmQualityView item in oldValues) { Model.TableModel.Qcm_quality model = View2Model(item); modelList.Add(model); } return(DbEngine.QueryInt <Model.TableModel.Qcm_quality>("Delete", modelList)); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Qcm_quality View2Model(ModelView.QcmQualityView view) { Model.TableModel.Qcm_quality model = new Model.TableModel.Qcm_quality(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no) ? "310" : view.status_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.quality_no = string.IsNullOrEmpty(view.quality_no) ? globalDataCtrl.GetNextNoByTblName("qcm_quality") : view.quality_no; model.quality_name = view.quality_name; return(model); }