///<Summary> ///Select all rows by filter criteria ///This method returns all data rows in the table using criteriaquery api suppliers ///</Summary> ///<returns> ///List-IDAOSuppliers. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static List <IDAOSuppliers> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_suppliers_getbycriteria"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("suppliers"); MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command); try { string whereClause = GetSelectionCriteria(listCriterion); string orderClause = GetSelectionOrder(listOrder); string skipClause = GetSelectionSkip(dataSkip); string takeClause = GetSelectionTake(dataTake); command.Parameters.Add(new MySqlParameter("?P_SKİPCLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)skipClause ?? (object)DBNull.Value)); command.Parameters.Add(new MySqlParameter("?P_TAKECLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)takeClause ?? (object)DBNull.Value)); command.Parameters.Add(new MySqlParameter("?P_WHERECLAUSE", MySqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)whereClause ?? (object)DBNull.Value)); command.Parameters.Add(new MySqlParameter("?P_ORDERCLAUSE", MySqlDbType.VarChar, 500, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)orderClause ?? (object)DBNull.Value)); command.Parameters.Add(new MySqlParameter("?P_SKİPCLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)skipClause ?? (object)DBNull.Value)); command.Parameters.Add(new MySqlParameter("?P_TAKECLAUSE", MySqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)takeClause ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOSuppliers> objList = new List <IDAOSuppliers>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOSuppliers retObj = new DAOSuppliers(); retObj._id = Convert.IsDBNull(row["id"]) ? null : (string)row["id"]; retObj._company = Convert.IsDBNull(row["company"]) ? null : (string)row["company"]; retObj._lastName = Convert.IsDBNull(row["last_name"]) ? null : (string)row["last_name"]; retObj._firstName = Convert.IsDBNull(row["first_name"]) ? null : (string)row["first_name"]; retObj._emailAddress = Convert.IsDBNull(row["email_address"]) ? null : (string)row["email_address"]; retObj._jobTitle = Convert.IsDBNull(row["job_title"]) ? null : (string)row["job_title"]; retObj._businessPhone = Convert.IsDBNull(row["business_phone"]) ? null : (string)row["business_phone"]; retObj._homePhone = Convert.IsDBNull(row["home_phone"]) ? null : (string)row["home_phone"]; retObj._mobilePhone = Convert.IsDBNull(row["mobile_phone"]) ? null : (string)row["mobile_phone"]; retObj._faxNumber = Convert.IsDBNull(row["fax_number"]) ? null : (string)row["fax_number"]; retObj._address = Convert.IsDBNull(row["address"]) ? null : (string)row["address"]; retObj._city = Convert.IsDBNull(row["city"]) ? null : (string)row["city"]; retObj._stateProvince = Convert.IsDBNull(row["state_province"]) ? null : (string)row["state_province"]; retObj._zipPostalCode = Convert.IsDBNull(row["zip_postal_code"]) ? null : (string)row["zip_postal_code"]; retObj._countryRegion = Convert.IsDBNull(row["country_region"]) ? null : (string)row["country_region"]; retObj._webPage = Convert.IsDBNull(row["web_page"]) ? null : (string)row["web_page"]; retObj._notes = Convert.IsDBNull(row["notes"]) ? null : (string)row["notes"]; retObj._attachments = Convert.IsDBNull(row["attachments"]) ? null : (byte[])row["attachments"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? null : (string)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table suppliers based on the primary key(s) ///</Summary> ///<returns> ///IDAOSuppliers ///</returns> ///<parameters> ///string id ///</parameters> public static IDAOSuppliers SelectOne(string id) { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_suppliers_getone"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("suppliers"); MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command); try { command.Parameters.Add(new MySqlParameter("?P_İD", MySqlDbType.VarChar, 0, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)id ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); DAOSuppliers retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOSuppliers(); retObj._id = Convert.IsDBNull(dt.Rows[0]["id"]) ? null : (string)dt.Rows[0]["id"]; retObj._company = Convert.IsDBNull(dt.Rows[0]["company"]) ? null : (string)dt.Rows[0]["company"]; retObj._lastName = Convert.IsDBNull(dt.Rows[0]["last_name"]) ? null : (string)dt.Rows[0]["last_name"]; retObj._firstName = Convert.IsDBNull(dt.Rows[0]["first_name"]) ? null : (string)dt.Rows[0]["first_name"]; retObj._emailAddress = Convert.IsDBNull(dt.Rows[0]["email_address"]) ? null : (string)dt.Rows[0]["email_address"]; retObj._jobTitle = Convert.IsDBNull(dt.Rows[0]["job_title"]) ? null : (string)dt.Rows[0]["job_title"]; retObj._businessPhone = Convert.IsDBNull(dt.Rows[0]["business_phone"]) ? null : (string)dt.Rows[0]["business_phone"]; retObj._homePhone = Convert.IsDBNull(dt.Rows[0]["home_phone"]) ? null : (string)dt.Rows[0]["home_phone"]; retObj._mobilePhone = Convert.IsDBNull(dt.Rows[0]["mobile_phone"]) ? null : (string)dt.Rows[0]["mobile_phone"]; retObj._faxNumber = Convert.IsDBNull(dt.Rows[0]["fax_number"]) ? null : (string)dt.Rows[0]["fax_number"]; retObj._address = Convert.IsDBNull(dt.Rows[0]["address"]) ? null : (string)dt.Rows[0]["address"]; retObj._city = Convert.IsDBNull(dt.Rows[0]["city"]) ? null : (string)dt.Rows[0]["city"]; retObj._stateProvince = Convert.IsDBNull(dt.Rows[0]["state_province"]) ? null : (string)dt.Rows[0]["state_province"]; retObj._zipPostalCode = Convert.IsDBNull(dt.Rows[0]["zip_postal_code"]) ? null : (string)dt.Rows[0]["zip_postal_code"]; retObj._countryRegion = Convert.IsDBNull(dt.Rows[0]["country_region"]) ? null : (string)dt.Rows[0]["country_region"]; retObj._webPage = Convert.IsDBNull(dt.Rows[0]["web_page"]) ? null : (string)dt.Rows[0]["web_page"]; retObj._notes = Convert.IsDBNull(dt.Rows[0]["notes"]) ? null : (string)dt.Rows[0]["notes"]; retObj._attachments = Convert.IsDBNull(dt.Rows[0]["attachments"]) ? null : (byte[])dt.Rows[0]["attachments"]; retObj._ctrVersion = Convert.IsDBNull(dt.Rows[0]["ctr_version"]) ? null : (string)dt.Rows[0]["ctr_version"]; } return(retObj); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select all rows ///This method returns all data rows in the table suppliers ///</Summary> ///<returns> ///List-IDAOSuppliers. ///</returns> ///<parameters> /// ///</parameters> public static List <IDAOSuppliers> SelectAll() { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_suppliers_getall"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("suppliers"); MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOSuppliers> objList = new List <IDAOSuppliers>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOSuppliers retObj = new DAOSuppliers(); retObj._id = Convert.IsDBNull(row["id"]) ? null : (string)row["id"]; retObj._company = Convert.IsDBNull(row["company"]) ? null : (string)row["company"]; retObj._lastName = Convert.IsDBNull(row["last_name"]) ? null : (string)row["last_name"]; retObj._firstName = Convert.IsDBNull(row["first_name"]) ? null : (string)row["first_name"]; retObj._emailAddress = Convert.IsDBNull(row["email_address"]) ? null : (string)row["email_address"]; retObj._jobTitle = Convert.IsDBNull(row["job_title"]) ? null : (string)row["job_title"]; retObj._businessPhone = Convert.IsDBNull(row["business_phone"]) ? null : (string)row["business_phone"]; retObj._homePhone = Convert.IsDBNull(row["home_phone"]) ? null : (string)row["home_phone"]; retObj._mobilePhone = Convert.IsDBNull(row["mobile_phone"]) ? null : (string)row["mobile_phone"]; retObj._faxNumber = Convert.IsDBNull(row["fax_number"]) ? null : (string)row["fax_number"]; retObj._address = Convert.IsDBNull(row["address"]) ? null : (string)row["address"]; retObj._city = Convert.IsDBNull(row["city"]) ? null : (string)row["city"]; retObj._stateProvince = Convert.IsDBNull(row["state_province"]) ? null : (string)row["state_province"]; retObj._zipPostalCode = Convert.IsDBNull(row["zip_postal_code"]) ? null : (string)row["zip_postal_code"]; retObj._countryRegion = Convert.IsDBNull(row["country_region"]) ? null : (string)row["country_region"]; retObj._webPage = Convert.IsDBNull(row["web_page"]) ? null : (string)row["web_page"]; retObj._notes = Convert.IsDBNull(row["notes"]) ? null : (string)row["notes"]; retObj._attachments = Convert.IsDBNull(row["attachments"]) ? null : (byte[])row["attachments"]; retObj._ctrVersion = Convert.IsDBNull(row["ctr_version"]) ? null : (string)row["ctr_version"]; objList.Add(retObj); } } return(objList); } catch (Exception ex) { Failed(null, ex); Handle(null, ex); return(null); } finally { staticConnection.Close(); command.Dispose(); } }