public DTO.PSRightModify RightModify(DTO.PQRightModify request) { DTO.PSRightModify response = new DTO.PSRightModify(); try { using (var scope = new System.Transactions.TransactionScope()) { foreach (KeyValuePair <int, string> tmp in request.RoleIDs) { DAL.cUserDAL dal = new DAL.cUserDAL(con); dal.RightModify(request.FunctionCode, tmp.Key, tmp.Value); } con.SaveChanges(); scope.Complete(); response.ErrorCode = "A_0"; } } catch (Exception ex) { LogHelper.Error("cUserBLL.RightModify出错!", ex); throw; } response.ErrorMessage = rm.GetString(response.ErrorCode); return(response); }
public DTO.PSRightQuery RightQuery(DTO.PQRightQuery request) { DTO.PSRightQuery response = new DTO.PSRightQuery(); try { DAL.cUserDAL dal = new DAL.cUserDAL(con); dal.RightQueryBuild(request); response.data = dal.Query <Data.DTO.LRight>(); int num = dal.Count(); response.Page = request.Page; response.MaxNum = num; response.count = num; response.MaxPage = MathExpansion.CaculatPage(num, request.PageRow); response.ErrorMessage = rm.GetString(response.ErrorCode); response.code = response.ErrorCode == "A_0" ? "0" : response.ErrorCode; response.msg = response.ErrorMessage; } catch (Exception ex) { LogHelper.Error("cUserBLL.QueryUser出错!", ex); throw; } return(response); }