예제 #1
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private V_ctms_hr_userpost  EntityToModel(ctms_hr_userpost entity)
        {
            if (entity != null)
            {
                V_ctms_hr_userpost model = new V_ctms_hr_userpost()
                {
                    EMPLOYEEPOSTID = entity.EMPLOYEEPOSTID,
                    ISAGENCY       = entity.ISAGENCY,
                    USERID         = entity.USERID,
                    USERNAME       = entity.USERNAME,
                    COMPANYID      = entity.COMPANYID,
                    DEPARTMENTID   = entity.DEPARTMENTID,
                    POSTID         = entity.POSTID,
                    CNAME          = entity.CNAME,
                    DEPARTMENTNAME = entity.DEPARTMENTNAME,
                    POSTNAME       = entity.POSTNAME,
                    POSTLEVEL      = entity.POSTLEVEL,
                    CHECKSTATE     = entity.CHECKSTATE,
                    EDITSTATE      = entity.EDITSTATE,
                    CREATEUSERID   = entity.CREATEUSERID,
                    CREATEDATE     = entity.CREATEDATE,
                    UPDATEUSERID   = entity.UPDATEUSERID,
                    UPDATEDATE     = entity.UPDATEDATE,
                };

                return(model);
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private ctms_hr_userpost ModelToEntity(V_ctms_hr_userpost model)
        {
            if (model != null)
            {
                ctms_hr_userpost entity = new ctms_hr_userpost()
                {
                    EMPLOYEEPOSTID = model.EMPLOYEEPOSTID,
                    ISAGENCY       = model.ISAGENCY,
                    USERID         = model.USERID,
                    USERNAME       = model.USERNAME,
                    COMPANYID      = model.COMPANYID,
                    DEPARTMENTID   = model.DEPARTMENTID,
                    POSTID         = model.POSTID,
                    CNAME          = model.CNAME,
                    DEPARTMENTNAME = model.DEPARTMENTNAME,
                    POSTNAME       = model.POSTNAME,
                    POSTLEVEL      = model.POSTLEVEL,
                    CHECKSTATE     = model.CHECKSTATE,
                    EDITSTATE      = model.EDITSTATE,
                    CREATEUSERID   = model.CREATEUSERID,
                    CREATEDATE     = model.CREATEDATE,
                    UPDATEUSERID   = model.UPDATEUSERID,
                    UPDATEDATE     = model.UPDATEDATE,
                };

                return(entity);
            }
            return(null);
        }
예제 #3
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(V_ctms_hr_userpost model)
        {
            if (model == null)
            {
                return(false);
            }
            using (ctms_hr_userpostDAL dal = new ctms_hr_userpostDAL()){
                ctms_hr_userpost entitys = ModelToEntity(model);

                return(dal.Edit(entitys));
            }
        }
예제 #4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add(V_ctms_hr_userpost model)
        {
            if (model == null)
            {
                return(string.Empty);
            }

            using (ctms_hr_userpostDAL dal = new ctms_hr_userpostDAL()){
                ctms_hr_userpost entity = ModelToEntity(model);
                entity.EMPLOYEEPOSTID = string.IsNullOrEmpty(model.EMPLOYEEPOSTID) ? Guid.NewGuid().ToString("N") : model.EMPLOYEEPOSTID;

                return(dal.Add(entity));
            }
        }
예제 #5
0
        public IHttpActionResult Post([FromBody] Request <V_ctms_hr_userpost> request)
        {
            V_ctms_hr_userpost model = request.Data as V_ctms_hr_userpost;

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

            return(Ok("ok"));
        }
예제 #6
0
        public IHttpActionResult Get(string ID)
        {
            V_ctms_hr_userpost model = bll.Get(p => p.EMPLOYEEPOSTID == ID);

            return(Ok(model));
        }