Exemple #1
0
        public DingDan UpdateSingle(int id, DingDan data)
        {
            DingDan model = db.DingDan.Find(id);

            SetDingDan(model, data);
            db.SaveChanges();
            return(model);
        }
Exemple #2
0
        /// <summary>
        /// 设置model,如果不为空就设置,如果为空则和之前一样
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <returns></returns>
        public DingDan SetDingDan(DingDan model, DingDan data)
        {
            if (!string.IsNullOrEmpty(data.DDName))
            {
                model.DDName = data.DDName;
            }
            if (!string.IsNullOrEmpty(data.DDNumber))
            {
                model.DDNumber = data.DDNumber;
            }
            if (data.ysID != null)
            {
                model.ysID = data.ysID;
            }
            if (!string.IsNullOrEmpty(data.DDStateID))
            {
                model.DDStateID = data.DDStateID;
            }
            if (!string.IsNullOrEmpty(data.DDInfos))
            {
                model.DDInfos = data.DDInfos;
            }
            if (data.DDCompanyID != null)
            {
                model.DDCompanyID = data.DDCompanyID;
            }
            if (!string.IsNullOrEmpty(data.DDLaiYuanID))
            {
                model.DDLaiYuanID = data.DDLaiYuanID;
            }
            if (data.DDFuWuXiangMuID != null)
            {
                model.DDFuWuXiangMuID = data.DDFuWuXiangMuID;
            }
            if (!string.IsNullOrEmpty(data.DDFuWuAddress))
            {
                model.DDFuWuAddress = data.DDFuWuAddress;
            }
            if (data.DDFuWuYuYueBeginTime != DateTime.MinValue && data.DDFuWuYuYueBeginTime != SqlDateTime.MinValue.Value)
            {
                model.DDFuWuYuYueBeginTime = data.DDFuWuYuYueBeginTime;
            }
            if (data.DDFuWuYuYueEndTime != DateTime.MinValue && data.DDFuWuYuYueEndTime != SqlDateTime.MinValue.Value)
            {
                model.DDFuWuYuYueEndTime = data.DDFuWuYuYueEndTime;
            }
            if (data.DDFuWuBeginTime != DateTime.MinValue && data.DDFuWuBeginTime != SqlDateTime.MinValue.Value)
            {
                model.DDFuWuBeginTime = data.DDFuWuBeginTime;
            }
            if (data.DDFuWuEndTime != DateTime.MinValue && data.DDFuWuEndTime != SqlDateTime.MinValue.Value)
            {
                model.DDFuWuEndTime = data.DDFuWuEndTime;
            }
            if (!string.IsNullOrEmpty(data.DDKeFuComments))
            {
                model.DDKeFuComments = data.DDKeFuComments;
            }
            if (!string.IsNullOrEmpty(data.OptName))
            {
                model.OptName = data.OptName;
            }
            if (data.DDCreateTime != DateTime.MinValue && data.DDCreateTime != SqlDateTime.MinValue.Value)
            {
                model.DDCreateTime = data.DDCreateTime;
            }
            if (!string.IsNullOrEmpty(data.DDYeWuName))
            {
                model.DDYeWuName = data.DDYeWuName;
            }
            if (!string.IsNullOrEmpty(data.CustomName))
            {
                model.CustomName = data.CustomName;
            }
            if (!string.IsNullOrEmpty(data.ysName))
            {
                model.ysName = data.ysName;
            }
            if (!string.IsNullOrEmpty(data.DDFuWuXiangMuName))
            {
                model.DDFuWuXiangMuName = data.DDFuWuXiangMuName;
            }
            if (data.ProjectId != null)
            {
                model.ProjectId = data.ProjectId;
            }
            if (!string.IsNullOrEmpty(data.DDLianXiRen))
            {
                model.DDLianXiRen = data.DDLianXiRen;
            }
            if (!string.IsNullOrEmpty(data.DDLianXiRenPhone))
            {
                model.DDLianXiRenPhone = data.DDLianXiRenPhone;
            }
            if (data.parentDDID != null)
            {
                model.parentDDID = data.parentDDID;
            }
            if (data.YongjinMoney != null)
            {
                model.YongjinMoney = data.YongjinMoney;
            }
            if (!string.IsNullOrEmpty(data.YunxingCheckedName))
            {
                model.YunxingCheckedName = data.YunxingCheckedName;
            }
            if (data.YunxingCheckedDateTime != DateTime.MinValue && data.YunxingCheckedDateTime != SqlDateTime.MinValue.Value)
            {
                model.YunxingCheckedDateTime = data.YunxingCheckedDateTime;
            }
            if (!string.IsNullOrEmpty(data.ZongCaiCheckedName))
            {
                model.ZongCaiCheckedName = data.ZongCaiCheckedName;
            }
            if (data.ZongCaiCheckedDateTime != DateTime.MinValue && data.ZongCaiCheckedDateTime != SqlDateTime.MinValue.Value)
            {
                model.ZongCaiCheckedDateTime = data.ZongCaiCheckedDateTime;
            }
            if (!string.IsNullOrEmpty(data.CaiWuZhiFuName))
            {
                model.CaiWuZhiFuName = data.CaiWuZhiFuName;
            }
            if (data.CaiWuZhiFuDateTime != DateTime.MinValue && data.CaiWuZhiFuDateTime != SqlDateTime.MinValue.Value)
            {
                model.CaiWuZhiFuDateTime = data.CaiWuZhiFuDateTime;
            }
            if (!string.IsNullOrEmpty(data.CaiWuZhifFuPingZhen))
            {
                model.CaiWuZhifFuPingZhen = data.CaiWuZhifFuPingZhen;
            }
            if (!string.IsNullOrEmpty(data.YongjinState))
            {
                model.YongjinState = data.YongjinState;
            }
            if (data.DingdanStateDateTime != DateTime.MinValue && data.DingdanStateDateTime != SqlDateTime.MinValue.Value)
            {
                model.DingdanStateDateTime = data.DingdanStateDateTime;
            }
            if (!string.IsNullOrEmpty(data.DDBaoXianHao))
            {
                model.DDBaoXianHao = data.DDBaoXianHao;
            }
            if (!string.IsNullOrEmpty(data.DDFuWuDian))
            {
                model.DDFuWuDian = data.DDFuWuDian;
            }

            return(model);
        }