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

            SetDingDan(model, data);
            db.SaveChanges();
            return(model);
        }
예제 #2
0
        //同步喜喜会所客户到扫e嫂客户表(设置此客户为喜喜VIP并同步会所信息)
        public Seskehu SyncXixiKhToSes(KeHu xxKh)
        {
            var ysDb = new YueSaoErpContext();
            var ysKh = ysDb.Seskehu.FirstOrDefault(n => n.KhPhoneNumber == xxKh.KhPhone || n.KeFuKhPhoneNumber == xxKh.KhPhone);

            if (ysKh == null)
            {
                var huisuoId = ysDb.yuezihuiSuoInfo.Where(n => n.xixiHuisuoId == xxKh.ProjectID).Select(n => n.id).FirstOrDefault();

                if (xxKh != null)
                {
                    ysKh = new Seskehu
                    {
                        FuWuYueSaoID            = 0,
                        FuWuYueSaoName          = string.Empty,
                        huisuoID                = huisuoId,
                        KeFuKhPhoneNumber       = xxKh.KhPhone,
                        KhAddress               = xxKh.KhAddress,
                        KhAge                   = 30,
                        KhBabyMonth             = 0,
                        KhCallClassName         = string.Empty,
                        KhCallDateTime          = null,
                        KhCity                  = string.Empty,
                        KhClassName             = "会所客户",
                        KhCreateTime            = DateTime.Now,
                        KhCreateTimeEnd         = DateTime.Now,
                        KhCreateTimeStart       = DateTime.Now,
                        KhInfos                 = xxKh.KhRemarks,
                        KhLaiYuan               = xxKh.KhSales,
                        KhName                  = xxKh.KhName,
                        KhPhoneNumber           = xxKh.KhPhone,
                        KhPsd                   = BinaryUtil.Md5(xxKh.KhPhone).Substring(6, 20),
                        KhPsdNew                = string.Empty,
                        KhState                 = string.Empty,
                        KhWeiXin                = string.Empty,
                        KhWeiXinID              = string.Empty,
                        KhYeWu                  = string.Empty,
                        KhYuChanHospital        = xxKh.KhHospital,
                        KhYuChanHospitalAddress = string.Empty,
                        KhYuChanQi              = xxKh.KhYuChanQi,
                        KhYuChanQiEnd           = DateTime.Now,
                        KhYuChanQiStart         = DateTime.Now,
                        OptName                 = xxKh.optName,
                        ProjectId               = 1, //默认为上海
                        SalesName               = xxKh.KhSales,
                        xixiVip                 = 1
                    }
                }
                ;

                ysDb.Seskehu.Add(ysKh);
            }
            else
            {
                ysKh.xixiVip  = 1;
                ysKh.huisuoID =
                    ysDb.yuezihuiSuoInfo.Where(n => n.xixiHuisuoId == xxKh.ProjectID).Select(n => n.id).FirstOrDefault();
                if (string.IsNullOrWhiteSpace(ysKh.KhPhoneNumber))
                {
                    ysKh.KhPhoneNumber = ysKh.KeFuKhPhoneNumber;
                    ysKh.KhPsd         = BinaryUtil.Md5(ysKh.KeFuKhPhoneNumber).Substring(6, 20);
                }
                ysKh.KhName = xxKh.KhName;
            }
            ysDb.SaveChanges();
            return(ysKh);
        }