コード例 #1
0
        public JMSJieDianMXModel UpdateSingle(int id, JMSJieDianMXModelReq data)
        {
            JMSJieDianMXModel model = db.JMSJieDianMXModel.Find(id);

            SetJMSJieDianMXModel(model, data);
            db.SaveChanges();
            return(model);
        }
コード例 #2
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public JMSJieDianMXModel SetJMSJieDianMXModel(JMSJieDianMXModel model, JMSJieDianMXModelReq data)
        {
            if (data.JdClassID != null)
            {
                model.JdClassID = data.JdClassID.Value;
            }
            if (data.JdID != null)
            {
                model.JdID = data.JdID.Value;
            }
            if (!string.IsNullOrEmpty(data.JdMXName))
            {
                model.JdMXName = data.JdMXName;
            }
            if (!string.IsNullOrEmpty(data.JdMXFuJianUrl))
            {
                model.JdMXFuJianUrl = data.JdMXFuJianUrl;
            }
            if (!string.IsNullOrEmpty(data.JdMXFuJianFileClass))
            {
                model.JdMXFuJianFileClass = data.JdMXFuJianFileClass;
            }
            if (!string.IsNullOrEmpty(data.JdMXFuJianJiaMengClass))
            {
                model.JdMXFuJianJiaMengClass = data.JdMXFuJianJiaMengClass;
            }
            if (data.JdMXStateID != null)
            {
                model.JdMXStateID = data.JdMXStateID.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);
        }
コード例 #3
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);
        }