/// <summary>
        /// 修改商品信息
        /// </summary>
        /// <param name="TdProduct">商品信息信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>修改结果</returns>
        public ResultDesc ModifyTradeProduct(TradeProduct TdProduct, 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_Product set ");
                strbld.AppendFormat("ProductName='{0}',", TdProduct.ProductName);
                strbld.AppendFormat("Adjustbase={0},", TdProduct.Adjustbase);
                //strbld.AppendFormat("Adjustcount={0},", TdProduct.Adjustcount);
                strbld.AppendFormat("Expressionfee='{0}',", TdProduct.Expressionfee);
                strbld.AppendFormat("Holdbase={0},", TdProduct.Holdbase);
                strbld.AppendFormat("Lowerprice={0},", TdProduct.Lowerprice);
                strbld.AppendFormat("Maxprice={0},", TdProduct.Maxprice);
                strbld.AppendFormat("Maxtime={0},", TdProduct.Maxtime);
                strbld.AppendFormat("Minprice={0},", TdProduct.Minprice);
                //strbld.AppendFormat("Ordemoney={0},", TdProduct.Ordemoney);
                strbld.AppendFormat("Ordemoneyfee='{0}',", TdProduct.Ordemoneyfee);
                strbld.AppendFormat("Pricedot={0},", TdProduct.Pricedot);
                //strbld.AppendFormat("Sellfee='{0}',", TdProduct.Sellfee);
                strbld.AppendFormat("Sellstoragefee='{0}',", TdProduct.Sellstoragefee);
                strbld.AppendFormat("SetBase={0},", TdProduct.SetBase);
                strbld.AppendFormat("State='{0}',", TdProduct.State);
                strbld.AppendFormat("Unit={0},", TdProduct.Unit);
                strbld.AppendFormat("Valuedot={0},", TdProduct.Valuedot);
                strbld.AppendFormat("Buystoragefee='{0}',", TdProduct.Buystoragefee);
                strbld.AppendFormat("Pricecode='{0}',", TdProduct.Pricecode);
                //strbld.AppendFormat("Goodscode='{0}',", TdProduct.Goodscode);
                strbld.AppendFormat("starttime='{0}',", TdProduct.Starttime);
                strbld.AppendFormat("endtime='{0}'", TdProduct.Endtime);
                strbld.AppendFormat(" where Productcode='{0}'", TdProduct.Productcode);
                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("{1}修改商品信息:{0}", TdProduct.ProductName, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "修改商品信息出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "修该商品信息成功";
            }
            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<TradeProduct> GetTradeProductList(string sql)
        {
            System.Data.Common.DbDataReader dbreader = null;
            List<TradeProduct> list = new List<TradeProduct>();
            try
            {
                Dictionary<string, ProPrice> prodic = GetProPrice();
                dbreader = DbHelper.ExecuteReader(sql);
                while (dbreader.Read())
                {
                    TradeProduct tradeProduct = new TradeProduct();
                    tradeProduct.Adjustbase = System.DBNull.Value != dbreader["Adjustbase"] ? Convert.ToDouble(dbreader["Adjustbase"]) : 0;
                    tradeProduct.Adjustcount = System.DBNull.Value != dbreader["Adjustcount"] ? Convert.ToInt32(dbreader["Adjustcount"]) : 0;
                    tradeProduct.Buystoragefee = System.DBNull.Value != dbreader["Buystoragefee"] ? dbreader["Buystoragefee"].ToString() : string.Empty;
                    tradeProduct.Expressionfee = System.DBNull.Value != dbreader["Expressionfee"] ? dbreader["Expressionfee"].ToString() : string.Empty;
                    tradeProduct.Goodscode = System.DBNull.Value != dbreader["Goodscode"] ? dbreader["Goodscode"].ToString() : string.Empty;
                    tradeProduct.Holdbase = System.DBNull.Value != dbreader["Holdbase"] ? Convert.ToInt32(dbreader["Holdbase"]) : 0;
                    tradeProduct.Lowerprice = System.DBNull.Value != dbreader["Lowerprice"] ? Convert.ToDouble(dbreader["Lowerprice"]) : 0;
                    tradeProduct.Maxprice = System.DBNull.Value != dbreader["Maxprice"] ? Convert.ToDouble(dbreader["Maxprice"]) : 0;
                    tradeProduct.Maxtime = System.DBNull.Value != dbreader["Maxtime"] ? Convert.ToInt32(dbreader["Maxtime"]) : 0;
                    tradeProduct.Minprice = System.DBNull.Value != dbreader["Minprice"] ? Convert.ToDouble(dbreader["Minprice"]) : 0;
                    tradeProduct.Ordemoney = System.DBNull.Value != dbreader["Ordemoney"] ? Convert.ToDouble(dbreader["Ordemoney"]) : 0;
                    tradeProduct.Ordemoneyfee = System.DBNull.Value != dbreader["Ordemoneyfee"] ? dbreader["Ordemoneyfee"].ToString() : string.Empty;
                    tradeProduct.Pricecode = System.DBNull.Value != dbreader["Pricecode"] ? dbreader["Pricecode"].ToString() : string.Empty;
                    tradeProduct.Pricedot = System.DBNull.Value != dbreader["Pricedot"] ? Convert.ToInt32(dbreader["Pricedot"]) : 0;
                    tradeProduct.Productcode = System.DBNull.Value != dbreader["Productcode"] ? dbreader["Productcode"].ToString() : string.Empty;
                    tradeProduct.ProductName = System.DBNull.Value != dbreader["ProductName"] ? dbreader["ProductName"].ToString() : string.Empty;
                    tradeProduct.Sellfee = System.DBNull.Value != dbreader["Sellfee"] ? dbreader["Sellfee"].ToString() : string.Empty;
                    tradeProduct.Sellstoragefee = System.DBNull.Value != dbreader["Sellstoragefee"] ? dbreader["Sellstoragefee"].ToString() : string.Empty;
                    tradeProduct.SetBase = System.DBNull.Value != dbreader["SetBase"] ? Convert.ToInt32(dbreader["SetBase"]) : 0;
                    tradeProduct.State = System.DBNull.Value != dbreader["State"] ? dbreader["State"].ToString() : string.Empty;
                    tradeProduct.Unit = System.DBNull.Value != dbreader["Unit"] ? Convert.ToDouble(dbreader["Unit"]) : 0;
                    tradeProduct.Valuedot = System.DBNull.Value != dbreader["Valuedot"] ? Convert.ToDouble(dbreader["Valuedot"]) : 0;
                    tradeProduct.Starttime = System.DBNull.Value != dbreader["starttime"] ? dbreader["starttime"].ToString() : string.Empty;
                    tradeProduct.Endtime = System.DBNull.Value != dbreader["endtime"] ? dbreader["endtime"].ToString() : string.Empty;

                    if (prodic != null && prodic.ContainsKey(tradeProduct.Pricecode))
                    {
                        tradeProduct.weektime = prodic[tradeProduct.Pricecode].weektime;
                        tradeProduct.realprice = prodic[tradeProduct.Pricecode].realprice;
                    }
                    list.Add(tradeProduct);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                if (null != dbreader)
                {
                    dbreader.Close();
                    dbreader.Dispose();
                }
            }
            return list;
        }
        /// <summary>
        /// 添加商品信息
        /// </summary>
        /// <param name="TdProduct">商品信息信息</param>
        /// <param name="LoginId">管理员登陆标识</param>
        /// <returns>添加结果</returns>
        public ResultDesc AddTradeProduct(TradeProduct TdProduct, 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>();
                TradeDataSource tdsource = ComFunction.GetTradeDataSource(TdProduct.Pricecode);
                //Goodscode用Pricecode赋值
                sqlList.Add(string.Format("insert into Trade_Product([ProductName],[productcode],[goodscode],[pricecode],[adjustbase],[adjustcount],[pricedot],[valuedot],[setBase],[holdbase],[expressionfee],[sellfee],[maxprice],[minprice],[maxtime],[Ordemoneyfee],[Ordemoney],[buystoragefee],[sellstoragefee],[state],[unit],[lowerprice],[starttime],[endtime]) values('{0}','{1}','{2}','{3}',{4},{5},{6},{7},{8},{9},'{10}','{11}',{12},{13},{14},'{15}',{16},'{17}','{18}','{19}',{20},{21},'{22}','{23}')",
                    TdProduct.ProductName, TdProduct.Productcode, TdProduct.Pricecode, TdProduct.Pricecode, TdProduct.Adjustbase, tdsource.adjustcount,
                    TdProduct.Pricedot, TdProduct.Valuedot, TdProduct.SetBase, TdProduct.Holdbase, TdProduct.Expressionfee, TdProduct.Sellfee, TdProduct.Maxprice,
                    TdProduct.Minprice, TdProduct.Maxtime, TdProduct.Ordemoneyfee, TdProduct.Ordemoney, TdProduct.Buystoragefee, TdProduct.Sellstoragefee,
                    TdProduct.State, TdProduct.Unit, TdProduct.Lowerprice, TdProduct.Starttime, TdProduct.Endtime));
                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}", TdProduct.ProductName, ipmac)));

                if (!ComFunction.SqlTransaction(sqlList))
                {
                    rsdc.Result = false;
                    rsdc.Desc = "添加商品信息出错";
                    return rsdc;
                }
                rsdc.Result = true;
                rsdc.Desc = "添加商品信息成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc = "添加商品信息失败";
            }
            return rsdc;
        }