Exemplo n.º 1
0
        /// <summary>
        /// 根据编号获取商品区域
        /// </summary>
        /// <param name="aid"></param>
        /// <returns></returns>
        public string GetWareArea(string aid)
        {
            OtDB db = GetDb();

            try
            {
                db.Begin();
                string sql  = string.Format("select name from DispatchArea where id = {0}", aid);
                string name = db.QueryOneCol <string>(sql);
                db.Commit();
                return(name);
            }
            catch (Exception ex)
            {
                OtCom.XLogErr(ex.Message);
                //db.Rollback();
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取某个商品当前日期前的最后价格
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public double WareLastPriceGet(string pid)
        {
            double rtnPrice = 0;
            OtDB   db       = GetDb();

            try
            {
                db.Begin();
                string sql = string.Format("select price,max(PriceDate) pricetime from ProductPriceHistory where pid = {0} and Date(PriceDate) < Date(DateTime('now'));", pid);
                //string sql = string.Format("select ProductPrice from ProductInfo where ProductID = '{0}';", pid);
                rtnPrice = db.QueryOneCol <double>(sql);
                db.Commit();
                return(rtnPrice);
            }
            catch (Exception ex)
            {
                OtCom.XLogErr(ex.Message);
                db.Rollback();
                return(0);
            }
        }