Esempio n. 1
0
        /// <summary>
        /// 修改节假日
        /// </summary>
        /// <param name="Hliday">节假日信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyHoliday(DateHoliday Hliday, 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_HolidayEx set ");

                strbld.AppendFormat("Starttime='{0}',", Hliday.Starttime);
                strbld.AppendFormat("Endtime='{0}',", Hliday.Endtime);
                strbld.AppendFormat("[Desc]='{0}',", Hliday.Desc);
                strbld.AppendFormat("HoliName='{0}',", Hliday.HoliName);
                strbld.AppendFormat("pricecode='{0}' ", Hliday.PriceCode);
                strbld.AppendFormat(" where ID='{0}'", Hliday.ID);
                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("{3}修改节假日:{0},{1}-{2}", Hliday.ID, Hliday.Starttime, Hliday.Endtime, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改节假日出错";
                    return rsdc;
                }
                if ("1" == ComFunction.InterType)
                {
                    ComFunction.ModifyHoliday(Hliday);
                }
                rsdc.Result = true;
                //rsdc.Desc = "修该节假日成功";
                rsdc.Desc = strbld.ToString();
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "修改节假日失败";
            }
            return rsdc;
        }
        /// <summary>
        /// 获取交易日信息列表
        /// </summary>
        /// <param name="sql">查询SQL</param>
        /// <returns>交易日信息列表</returns>
        public static List<WcfInterface.model.DateHoliday> GetDateHolidayList(string sql)
        {
            System.Data.Common.DbDataReader dbreader = null;
            List<WcfInterface.model.DateHoliday> list = new List<WcfInterface.model.DateHoliday>();
            try
            {
                dbreader = DbHelper.ExecuteReader(sql);
                while (dbreader.Read())
                {
                    WcfInterface.model.DateHoliday dateHoliday = new WcfInterface.model.DateHoliday();
                    dateHoliday.HoliName = dbreader["HoliName"].ToString();
                    dateHoliday.Starttime = Convert.ToDateTime(dbreader["Starttime"]);
                    dateHoliday.Endtime = Convert.ToDateTime(dbreader["Endtime"]);
                    dateHoliday.PriceCode = dbreader["pricecode"].ToString();
                    dateHoliday.Desc = dbreader["Desc"].ToString();
                    dateHoliday.ID = dbreader["ID"].ToString();

                    list.Add(dateHoliday);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                if (null != dbreader)
                {
                    dbreader.Close();
                    dbreader.Dispose();
                }
            }
            return list;
        }
Esempio n. 3
0
        /// <summary>
        /// 添加节假日
        /// </summary>
        /// <param name="Hliday">节假日信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <param name="ID">返回ID</param>
        /// <returns>添加结果</returns>
        public ResultDesc AddHoliday(DateHoliday Hliday, string LoginId, ref string ID)
        {
            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>();
                ID = System.Guid.NewGuid().ToString().Replace("-", "");
                sqlList.Add(string.Format("insert into Trade_HolidayEx([pricecode],[HoliName],[starttime],[endtime],[desc],[ID]) values('{0}','{1}','{2}','{3}','{4}','{5}')",
                   Hliday.PriceCode, Hliday.HoliName, Hliday.Starttime.ToString("yyyy-MM-dd HH:mm:ss"), Hliday.Endtime.ToString("yyyy-MM-dd HH:mm:ss"), Hliday.Desc, ID));
                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("{3}添加节假日:{0},{1}-{2}", Hliday.ID, Hliday.Starttime, Hliday.Endtime, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加节假日出错";
                    return rsdc;
                }
                if ("1" == ComFunction.InterType)
                {
                    Hliday.ID = ID;
                    ComFunction.AddHoliday(Hliday);
                }
                rsdc.Result = true;
                rsdc.Desc = "添加节假日成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加节假日失败";
            }
            return rsdc;
        }