Beispiel #1
0
        public JMSShouKuanRule UpdateSingle(int id, JMSShouKuanRuleReq data)
        {
            JMSShouKuanRule model = db.JMSShouKuanRule.Find(id);

            SetJMSShouKuanRule(model, data);
            db.SaveChanges();
            return(model);
        }
Beispiel #2
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public JMSShouKuanRule SetJMSShouKuanRule(JMSShouKuanRule model, JMSShouKuanRuleReq data)
        {
            if (data.JmsId != null)
            {
                model.JmsId = data.JmsId.Value;
            }
            if (!string.IsNullOrEmpty(data.JmsName))
            {
                model.JmsName = data.JmsName;
            }
            if (!string.IsNullOrEmpty(data.JmsClassName))
            {
                model.JmsClassName = data.JmsClassName;
            }
            if (!string.IsNullOrEmpty(data.ShouKuanType))
            {
                model.ShouKuanType = data.ShouKuanType;
            }
            if (data.ShouKuanMoney != null)
            {
                model.ShouKuanMoney = data.ShouKuanMoney.Value;
            }
            if (data.StartTime != null && data.StartTime != DateTime.MinValue && data.StartTime != SqlDateTime.MinValue.Value)
            {
                model.StartTime = data.StartTime.Value;
            }
            if (data.ShouKuanTime != null && data.ShouKuanTime != DateTime.MinValue && data.ShouKuanTime != SqlDateTime.MinValue.Value)
            {
                model.ShouKuanTime = data.ShouKuanTime.Value;
            }
            if (!string.IsNullOrEmpty(data.State))
            {
                model.State = data.State;
            }
            if (data.OptId != null)
            {
                model.OptId = data.OptId.Value;
            }
            if (!string.IsNullOrEmpty(data.OptName))
            {
                model.OptName = data.OptName;
            }
            if (data.Createtime != null && data.Createtime != DateTime.MinValue && data.Createtime != SqlDateTime.MinValue.Value)
            {
                model.Createtime = data.Createtime.Value;
            }

            return(model);
        }
        void SetJMSShouKuanRule(JiaMengShangInfo model, int optId, string optName, string shoukuantype)
        {
            JMSShouKuanRule souKuanRule = new JMSShouKuanRule();

            souKuanRule.JmsId        = model.id;
            souKuanRule.Createtime   = DateTime.Now;
            souKuanRule.JmsName      = model.JmsName;
            souKuanRule.JmsClassName = model.JmsClassName;
            souKuanRule.OptId        = optId;
            souKuanRule.OptName      = optName;
            souKuanRule.State        = "未收";

            souKuanRule.ShouKuanType = shoukuantype;//"意向金";
            souKuanRule.projectid    = model.ProjectID;
            db.JMSShouKuanRule.Add(souKuanRule);
        }