public bool UpdatePraized_Res(PraizeType praizeType, string resCode, string userId) { var op = Db.Updateable <EPraize_Res>().SetColumns(a => new EPraize_Res() { PraizeType = praizeType }); op = op.Where(a => a.ResCode == resCode && a.userId == userId); return(op.ExecuteCommandHasChange()); }
public bool UpdateResPraizedNum(string resCode, PraizeType praizeType, OperationDirection direction) { var op = Db.Updateable <EResourceInfo>().SetColumns(a => new EResourceInfo() { goodNum = a.goodNum - 1 }); if (praizeType == PraizeType.good && direction == OperationDirection.plus) { op = Db.Updateable <EResourceInfo>().SetColumns(a => new EResourceInfo() { goodNum = a.goodNum + 1 }); } else if (praizeType == PraizeType.bad && direction == OperationDirection.plus) { op = Db.Updateable <EResourceInfo>().SetColumns(a => new EResourceInfo() { badNum = a.badNum + 1 }); } else if (praizeType == PraizeType.bad && direction == OperationDirection.minus) { op = Db.Updateable <EResourceInfo>().SetColumns(a => new EResourceInfo() { badNum = a.badNum - 1 }); } else if (praizeType == PraizeType.good && direction == OperationDirection.update) { op = Db.Updateable <EResourceInfo>().SetColumns(a => new EResourceInfo() { goodNum = a.goodNum + 1, badNum = a.badNum - 1 }); } else if (praizeType == PraizeType.bad && direction == OperationDirection.update) { op = Db.Updateable <EResourceInfo>().SetColumns(a => new EResourceInfo() { badNum = a.badNum + 1, goodNum = a.goodNum - 1 }); } op = op.Where(a => a.Code == resCode); return(op.ExecuteCommandHasChange()); }