///<Summary> ///Select all rows by foreign key ///This method returns all data rows in the table invoices based on a foreign key ///</Summary> ///<returns> ///List-IDAOİnvoices. ///</returns> ///<parameters> ///string orderİd ///</parameters> public static List <IDAOİnvoices> SelectAllByOrderİd(string orderİd) { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_invoices_getbyorderid"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("invoices"); MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command); try { command.Parameters.Add(new MySqlParameter("?P_ORDER_İD", MySqlDbType.VarChar, 0, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)orderİd ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOİnvoices> objList = new List <IDAOİnvoices>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOInvoices retObj = new DAOInvoices(); retObj._id = Convert.IsDBNull(row["id"]) ? null : (string)row["id"]; retObj._orderİd = Convert.IsDBNull(row["order_id"]) ? null : (string)row["order_id"]; retObj._invoiceDate = Convert.IsDBNull(row["invoice_date"]) ? null : (string)row["invoice_date"]; retObj._dueDate = Convert.IsDBNull(row["due_date"]) ? null : (string)row["due_date"]; retObj._tax = Convert.IsDBNull(row["tax"]) ? null : (string)row["tax"]; retObj._shipping = Convert.IsDBNull(row["shipping"]) ? null : (string)row["shipping"]; retObj._amountDue = Convert.IsDBNull(row["amount_due"]) ? null : (string)row["amount_due"]; 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 all rows ///This method returns all data rows in the table invoices ///</Summary> ///<returns> ///List-IDAOİnvoices. ///</returns> ///<parameters> /// ///</parameters> public static List <IDAOİnvoices> SelectAll() { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_invoices_getall"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("invoices"); MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); Done(null); List <IDAOİnvoices> objList = new List <IDAOİnvoices>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOInvoices retObj = new DAOInvoices(); retObj._id = Convert.IsDBNull(row["id"]) ? null : (string)row["id"]; retObj._orderİd = Convert.IsDBNull(row["order_id"]) ? null : (string)row["order_id"]; retObj._invoiceDate = Convert.IsDBNull(row["invoice_date"]) ? null : (string)row["invoice_date"]; retObj._dueDate = Convert.IsDBNull(row["due_date"]) ? null : (string)row["due_date"]; retObj._tax = Convert.IsDBNull(row["tax"]) ? null : (string)row["tax"]; retObj._shipping = Convert.IsDBNull(row["shipping"]) ? null : (string)row["shipping"]; retObj._amountDue = Convert.IsDBNull(row["amount_due"]) ? null : (string)row["amount_due"]; 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 invoices based on the primary key(s) ///</Summary> ///<returns> ///IDAOİnvoices ///</returns> ///<parameters> ///string id ///</parameters> public static IDAOİnvoices SelectOne(string id) { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_invoices_getone"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("invoices"); 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); DAOInvoices retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOInvoices(); retObj._id = Convert.IsDBNull(dt.Rows[0]["id"]) ? null : (string)dt.Rows[0]["id"]; retObj._orderİd = Convert.IsDBNull(dt.Rows[0]["order_id"]) ? null : (string)dt.Rows[0]["order_id"]; retObj._invoiceDate = Convert.IsDBNull(dt.Rows[0]["invoice_date"]) ? null : (string)dt.Rows[0]["invoice_date"]; retObj._dueDate = Convert.IsDBNull(dt.Rows[0]["due_date"]) ? null : (string)dt.Rows[0]["due_date"]; retObj._tax = Convert.IsDBNull(dt.Rows[0]["tax"]) ? null : (string)dt.Rows[0]["tax"]; retObj._shipping = Convert.IsDBNull(dt.Rows[0]["shipping"]) ? null : (string)dt.Rows[0]["shipping"]; retObj._amountDue = Convert.IsDBNull(dt.Rows[0]["amount_due"]) ? null : (string)dt.Rows[0]["amount_due"]; 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 by filter criteria ///This method returns all data rows in the table using criteriaquery api invoices ///</Summary> ///<returns> ///List-IDAOİnvoices. ///</returns> ///<parameters> ///IList<IDataCriterion> listCriterion, IList<IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake ///</parameters> public static List <IDAOİnvoices> SelectAllByCriteria(IList <IDataCriterion> listCriterion, IList <IDataOrderBy> listOrder, IDataSkip dataSkip, IDataTake dataTake) { Doing(null); MySqlCommand command = new MySqlCommand(); command.CommandText = "ctpr_invoices_getbycriteria"; command.CommandType = CommandType.StoredProcedure; MySqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("invoices"); 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 <IDAOİnvoices> objList = new List <IDAOİnvoices>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOInvoices retObj = new DAOInvoices(); retObj._id = Convert.IsDBNull(row["id"]) ? null : (string)row["id"]; retObj._orderİd = Convert.IsDBNull(row["order_id"]) ? null : (string)row["order_id"]; retObj._invoiceDate = Convert.IsDBNull(row["invoice_date"]) ? null : (string)row["invoice_date"]; retObj._dueDate = Convert.IsDBNull(row["due_date"]) ? null : (string)row["due_date"]; retObj._tax = Convert.IsDBNull(row["tax"]) ? null : (string)row["tax"]; retObj._shipping = Convert.IsDBNull(row["shipping"]) ? null : (string)row["shipping"]; retObj._amountDue = Convert.IsDBNull(row["amount_due"]) ? null : (string)row["amount_due"]; 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(); } }