Пример #1
0
        /// <summary>
        /// 药品分页查询
        /// </summary>
        /// <param name="pNumber">所在页数</param>
        /// <param name="pRows">每页显示条数</param>
        /// <param name="values">药品信息</param>
        /// <param name="msg">出错信息</param>
        /// <returns>0:成功  大于0:出错  小于0:异常</returns>
        public int DB_PageMedicine(int pNumber, int pRows, out ArrayList values, out string msg)
        {
            msg = "";

            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            OracleDataReader dr         = null;

            values = new ArrayList();

            try
            {
                int  ret = -99;
                long maxrow;
                long minrow;
                General.CalculatePage(pNumber, pRows, out maxrow, out minrow);

                bool _flag = false;

                string findId1 = _builder.GetMedicinePage(maxrow, minrow, out _flag, out msg);

                if (!_flag)
                {
                    return(10);
                }

                dr = DbHelperOra.ExecuteReader(findId1, connection);

                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        MedicineDetail pd = new MedicineDetail();

                        pd.lx = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                        pd.mc = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                        pd.dw = !dr.IsDBNull(2) ? dr.GetString(2) : "";
                        pd.gg = !dr.IsDBNull(3) ? dr.GetString(3) : "";
                        pd.cd = !dr.IsDBNull(4) ? dr.GetString(4) : "";
                        pd.jg = !dr.IsDBNull(5) ? dr.GetDouble(5) : 0;


                        values.Add(pd);
                    }
                    ret = 0;
                }
                else
                {
                    msg    = "亲,没有记录";
                    values = null;
                    ret    = 2;
                }

                dr.Close();
                return(ret);
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                msg    = GetExceptionInfo(ex);
                values = null;
                return(-1);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }