/// <summary> /// 修改等级调用方法 /// </summary> /// <param name="i"></param> public void ForMemberGrade(int i) { MemberGrade member = ShowMemberGrade().Find(x => float.Parse(x.Totalprice.ToString()) / 1000 == i); Customer admin = context.Customer.ToList().Find(a => a.UserId == member.UserId); switch (i) { case 1: admin.Userlevel = "一般挽留客户"; break; case 2: admin.Userlevel = "一般保持客户"; break; case 3: admin.Userlevel = "一般发展客户"; break; case 4: admin.Userlevel = "一般价值客户"; break; case 5: admin.Userlevel = "重要挽留客户"; break; case 6: admin.Userlevel = "重要保持客户"; break; case 7: admin.Userlevel = "重要保持客户"; break; case 8: admin.Userlevel = "重要保持客户"; break; case 9: admin.Userlevel = "重要发展客户"; break; case 10: admin.Userlevel = "重要发展客户"; break; default: admin.Userlevel = "重要价值客户"; break; } context.Entry(member).State = EntityState.Modified; }
public int UptAdmin() { AdminInfo admin = new AdminInfo { AdminId = 7, AdminFlag = 1, AdminName = "11", AdminPwd = "11" }; context.Entry(admin).State = EntityState.Modified; return(context.SaveChanges()); }
/// <summary> /// 未用修改等级调用方法 /// </summary> /// <param name="i"></param> public void ForMemberGrade(int i) { List <Customer> customers = context.Customer.ToList(); List <OrderInfo> orders = context.OrderInfo.ToList(); List <MemberGrade> members = (from c in customers join o in orders on c.UserId equals o.UserId select new MemberGrade { UserId = c.UserId, Id = c.UserId, UserName = c.UserName, Totalprice = o.Totalprice, Userlevel = c.Userlevel, Useraddress = c.Useraddress }).ToList(); MemberGrade member = members.Find(x => float.Parse(x.Totalprice.ToString()) / 1000 == i); Customer admin = context.Customer.ToList().Find(a => a.UserId == member.UserId); switch (i) { case 1: admin.Userlevel = "一般挽留客户"; break; case 2: admin.Userlevel = "一般保持客户"; break; case 3: admin.Userlevel = "一般发展客户"; break; case 4: admin.Userlevel = "一般价值客户"; break; case 5: admin.Userlevel = "重要挽留客户"; break; case 6: admin.Userlevel = "重要保持客户"; break; case 7: admin.Userlevel = "重要保持客户"; break; case 8: admin.Userlevel = "重要保持客户"; break; case 9: admin.Userlevel = "重要发展客户"; break; case 10: admin.Userlevel = "重要发展客户"; break; default: admin.Userlevel = "重要价值客户"; break; } context.Entry(member).State = EntityState.Modified; }