/// <summary>
 /// 设置model,如果不为空就设置,如果为空则和之前一样
 /// </summary>
 /// <param name="target"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 public JMSJieDianModel SetJMSJieDianModel(JMSJieDianModel model, JMSJieDianModelReq 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.JmsUploadFileState))
     {
         model.JmsUploadFileState = data.JmsUploadFileState;
     }
     return(model);
 }
        public JMSJieDianModel UpdateSingle(int id, JMSJieDianModelReq data)
        {
            JMSJieDianModel model = db.JMSJieDianModel.Find(id);

            SetJMSJieDianModel(model, data);
            db.SaveChanges();
            return(model);
        }
Exemple #3
0
        public static JMSJieDianObj TranferModelToObj(JMSJieDianModel model, int jmsId, string jmsName, int projectId)
        {
            JMSJieDianObj obj = new JMSJieDianObj();

            obj.JdModelName    = model.JdName;
            obj.JdClassModelID = model.JdClassID;
            //obj.JdClassModelName=model.
            obj.JdModelID          = model.id;
            obj.JdPaiXu            = model.JdPaiXu;
            obj.JmsID              = jmsId;
            obj.JmsName            = jmsName;
            obj.ProjectID          = projectId;
            obj.JmsUploadFileState = model.JmsUploadFileState;
            using (Context db = new Context())
            {
                obj.JdClassModelName = db.JMSJieDianClassModel.Find(model.JdClassID).JdClassName;
            }

            return(obj);
        }