/// <summary> /// 财务人员设置列表 /// </summary> public FinanceSettingsInfo GetFinanceSettingsByFinanceId(string FinanceId) { Session.Clear(); string strSql = "SELECT isnull(C_FinanceSettings.FinanceId,0)as FinanceId, isnull(C_FinanceSettings.UserId,'')as UserId, isnull(C_FinanceSettings.OperateRank,'')as OperateRank, isnull(C_FinanceSettings.OperateType,'')as OperateType,isnull(C_FinanceSettings.Minmoney,0)as MinMoney,isnull(C_FinanceSettings.MaxMoney,0)as MaxMoney, isnull(E_Login_Local.LoginName,'')as LoginName, isnull(loc.LoginName,'') AS Operator, isnull(C_FinanceSettings.CreateTime,'')as CreateTime FROM C_FinanceSettings INNER JOIN E_Login_Local ON C_FinanceSettings.UserId = E_Login_Local.UserId INNER JOIN E_Login_Local AS loc ON loc.UserId = C_FinanceSettings.OperatorId where C_FinanceSettings.FinanceId=:financeId"; var result = Session.CreateSQLQuery(strSql) .SetString("financeId", FinanceId) .List(); FinanceSettingsInfo info = new FinanceSettingsInfo(); if (result != null && result.Count > 0) { foreach (var item in result) { var array = item as object[]; info.FinanceId = Convert.ToInt32(array[0]); info.UserId = Convert.ToString(array[1]); info.OperateRank = Convert.ToString(array[2]); info.OperateType = Convert.ToString(array[3]); info.MinMoney = Convert.ToDecimal(array[4]); info.MaxMoney = Convert.ToDecimal(array[5]); info.UserName = Convert.ToString(array[6]); info.OperatorName = Convert.ToString(array[7]); info.CreateTime = Convert.ToDateTime(array[8]); } } return(info); }
public FinanceSettingsInfo GetFinanceSettingsInfo(string userId, string operateType) { Session.Clear(); string strSql = "select FinanceId,isnull(UserId,'')as UserId,isnull(OperateRank,'')as OperateRank,isnull(OperateType,'')as OperateType,isnull(MinMoney,0)as MinMoney,isnull(MaxMoney,0)as MaxMoney,isnull(OperatorId,'')as OperatorId,isnull(CreateTime,'')as CreateTime from C_FinanceSettings where UserId=:userId and OperateType=:operateType"; var query = Session.CreateSQLQuery(strSql) .SetString("userId", userId) .SetString("operateType", operateType) .List(); FinanceSettingsInfo info = new FinanceSettingsInfo(); if (query != null && query.Count > 0) { foreach (var item in query) { var array = item as object[]; info.FinanceId = Convert.ToInt32(array[0]); info.UserId = array[1].ToString(); info.OperateRank = array[2].ToString(); info.OperateType = array[3].ToString(); info.MinMoney = Convert.ToDecimal(array[4]); info.MaxMoney = Convert.ToDecimal(array[5]); info.OperatorId = array[6].ToString(); info.CreateTime = Convert.ToDateTime(array[7]); } } return(info); }
public void FinanceSetting(string opeType, FinanceSettingsInfo info, string operatorId) { try { using (var manage = new UserBalanceManager()) { if (info != null) { FinanceSettings entity = new FinanceSettings(); ObjectConvert.ConverInfoToEntity(info, ref entity); entity.OperatorId = operatorId; entity.CreateTime = DateTime.Now; switch (opeType.ToLower()) { case "add": AddFinanceSettings(entity); break; case "update": //UpdateFinanceSettings(entity); manage.UpdateFinanceSettings(entity); break; case "delete": manage.DeleteFinanceSettings(entity.FinanceId.ToString()); break; } } else { if (opeType.ToLower() != "delete") { throw new Exception("保存数据失败!"); } else { throw new Exception("删除数据失败!"); } } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public CommonActionResult FinanceSetting(string opeType, FinanceSettingsInfo info, string userToken) { try { // 验证用户身份及权限 var userId = GameBizAuthBusiness.ValidateUserAuthentication(userToken); new UserBusiness().FinanceSetting(opeType, info, userId); if (opeType.ToLower() != "delete") { return(new CommonActionResult(true, "保存数据成功!")); } else { return(new CommonActionResult(true, "删除数据成功!")); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public FinanceSettingsInfo_Collection GetFinanceSettingsCollection(string userId, DateTime startTime, DateTime endTime, int pageIndex, int pageSize) { Session.Clear(); string sTime = startTime.ToShortDateString() + " 00:00:00"; string eTime = endTime.ToShortDateString() + " 23:59:59"; StringBuilder strBud = new StringBuilder(); if (!string.IsNullOrEmpty(userId)) { strBud.Append(" where C_FinanceSettings.UserId='" + userId + "' "); } string strSql = "SELECT isnull(C_FinanceSettings.FinanceId,0)as FinanceId, isnull(C_FinanceSettings.UserId,'')as UserId, isnull(C_FinanceSettings.OperateRank,'')as OperateRank, isnull(C_FinanceSettings.OperateType,'')as OperateType,cast(C_FinanceSettings.minmoney as nvarchar)+'—'+cast(C_FinanceSettings.Maxmoney as nvarchar) as FinanceMoney, isnull(E_Login_Local.LoginName,'')as LoginName, isnull(loc.LoginName,'') AS Operator, isnull(C_FinanceSettings.CreateTime,'')as CreateTime FROM C_FinanceSettings INNER JOIN E_Login_Local ON C_FinanceSettings.UserId = E_Login_Local.UserId INNER JOIN E_Login_Local AS loc ON loc.UserId = C_FinanceSettings.OperatorId " + strBud + ""; int totalCount = 0; var query = CreateOutputQuery(Session.GetNamedQuery("P_Core_Pager")) .AddInParameter("sqlStr", strSql) .AddInParameter("currentPageIndex", pageIndex) .AddInParameter("pageSize", pageSize); var result = query.ToListByPaging(out totalCount); FinanceSettingsInfo_Collection collection = new FinanceSettingsInfo_Collection(); collection.TotalCount = totalCount; if (result != null && result.Count > 0) { foreach (var item in result) { var array = item as object[]; FinanceSettingsInfo info = new FinanceSettingsInfo(); info.FinanceId = Convert.ToInt32(array[0]); info.UserId = Convert.ToString(array[1]); info.OperateRank = Convert.ToString(array[2]); info.OperateType = Convert.ToString(array[3]); info.FinanceMoney = Convert.ToString(array[4]); info.UserName = Convert.ToString(array[5]); info.OperatorName = Convert.ToString(array[6]); info.CreateTime = Convert.ToDateTime(array[7]); collection.FinanceSettingsList.Add(info); } } return(collection); }