/// <summary> /// 实体类转视图类 /// </summary> /// <param name="model">标准流程实体类</param> /// <returns>视图类</returns> private ModelView.ApoActView Model2View(Model.TableModel.Apo_item model) { ModelView.ApoActView view = new ModelView.ApoActView(); view.id = model.id; view.status_name = model.status_name; view.status_no = model.status_no; view.act_no = string.Empty; view.apo_no = model.apo_no; view.apo_item_no = model.apo_item_no; view.apo_item_name = model.apo_item_name; view.apo_index = model.apo_index.ToString(); view.next_item_no = model.next_item_no; view.next_item_name = string.Empty; view.next_user_name = string.Empty; view.act_desc = string.Empty; view.act_result = string.Empty; view.act_step = string.Empty; view.act_user_no = string.Empty; view.act_user_name = string.Empty; view.act_time = string.Empty; view.ralate_no = string.Empty; view.ralate_file_name = string.Empty; view.ralate_file_extension = string.Empty; view.ralate_type_no = string.Empty; view.step_finished = string.Empty; view.apo_finished = string.Empty; view.dept_no = string.Empty; view.dept_name = string.Empty; return(view); }
/// <summary> /// 视图类转实体类 /// </summary> /// <param name="view">视图类</param> /// <returns>实体类</returns> private Model.TableModel.Apo_item View2Model(ModelView.ApoItemView view) { Model.TableModel.Apo_item model = new Model.TableModel.Apo_item(); if (string.IsNullOrEmpty(view.id)) { model.id = Common.Md5Operate.CreateGuidId(); } else { model.id = view.id; } string tmp = string.IsNullOrEmpty(view.apo_index)?"1":view.apo_index; model.apo_index = int.Parse(tmp); model.apo_item_name = view.apo_item_name; model.apo_item_no = view.apo_item_no; model.apo_no = string.IsNullOrEmpty(view.apo_no)?"UNKNOWN":view.apo_no; GlobalDataCtrl globalDataCtrl = new GlobalDataCtrl(); model.apo_item_no = string.IsNullOrEmpty(view.apo_item_no)?globalDataCtrl.GetNextNoByTblName("apo_item"):view.apo_item_no; DateTime dt = DateTime.Now; DateTime.TryParse(view.crt_time, out dt); model.crt_time = dt; model.crt_user_name = string.IsNullOrEmpty(view.crt_user_name) ? "Server" : view.crt_user_name; model.crt_user_no = string.IsNullOrEmpty(view.crt_user_no) ? "Server" : view.crt_user_no; DateTime.TryParse(view.upd_time, out dt); model.upd_time = dt; model.upd_user_name = string.IsNullOrEmpty(view.upd_user_name) ? "Server" : view.upd_user_name; model.upd_user_no = string.IsNullOrEmpty(view.upd_user_no) ? "Server" : view.upd_user_no; model.status_name = view.status_name; model.status_no = string.IsNullOrEmpty(view.status_no)?"310":view.status_no; return(model); }
/// <summary> /// 删除操作 /// </summary> /// <param name="oldValue">要删除的值</param> /// <returns>影响记录条数</returns> public int Delete(ModelView.ApoItemView oldValue) { Model.TableModel.Apo_item model = View2Model(oldValue); List <Model.TableModel.Apo_item> modelList = new List <Model.TableModel.Apo_item>(); modelList.Add(model); return(DbEngine.QueryInt <Model.TableModel.Apo_item>("Delete", modelList)); }
/// <summary> /// 数据插入 /// </summary> /// <param name="newValue">新插入的值</param> /// <returns>影响记录条数</returns> public int Insert(ModelView.ApoItemView newValue) { Model.TableModel.Apo_item model = View2Model(newValue); List <Model.TableModel.Apo_item> modelList = new List <Model.TableModel.Apo_item>(); modelList.Add(model); return(DbEngine.QueryInt <Model.TableModel.Apo_item>("Insert", modelList)); }
/// <summary> /// 删除操作 /// </summary> /// <param name="oldValues">要删除的多个值</param> /// <returns>影响记录条数</returns> public int Delete(List <ModelView.ApoItemView> oldValues) { List <Model.TableModel.Apo_item> modelList = new List <Model.TableModel.Apo_item>(); foreach (ModelView.ApoItemView item in oldValues) { Model.TableModel.Apo_item model = View2Model(item); modelList.Add(model); } return(DbEngine.QueryInt <Model.TableModel.Apo_item>("Delete", modelList)); }
/// <summary> /// 实体类转视图类 /// </summary> /// <param name="model">实体类</param> /// <returns>视图类</returns> private ModelView.ApoItemView Model2View(Model.TableModel.Apo_item model) { ModelView.ApoItemView view = new ModelView.ApoItemView(); view.id = model.id; view.apo_index = model.apo_index.ToString(); view.apo_item_name = model.apo_item_name; view.apo_item_no = model.apo_item_no; view.apo_no = model.apo_no; view.apo_user_name = model.apo_user_name; view.apo_user_no = model.apo_user_no; view.crt_time = model.crt_time.ToString("yyyy-MM-dd HH:mm:ss.fff"); view.crt_user_name = model.crt_user_name; view.crt_user_no = model.crt_user_no; view.next_item_no = model.next_item_no; view.status_name = model.status_name; view.status_no = model.status_no; view.upd_time = model.upd_time.HasValue?((DateTime)model.upd_time).ToString("yyyy-MM-dd HH:mm:ss.fff"):string.Empty; view.upd_user_name = model.upd_user_name; view.upd_user_no = model.upd_user_no; return(view); }