Esempio n. 1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(V_ctms_hr_company model)
        {
            if (model == null)
            {
                return(false);
            }
            using (ctms_hr_companyDAL dal = new ctms_hr_companyDAL()){
                ctms_hr_company entitys = ModelToEntity(model);

                return(dal.Edit(entitys));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add(V_ctms_hr_company model)
        {
            if (model == null)
            {
                return(string.Empty);
            }

            using (ctms_hr_companyDAL dal = new ctms_hr_companyDAL()){
                ctms_hr_company entity = ModelToEntity(model);
                entity.COMPANYID = string.IsNullOrEmpty(model.COMPANYID) ? Guid.NewGuid().ToString("N") : model.COMPANYID;

                return(dal.Add(entity));
            }
        }
Esempio n. 3
0
        public IHttpActionResult Post([FromBody] Request <V_ctms_hr_company> request)
        {
            V_ctms_hr_company model = request.Data as V_ctms_hr_company;

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

            return(Ok("ok"));
        }
Esempio n. 4
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private V_ctms_hr_company  EntityToModel(ctms_hr_company entity)
        {
            if (entity != null)
            {
                V_ctms_hr_company model = new V_ctms_hr_company()
                {
                    COMPANYID          = entity.COMPANYID,
                    COMPANYTYPE        = entity.COMPANYTYPE,
                    COMPANRYCODE       = entity.COMPANRYCODE,
                    ENAME              = entity.ENAME,
                    CNAME              = entity.CNAME,
                    COMPANYCATEGORY    = entity.COMPANYCATEGORY,
                    CITY               = entity.CITY,
                    COUNTYTYPE         = entity.COUNTYTYPE,
                    COMPANYLEVEL       = entity.COMPANYLEVEL,
                    FATHERCOMPANYID    = entity.FATHERCOMPANYID,
                    FATHERTYPE         = entity.FATHERTYPE,
                    ADDRESS            = entity.ADDRESS,
                    LEGALPERSON        = entity.LEGALPERSON,
                    LINKMAN            = entity.LINKMAN,
                    TELNUMBER          = entity.TELNUMBER,
                    LEGALPERSONID      = entity.LEGALPERSONID,
                    BUSSINESSLICENCENO = entity.BUSSINESSLICENCENO,
                    BUSSINESSAREA      = entity.BUSSINESSAREA,
                    ACCOUNTCODE        = entity.ACCOUNTCODE,
                    BANKID             = entity.BANKID,
                    EMAIL              = entity.EMAIL,
                    ZIPCODE            = entity.ZIPCODE,
                    FAXNUMBER          = entity.FAXNUMBER,
                    CHECKSTATE         = entity.CHECKSTATE,
                    EDITSTATE          = entity.EDITSTATE,
                    CREATEUSERID       = entity.CREATEUSERID,
                    CREATEDATE         = entity.CREATEDATE,
                    UPDATEUSERID       = entity.UPDATEUSERID,
                    UPDATEDATE         = entity.UPDATEDATE,
                    OWNERID            = entity.OWNERID,
                    OWNERPOSTID        = entity.OWNERPOSTID,
                    OWNERDEPARTMENTID  = entity.OWNERDEPARTMENTID,
                    OWNERCOMPANYID     = entity.OWNERCOMPANYID,
                };

                return(model);
            }

            return(null);
        }
Esempio n. 5
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private ctms_hr_company ModelToEntity(V_ctms_hr_company model)
        {
            if (model != null)
            {
                ctms_hr_company entity = new ctms_hr_company()
                {
                    COMPANYID          = model.COMPANYID,
                    COMPANYTYPE        = model.COMPANYTYPE,
                    COMPANRYCODE       = model.COMPANRYCODE,
                    ENAME              = model.ENAME,
                    CNAME              = model.CNAME,
                    COMPANYCATEGORY    = model.COMPANYCATEGORY,
                    CITY               = model.CITY,
                    COUNTYTYPE         = model.COUNTYTYPE,
                    COMPANYLEVEL       = model.COMPANYLEVEL,
                    FATHERCOMPANYID    = model.FATHERCOMPANYID,
                    FATHERTYPE         = model.FATHERTYPE,
                    ADDRESS            = model.ADDRESS,
                    LEGALPERSON        = model.LEGALPERSON,
                    LINKMAN            = model.LINKMAN,
                    TELNUMBER          = model.TELNUMBER,
                    LEGALPERSONID      = model.LEGALPERSONID,
                    BUSSINESSLICENCENO = model.BUSSINESSLICENCENO,
                    BUSSINESSAREA      = model.BUSSINESSAREA,
                    ACCOUNTCODE        = model.ACCOUNTCODE,
                    BANKID             = model.BANKID,
                    EMAIL              = model.EMAIL,
                    ZIPCODE            = model.ZIPCODE,
                    FAXNUMBER          = model.FAXNUMBER,
                    CHECKSTATE         = model.CHECKSTATE,
                    EDITSTATE          = model.EDITSTATE,
                    CREATEUSERID       = model.CREATEUSERID,
                    CREATEDATE         = model.CREATEDATE,
                    UPDATEUSERID       = model.UPDATEUSERID,
                    UPDATEDATE         = model.UPDATEDATE,
                    OWNERID            = model.OWNERID,
                    OWNERPOSTID        = model.OWNERPOSTID,
                    OWNERDEPARTMENTID  = model.OWNERDEPARTMENTID,
                    OWNERCOMPANYID     = model.OWNERCOMPANYID,
                };

                return(entity);
            }
            return(null);
        }
Esempio n. 6
0
        public IHttpActionResult Get(string ID)
        {
            V_ctms_hr_company model = bll.Get(p => p.COMPANYID == ID);

            return(Ok(model));
        }