Exemple #1
0
        public List <GK_OA_GoodsModel> GetGK_OA_GoodsList(string SortColumns, int StartRecord, int MaxRecords, string GoodsNameEqual, string GoodsCodeEqual, string UnitCodeEqual, DateTime InputDateEqualStart, DateTime InputDateEqualEnd)
        {
            List <GK_OA_GoodsModel> models        = new List <GK_OA_GoodsModel>();
            GK_OA_GoodsQueryModel   objQueryModel = new GK_OA_GoodsQueryModel();

            objQueryModel.StartRecord         = StartRecord;
            objQueryModel.MaxRecords          = MaxRecords;
            objQueryModel.SortColumns         = SortColumns;
            objQueryModel.GoodsNameEqual      = GoodsNameEqual;
            objQueryModel.GoodsCodeEqual      = GoodsCodeEqual;
            objQueryModel.UnitCodeEqual       = UnitCodeEqual;
            objQueryModel.InputDateEqualStart = InputDateEqualStart;
            objQueryModel.InputDateEqualEnd   = InputDateEqualEnd;
            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    models = new GK_OA_GoodsBLL().GetModels(objQueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }
Exemple #2
0
        private List <GK_OA_GoodsModel> _Select(GK_OA_GoodsQueryModel qmObj)
        {
            List <GK_OA_GoodsModel> list    = new List <GK_OA_GoodsModel>();
            StringBuilder           builder = new StringBuilder();

            builder.Append("select * from GK_OA_Goods ");
            builder.Append(qmObj.QueryConditionStr);
            if (qmObj.SortColumns.Length == 0)
            {
                builder.Append(" ORDER BY Code desc");
            }
            else
            {
                builder.Append(" ORDER BY " + qmObj.SortColumns);
            }
            this._DataProcess.CommandText   = builder.ToString();
            this._DataProcess.SqlParameters = qmObj.Parameters;
            SqlDataReader sqlDataReader = null;
            int           num           = 0;

            try
            {
                try
                {
                    sqlDataReader = this._DataProcess.GetSqlDataReader();
                    while (sqlDataReader.Read())
                    {
                        if ((num >= qmObj.StartRecord) && ((list.Count < qmObj.MaxRecords) || (qmObj.MaxRecords == -1)))
                        {
                            GK_OA_GoodsModel model = new GK_OA_GoodsModel();
                            this.Initialize(sqlDataReader, model);
                            list.Add(model);
                        }
                        num++;
                    }
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            finally
            {
                if (sqlDataReader != null)
                {
                    sqlDataReader.Close();
                }
            }
            return(list);
        }
Exemple #3
0
        public List <GK_OA_GoodsModel> GetGK_OA_GoodsList(GK_OA_GoodsQueryModel QueryModel)
        {
            List <GK_OA_GoodsModel> models = new List <GK_OA_GoodsModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    if (QueryModel == null)
                    {
                        QueryModel = new GK_OA_GoodsQueryModel();
                    }
                    models = new GK_OA_GoodsBLL().GetModels(QueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }
Exemple #4
0
 public List <GK_OA_GoodsModel> Select(GK_OA_GoodsQueryModel qmObj)
 {
     return(this._Select(qmObj));
 }
Exemple #5
0
        public List <GK_OA_GoodsModel> Select()
        {
            GK_OA_GoodsQueryModel qmObj = new GK_OA_GoodsQueryModel();

            return(this._Select(qmObj));
        }
Exemple #6
0
        public List <GK_OA_GoodsModel> GetModels(GK_OA_GoodsQueryModel ObjQueryModel, SqlTransaction Transaction)
        {
            GK_OA_GoodsDAL sdal = new GK_OA_GoodsDAL(Transaction);

            return(sdal.Select(ObjQueryModel));
        }