/// <summary> /// 获取汇率和水 /// </summary> public static List<WcfInterface.model.TradeRate> GetTradeRateList() { System.Data.Common.DbDataReader dbreader = null; List<model.TradeRate> TradeRateInfoList = new List<model.TradeRate>(); try { string sql = "select distinct pricecode,rate,water from Trade_DataSource "; dbreader = DbHelper.ExecuteReader(sql); while (dbreader.Read()) { model.TradeRate tr = new model.TradeRate(); tr.PriceCode = dbreader["pricecode"].ToString(); tr.Rate = Convert.ToDouble(dbreader["rate"]); tr.Water = Convert.ToDouble(dbreader["water"]); TradeRateInfoList.Add(tr); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (null != dbreader) { dbreader.Close(); dbreader.Dispose(); } } return TradeRateInfoList; }
/// <summary> /// 修改汇率和水 /// </summary> /// <param name="TdRate">汇率和水信息</param> /// <param name="LoginId">管理员登陆标识</param> /// <returns>修改结果</returns> public ResultDesc ModifyTradeRate(TradeRate TdRate, String LoginId) { ResultDesc rsdc = new ResultDesc(); string operUser = string.Empty;//操作人 try { TradeUser TdUser = new TradeUser(); #region 判断登陆标识是否过期 if (!ComFunction.ExistUserLoginID(LoginId, ref TdUser)) { rsdc.Result = false; rsdc.Desc = ResCode.UL003Desc; return rsdc; } if (UserType.NormalType == TdUser.UType) { rsdc.Result = false; rsdc.Desc = ComFunction.NotRightUser; return rsdc; } operUser = TdUser.Account; #endregion List<string> sqlList = new List<string>(); int result = ComFunction.ModifyWaterAndRate(TdRate); //添加操作记录 if (1 == result) { string ipmac = ComFunction.GetIpMac(TdUser.Ip, TdUser.Mac); sqlList.Add(string.Format("insert into Base_OperrationLog([OperTime],[Account],[UserType],[Remark]) values('{0}','{1}',{2},'{3}')", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), operUser, (int)TdUser.UType, string.Format("{1}修改汇率和水:{0}", TdRate.PriceCode, ipmac))); if (!ComFunction.SqlTransaction(sqlList)) { rsdc.Result = false; rsdc.Desc = "修改汇率和水出错1"; return rsdc; } rsdc.Result = true; rsdc.Desc = "修该汇率和水成功"; } else { rsdc.Result = false; rsdc.Desc = "修改汇率和水出错2"; return rsdc; } } catch (Exception ex) { rsdc.Result = false; rsdc.Desc = "修改汇率和水失败"; } return rsdc; }