コード例 #1
0
        public CustomerList SelectRows(DbTransaction pTran, System.Int32?Id, System.String code, System.String name, System.String nameAr, System.Int32?workFieldId)
        {
            CustomerList CustomerList = new CustomerList();
            Exception    exception    = null;

            DbParameter[] Parameters = new DbParameter[5];
            Parameters[0] = _getIdParameter(Id, ParameterDirection.Input);
            Parameters[1] = _getcodeParameter(code, ParameterDirection.Input);
            Parameters[2] = _getnameParameter(name, ParameterDirection.Input);
            Parameters[3] = _getnameArParameter(nameAr, ParameterDirection.Input);
            Parameters[4] = _getworkFieldIdParameter(workFieldId, ParameterDirection.Input);

            DbDataReader Dr = ExecuteReader(pTran, "[Transactions].[SelectCustomer]", Parameters);

            try
            {
                if (Dr != null)
                {
                    while (Dr.Read())
                    {
                        Customer Customer = new Customer();
                        if (Dr["Id"] != DBNull.Value)
                        {
                            Customer.Id = (System.Int32)Dr["Id"];
                        }
                        if (Dr["code"] != DBNull.Value)
                        {
                            Customer.code = (System.String)Dr["code"];
                        }
                        if (Dr["name"] != DBNull.Value)
                        {
                            Customer.name = (System.String)Dr["name"];
                        }
                        if (Dr["nameAr"] != DBNull.Value)
                        {
                            Customer.nameAr = (System.String)Dr["nameAr"];
                        }
                        if (Dr["address"] != DBNull.Value)
                        {
                            Customer.address = (System.String)Dr["address"];
                        }
                        if (Dr["phone"] != DBNull.Value)
                        {
                            Customer.phone = (System.String)Dr["phone"];
                        }
                        if (Dr["email"] != DBNull.Value)
                        {
                            Customer.email = (System.String)Dr["email"];
                        }
                        if (Dr["workFieldId"] != DBNull.Value)
                        {
                            Customer.workFieldId = (System.Int32?)Dr["workFieldId"];
                        }
                        CustomerList.FillRow(Customer);
                        Customer = null;
                    }
                }
            }
            catch (Exception Ex)
            {
                exception = Ex;
            }
            finally
            {
                if (Dr != null)
                {
                    if (Dr.IsClosed == false)
                    {
                        Dr.Close();
                    }
                    Dr = null;
                }
            }
            return(CustomerList);
        }