Пример #1
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private V_ctms_pm_dotask  EntityToModel(ctms_pm_dotask entity)
        {
            if (entity != null)
            {
                V_ctms_pm_dotask model = new V_ctms_pm_dotask()
                {
                    TASKID            = entity.TASKID,
                    TITLE             = entity.TITLE,
                    MODELCODE         = entity.MODELCODE,
                    MODELID           = entity.MODELID,
                    ARRIVEDATE        = entity.ARRIVEDATE,
                    EXPIREDTIME       = entity.EXPIREDTIME,
                    ISCLOSED          = entity.ISCLOSED,
                    CLOSEDTIME        = entity.CLOSEDTIME,
                    OWENRID           = entity.OWENRID,
                    OWNERDEPARTMENTID = entity.OWNERDEPARTMENTID,
                    OWNERCOMPANYID    = entity.OWNERCOMPANYID,
                    CREATETIME        = entity.CREATETIME,
                    CREATEUSER        = entity.CREATEUSER,
                    EDITTIME          = entity.EDITTIME,
                    EDITUSER          = entity.EDITUSER,
                    OWNERPOSTID       = entity.OWNERPOSTID,
                };

                return(model);
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private ctms_pm_dotask ModelToEntity(V_ctms_pm_dotask model)
        {
            if (model != null)
            {
                ctms_pm_dotask entity = new ctms_pm_dotask()
                {
                    TASKID            = model.TASKID,
                    TITLE             = model.TITLE,
                    MODELCODE         = model.MODELCODE,
                    MODELID           = model.MODELID,
                    ARRIVEDATE        = model.ARRIVEDATE,
                    EXPIREDTIME       = model.EXPIREDTIME,
                    ISCLOSED          = model.ISCLOSED,
                    CLOSEDTIME        = model.CLOSEDTIME,
                    OWENRID           = model.OWENRID,
                    OWNERDEPARTMENTID = model.OWNERDEPARTMENTID,
                    OWNERCOMPANYID    = model.OWNERCOMPANYID,
                    CREATETIME        = model.CREATETIME,
                    CREATEUSER        = model.CREATEUSER,
                    EDITTIME          = model.EDITTIME,
                    EDITUSER          = model.EDITUSER,
                    OWNERPOSTID       = model.OWNERPOSTID,
                };

                return(entity);
            }
            return(null);
        }
Пример #3
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(V_ctms_pm_dotask model)
        {
            if (model == null)
            {
                return(false);
            }
            using (ctms_pm_dotaskDAL dal = new ctms_pm_dotaskDAL()){
                ctms_pm_dotask entitys = ModelToEntity(model);

                return(dal.Edit(entitys));
            }
        }
Пример #4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add(V_ctms_pm_dotask model)
        {
            if (model == null)
            {
                return(string.Empty);
            }

            using (ctms_pm_dotaskDAL dal = new ctms_pm_dotaskDAL()){
                ctms_pm_dotask entity = ModelToEntity(model);
                entity.TASKID = string.IsNullOrEmpty(model.TASKID) ? Guid.NewGuid().ToString("N") : model.TASKID;

                return(dal.Add(entity));
            }
        }
Пример #5
0
        public IHttpActionResult Post([FromBody] Request <V_ctms_pm_dotask> request)
        {
            V_ctms_pm_dotask model = request.Data as V_ctms_pm_dotask;

            if (string.IsNullOrEmpty(model.TASKID))
            {
                bll.Add(model);
            }
            else
            {
                bll.Edit(model);
            }

            return(Ok("ok"));
        }
Пример #6
0
        public IHttpActionResult Get(string ID)
        {
            V_ctms_pm_dotask model = bll.Get(p => p.TASKID == ID);

            return(Ok(model));
        }