/// <summary> /// 更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Edit(V_tm_pm_task model) { if (model == null) return false; tm_pm_task entitys = ModelToEntity(model); return dal.Edit(entitys); }
/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(V_tm_pm_task model) { if (model == null) return string.Empty; tm_pm_task entity = ModelToEntity(model); entity.TASKID = string.IsNullOrEmpty(model.TASKID) ? Guid.NewGuid().ToString("N") : model.TASKID; return dal.Add(entity); }
/// <summary> /// Entity转Model /// </summary> /// <param name="entity"></param> /// <returns></returns> private V_tm_pm_task EntityToModel(tm_pm_task entity) { if (entity != null) { V_tm_pm_task model = new V_tm_pm_task () { TASKID = entity.TASKID, PROJECTID = entity.PROJECTID, PRETASKID = entity.PRETASKID, FATHERTASKID = entity.FATHERTASKID, ORDERNUMBER = entity.ORDERNUMBER, TASKNAME = entity.TASKNAME, COSTTIME = entity.COSTTIME, STARTDATE = entity.STARTDATE, ENDDATE = entity.ENDDATE, USERNAME = entity.USERNAME, PROGRESS = entity.PROGRESS, TASKREMARK = entity.TASKREMARK, OWENRID = entity.OWENRID, OWNERPOSTID = entity.OWNERPOSTID, OWNERDEPARTMENTID = entity.OWNERDEPARTMENTID, OWNERCOMPANYID = entity.OWNERCOMPANYID, CREATETIME = entity.CREATETIME, CREATEUSER = entity.CREATEUSER, EDITTIME = entity.EDITTIME, EDITUSER = entity.EDITUSER, PMANAGER = entity.PMANAGER, ISCOMFIRM = entity.ISCOMFIRM, REALFINISHDATE = entity.REALFINISHDATE, RESULTSCORE = entity.RESULTSCORE, SUGGESTIONS = entity.SUGGESTIONS, }; return model; } return null; }
/// <summary> /// Model转Entity /// </summary> /// <param name="model"></param> /// <returns></returns> private tm_pm_task ModelToEntity(V_tm_pm_task model) { if (model != null) { tm_pm_task entity = new tm_pm_task() { TASKID = model.TASKID, PROJECTID = model.PROJECTID, PRETASKID = model.PRETASKID, FATHERTASKID = model.FATHERTASKID, ORDERNUMBER = model.ORDERNUMBER, TASKNAME = model.TASKNAME, COSTTIME = model.COSTTIME, STARTDATE = model.STARTDATE, ENDDATE = model.ENDDATE, USERNAME = model.USERNAME, PROGRESS = model.PROGRESS, TASKREMARK = model.TASKREMARK, OWENRID = model.OWENRID, OWNERPOSTID = model.OWNERPOSTID, OWNERDEPARTMENTID = model.OWNERDEPARTMENTID, OWNERCOMPANYID = model.OWNERCOMPANYID, CREATETIME = model.CREATETIME, CREATEUSER = model.CREATEUSER, EDITTIME = model.EDITTIME, EDITUSER = model.EDITUSER, PMANAGER = model.PMANAGER, ISCOMFIRM = model.ISCOMFIRM, REALFINISHDATE = model.REALFINISHDATE, RESULTSCORE = model.RESULTSCORE, SUGGESTIONS = model.SUGGESTIONS, }; return entity; } return null; }