Example #1
0
        private static ArrayList List(string lead, int comId, DateTime start, DateTime end, Pager pager)
        {
            /*
             SupplierBillingList
            @comId int=0,
            @leadGuid varchar(32)='',
            @start varchar(10)='',
            @end varchar(10)='',
            @pageIndex int=1,
            @pageSize int=20,
            @sort int=0
             */

            //[Id], CompanyId, LeadGuid, Amount, Remark, [Datetime]

            ArrayList list = new ArrayList();

            SqlParameter[] prams ={
                Database.MakeInParam("@comId",SqlDbType.Int,comId),
                Database.MakeInParam("@leadGuid",SqlDbType.VarChar,32,lead),
                Database.MakeInParam("@start",SqlDbType.VarChar,10,start==DateTime.MinValue?"":start.ToShortDateString()),
                Database.MakeInParam("@end",SqlDbType.VarChar,10,end==DateTime.MinValue?"":end.ToShortDateString()),
                Database.MakeInParam("@pageIndex",SqlDbType.Int,pager.PageIndex),
                Database.MakeInParam("@pageSize",SqlDbType.Int,pager.PageSize),
                Database.MakeInParam("@sort",SqlDbType.Int,pager.SortNum)
            };

            SqlDataReader reader = null;
            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "SupplierBillingList", prams);

                if (reader.Read())
                {
                    pager.RecordCount = reader.GetInt32(0);

                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            SupplierBilling sb = new SupplierBilling();
                            sb.id = reader.GetInt32(0);
                            sb.companyId = reader.GetInt32(1);
                            sb.leadGuid = reader.GetString(2);
                            sb.amount = Convert.ToSingle(reader.GetValue(3));
                            sb.remark = reader.GetString(4);
                            sb.datetime = reader.GetDateTime(5);
                            list.Add(sb);
                        }
                    }
                }
                reader.Close();
            }
            catch
            {
                throw;
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Example #2
0
 public static SupplierBilling Get(int id)
 {
     SupplierBilling sb = new SupplierBilling();
     return sb;
 }