Ejemplo n.º 1
0
        public KeHuJieDianModel UpdateSingle(int id, KeHuJieDianModelReq data)
        {
            KeHuJieDianModel model = db.KeHuJieDianModel.Find(id);

            SetKeHuJieDianModel(model, data);
            db.SaveChanges();
            return(model);
        }
Ejemplo n.º 2
0
        //[NotMapped]
        //public List<KeHuJieDianMXObj> JmsJieDianMxs { get; set; }

        public static KeHuJieDianObj TranferModelToObj(KeHuJieDianModel model, int projectId)
        {
            KeHuJieDianObj obj = new KeHuJieDianObj();

            obj.JdModelName    = model.JdName;
            obj.JdClassModelID = model.JdClassID;
            //obj.JdClassModelName=model.
            obj.JdModelID = model.id;
            obj.JdPaiXu   = model.JdPaiXu;
            obj.ProjectID = projectId;
            using (Context db = new Context())
            {
                obj.JdClassModelName = db.KeHuJieDianClassModel.Find(model.JdClassID).JdClassName;
            }

            return(obj);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public KeHuJieDianModel SetKeHuJieDianModel(KeHuJieDianModel model, KeHuJieDianModelReq data)
        {
            if (data.JdClassID != null)
            {
                model.JdClassID = data.JdClassID.Value;
            }
            if (!string.IsNullOrEmpty(data.JdName))
            {
                model.JdName = data.JdName;
            }
            if (data.JdPaiXu != null)
            {
                model.JdPaiXu = data.JdPaiXu.Value;
            }
            if (data.JdStateID != null)
            {
                model.JdStateID = data.JdStateID.Value;
            }
            if (!string.IsNullOrEmpty(data.optName))
            {
                model.optName = data.optName;
            }
            if (data.optDateTime != null && data.optDateTime != DateTime.MinValue && data.optDateTime != SqlDateTime.MinValue.Value)
            {
                model.optDateTime = data.optDateTime.Value;
            }
            if (!string.IsNullOrEmpty(data.KeHuUploadFileState))
            {
                model.KeHuUploadFileState = data.KeHuUploadFileState;
            }
            if (!string.IsNullOrEmpty(data.JdSpecialState))
            {
                model.JdSpecialState = data.JdSpecialState;
            }

            return(model);
        }