Example #1
0
        /// <summary>
        /// 获取某个商品信息
        /// </summary>
        /// <param name="pid">商品编号</param>
        /// <returns></returns>
        public ProductInfo WareGetOne(string pid)
        {
            OtDB db = GetDb();

            try
            {
                db.Begin();
                string      sql     = string.Format("select * from ProductInfo where productid='{0}'", pid);
                ProductInfo rtnList = db.QueryOneRow <ProductInfo>(sql, null);
                db.Commit();

                return(rtnList);
            }
            catch (Exception ex)
            {
                OtCom.XLogErr(ex.Message);
                //db.Rollback();
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// 添加系统参数
        /// </summary>
        /// <param name="pKey"></param>
        /// <param name="PValue"></param>
        private void InsertSysParam(string pKey, string PValue)
        {
            OtDB db = GetDb();

            try
            {
                db.Begin();
                string       sql = string.Format("select * from SysParams where ParamKey = '{0}';", pKey);
                TabSysParams rtn = db.QueryOneRow <TabSysParams>(sql);
                if (rtn == null)
                {
                    sql = string.Format("insert into SysParams (ParamKey,ParamValue,ParamDescription) values ('{0}','{1}','');", pKey, PValue);
                    db.Exec(sql);
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                OtCom.XLogErr(ex.Message);
                db.Rollback();
            }
        }