/// <summary> /// 操作会员积分 /// </summary> /// <param name="requestData"></param> /// <returns></returns> public string UpdateMemberIntegral(dynamic requestData) { string operation = requestData.Operation; int integral = requestData.Integral; int memberId = requestData.MemberId; string integralSource = requestData.IntegralSource; string remark = requestData.Remark; try { string sql = string.Empty; int count = 0; if (operation == "plus") { sql = string.Format("update RegistMember Set LeaveIntegral = LeaveIntegral + {0}, TotalIntegral = TotalIntegral + {0} where MemberId = {1}", integral, memberId); count = dataContext.ExecuteNonQuery(CommandType.Text, sql); MemberIntegralDetail model = new MemberIntegralDetail(); model.CreatDate = DateTime.Now; model.InvalidDate = DateTime.Now; model.IntegralNum = integral; model.IntegralSource = integralSource; model.IntegralType = 1; model.Remark = remark; model.MemberId = memberId; model.ScanHotelName = ""; model.ScanMemberCode = ""; db.MemberIntegralDetail.Add(model); db.SaveChangesAsync(); } else if (operation == "minus") { sql = string.Format("update RegistMember Set LeaveIntegral = LeaveIntegral - {0} where MemberId = {1}", integral, memberId); count = dataContext.ExecuteNonQuery(CommandType.Text, sql); MemberIntegralDetail model = new MemberIntegralDetail(); model.CreatDate = DateTime.Now; model.InvalidDate = DateTime.Now; model.IntegralNum = integral; model.IntegralSource = integralSource; model.IntegralType = 2; model.Remark = remark; model.MemberId = memberId; model.ScanHotelName = ""; model.ScanMemberCode = ""; db.MemberIntegralDetail.Add(model); db.SaveChangesAsync(); } return("Excute Success"); } catch (Exception ex) { return(ex.Message); } }