/// <summary> /// 获取交易日信息列表 /// </summary> /// <param name="sql">查询SQL</param> /// <returns>交易日信息列表</returns> public static List<WcfInterface.model.DateSet> GetDateSetListEx(string sql) { System.Data.Common.DbDataReader dbreader = null; List<WcfInterface.model.DateSet> list = new List<WcfInterface.model.DateSet>(); try { dbreader = DbHelper.ExecuteReader(sql); while (dbreader.Read()) { WcfInterface.model.DateSet dataSet = new WcfInterface.model.DateSet(); dataSet.Weekday = dbreader["Weekday"].ToString(); dataSet.Starttime = dbreader["Starttime"].ToString(); dataSet.Endtime = dbreader["Endtime"].ToString(); dataSet.Desc = dbreader["Desc"].ToString(); dataSet.PriceCode = dbreader["pricecode"].ToString(); dataSet.Istrade = !Convert.ToBoolean(dbreader["Istrade"]); list.Add(dataSet); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (null != dbreader) { dbreader.Close(); dbreader.Dispose(); } } return list; }
/// <summary> /// 修改交易日 /// </summary> /// <param name="DtSet">交易日信息</param> /// <param name="LoginId">管理员登陆标识</param> /// <returns>修改结果</returns> public ResultDesc ModifyDateSetEx(DateSet DtSet, 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>(); StringBuilder strbld = new StringBuilder(); strbld.AppendFormat("update Trade_DateSetEx set "); strbld.AppendFormat("Istrade={0},", DtSet.Istrade ? 0 : 1); strbld.AppendFormat("Starttime='{0}',", DtSet.Starttime); strbld.AppendFormat("Endtime='{0}',", DtSet.Endtime); strbld.AppendFormat("[Desc]='{0}'", DtSet.Desc); strbld.AppendFormat(" where pricecode='{0}' and Weekday='{1}'", DtSet.PriceCode, DtSet.Weekday); sqlList.Add(strbld.ToString()); //添加操作记录 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("{4}修改交易日{0}-{1},{2}-{3}", DtSet.PriceCode, DtSet.Weekday, DtSet.Starttime, DtSet.Endtime, ipmac))); if (!ComFunction.SqlTransaction(sqlList)) { rsdc.Result = false; rsdc.Desc = "修改交易日出错"; return rsdc; } if ("1" == ComFunction.InterType) { ComFunction.ModifyDateSetEx(DtSet); } rsdc.Result = true; rsdc.Desc = "修该交易日成功"; } catch (Exception ex) { ComFunction.WriteErr(ex); rsdc.Result = false; rsdc.Desc = "修改交易日失败"; } return rsdc; }