public JMSJieDianMXObj UpdateSingle(int id, JMSJieDianMXObjReq data)
        {
            JMSJieDianMXObj model = db.JMSJieDianMXObj.Find(id);

            SetJMSJieDianMXObj(model, data);
            db.SaveChanges();
            return(model);
        }
Beispiel #2
0
        public static JMSJieDianMXObj TranferModelToObj(JMSJieDianMXModel model, int jmsId, string jmsName,
                                                        int projectId, string className = "", string modelname = "")
        {
            JMSJieDianMXObj obj = new JMSJieDianMXObj();

            obj.JdClassModelID = model.JdClassID;
            if (className == "" || modelname == "")
            {
                using (Context db = new Context())
                {
                    obj.JdClassModelName = db.JMSJieDianClassModel.Find(model.JdClassID).JdClassName;
                    obj.JdModelName      = db.JMSJieDianModel.Find(model.JdID).JdName;
                }
            }
            else
            {
                obj.JdModelName      = modelname;
                obj.JdClassModelName = className;
            }
            obj.JdModelID              = model.JdID;
            obj.JdMXModelName          = model.JdMXName;
            obj.JmsID                  = jmsId;
            obj.JdMXFuJianFileClass    = model.JdMXFuJianFileClass;
            obj.JdMXFuJianJiaMengClass = model.JdMXFuJianJiaMengClass;
            obj.JdMXModelID            = model.id;
            obj.JdMXModelName          = model.JdMXName;
            obj.JdMXStateID            = model.JdMXStateID;


            obj.xxJdMXFuJianUrl = model.JdMXFuJianUrl;

            //可空
            //obj.JmsUpFileUrl = model.JdMXFuJianUrl;
            obj.ProjectID = projectId;
            return(obj);
        }
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public JMSJieDianMXObj SetJMSJieDianMXObj(JMSJieDianMXObj model, JMSJieDianMXObjReq data)
        {
            if (data.JmsID != null)
            {
                model.JmsID = data.JmsID.Value;
            }
            if (data.JdClassModelID != null)
            {
                model.JdClassModelID = data.JdClassModelID.Value;
            }
            if (!string.IsNullOrEmpty(data.JdClassModelName))
            {
                model.JdClassModelName = data.JdClassModelName;
            }
            if (data.JdModelID != null)
            {
                model.JdModelID = data.JdModelID.Value;
            }
            if (!string.IsNullOrEmpty(data.JdModelName))
            {
                model.JdModelName = data.JdModelName;
            }
            if (data.JdMXModelID != null)
            {
                model.JdMXModelID = data.JdMXModelID.Value;
            }
            if (!string.IsNullOrEmpty(data.JdMXModelName))
            {
                model.JdMXModelName = data.JdMXModelName;
            }
            if (!string.IsNullOrEmpty(data.JdMXFuJianFileClass))
            {
                model.JdMXFuJianFileClass = data.JdMXFuJianFileClass;
            }
            if (!string.IsNullOrEmpty(data.JdMXFuJianJiaMengClass))
            {
                model.JdMXFuJianJiaMengClass = data.JdMXFuJianJiaMengClass;
            }
            if (!string.IsNullOrEmpty(data.xxJdMXFuJianUrl))
            {
                model.xxJdMXFuJianUrl = data.xxJdMXFuJianUrl;
            }
            if (!string.IsNullOrEmpty(data.JmsUpFileUrl))
            {
                model.JmsUpFileUrl = data.JmsUpFileUrl;
            }
            if (data.JdMXStateID != null)
            {
                model.JdMXStateID = data.JdMXStateID.Value;
            }
            if (data.JmsJdMXConfirmID != null)
            {
                model.JmsJdMXConfirmID = data.JmsJdMXConfirmID.Value;
            }
            if (data.xxJdMXConfirmID != null)
            {
                model.xxJdMXConfirmID = data.xxJdMXConfirmID.Value;
            }
            if (data.projectid != null)
            {
                model.ProjectID = data.projectid.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;
            }


            return(model);
        }