public static List <ObjFOURNITURE> GetFournitureByIdTypeDevis(System.Int32 idTypeDevis) { try { return(Entities.GetEntityListFromQuery <ObjFOURNITURE>(DevisProcedures.DEVIS_FOURNITURE_RETOURNEByIdTypeDevis(idTypeDevis))); } catch (Exception ex) { throw ex; } }
public static List <ObjFOURNITURE> SelectFournituresByCodeProduitByIdTypeDevis(int pProduitId, int pIdTypeDevis, string pDiametre) { try { return(Entities.GetEntityListFromQuery <ObjFOURNITURE>(DevisProcedures.DEVIS_FOURNITURE_RETOURNEByCodeProduitByIdTypeDevisDiametre(pIdTypeDevis, pProduitId, pDiametre))); } catch (Exception ex) { throw ex; } }
public static ObjFOURNITURE SelectFournituresByNumFourniture(int pNumFourniture) { try { return(Entities.GetEntityFromQuery <ObjFOURNITURE>(DevisProcedures.DEVIS_FOURNITURE_RETOURNEByNumFourniture(pNumFourniture))); } catch (Exception ex) { throw ex; } }
/* * public static CsControleTravaux SelectControles(string numDevis, byte Ordre) * { * CsControleTravaux control = new CsControleTravaux(); * * string connectString = Session.GetSqlConnexionString(); * //Objet connection * SqlConnection connection = new SqlConnection(connectString); * //Objet Command * SqlCommand command = new SqlCommand("SPX_CONTROLETRAVAUX_SelByNumDevis", connection); * command.CommandType = CommandType.StoredProcedure; * * SqlParameter param = command.Parameters.Add(new SqlParameter("@NumDevis", numDevis)); * param.Direction = ParameterDirection.Input; * SqlParameter param1 = command.Parameters.Add(new SqlParameter("@Ordre", Ordre)); * param1.Direction = ParameterDirection.Input; * * try * { * * //Ouverture * if (connection.State == ConnectionState.Closed) * connection.Open(); * * //Object datareader * SqlDataReader reader = command.ExecuteReader(); * * if (!reader.HasRows) * { * reader.Close(); * return control; * } * while (reader.Read()) * { * control.NumDevis = reader.GetValue(0).ToString().Trim(); * control.Ordre = byte.Parse(reader.GetValue(1).ToString().Trim()); * control.MatriculeChefEquipe = reader.GetValue(2).ToString().Trim(); * control.NomChefEquipe = reader.GetValue(3).ToString().Trim(); * control.MetMoyControle = reader.GetValue(4).ToString().Trim(); * //control.DateDebutTrvx = DateTime.Parse(reader.GetValue(5).ToString().Trim()); * //control.DateFinTrvx = DateTime.Parse(reader.GetValue(6).ToString().Trim()); * if (reader.GetValue(5).ToString().Trim() != string.Empty) * control.DateControle = DateTime.Parse(reader.GetValue(5).ToString().Trim()); * control.VolumeTerTrvx = reader.GetValue(6).ToString().Trim(); * control.DegradationVoie = reader.GetValue(7).ToString().Trim(); * control.Note = byte.Parse(reader.GetValue(8).ToString().Trim()); * * } * //Fermeture reader * reader.Close(); * return control; * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * * } * * * } * * public static bool InsertControl(ObjDEVIS devis, CsControleTravaux controle) * { * string connectString = Session.GetSqlConnexionString(); * //Objet connection * SqlConnection connection = new SqlConnection(connectString); * //Objet Command * SqlCommand command = new SqlCommand("SPX_CONTROLETRAVAUX_INSERT", connection); * command.CommandType = CommandType.StoredProcedure; * * * command.Parameters.Clear(); * * SqlParameter param0 = command.Parameters.Add(new SqlParameter("@NumDevis", SqlDbType.VarChar)); * param0.Direction = ParameterDirection.Input; * SqlParameter param1 = command.Parameters.Add(new SqlParameter("@Ordre", SqlDbType.TinyInt)); * param1.Direction = ParameterDirection.Input; * SqlParameter param2 = command.Parameters.Add(new SqlParameter("@MatriculeChefEquipe", SqlDbType.VarChar)); * param2.Direction = ParameterDirection.Input; * SqlParameter param3 = command.Parameters.Add(new SqlParameter("@NomChefEquipe", SqlDbType.VarChar)); * param3.Direction = ParameterDirection.Input; * SqlParameter param4 = command.Parameters.Add(new SqlParameter("@MetMoyControle", SqlDbType.VarChar)); * param4.Direction = ParameterDirection.Input; * SqlParameter param5 = command.Parameters.Add(new SqlParameter("@DateControle", SqlDbType.DateTime)); * param5.Direction = ParameterDirection.Input; * SqlParameter param6 = command.Parameters.Add(new SqlParameter("@VolumeTerTrvx", SqlDbType.VarChar)); * param6.Direction = ParameterDirection.Input; * SqlParameter param7 = command.Parameters.Add(new SqlParameter("@DegradationVoie", SqlDbType.VarChar)); * param7.Direction = ParameterDirection.Input; * SqlParameter param8 = command.Parameters.Add(new SqlParameter("@Note", SqlDbType.TinyInt)); * param8.Direction = ParameterDirection.Input; * * param0.Value = controle.NumDevis; * param1.Value = controle.Ordre; * param2.Value = controle.MatriculeChefEquipe; * param3.Value = controle.NomChefEquipe; * param4.Value = controle.MetMoyControle; * param5.Value = (controle.DateControle == null) ? DateTime.Now : controle.DateControle; * param6.Value = controle.VolumeTerTrvx; * param7.Value = controle.DegradationVoie; * param8.Value = controle.Note; * * if (connection.State == ConnectionState.Closed) * connection.Open(); * * SqlTransaction trans = connection.BeginTransaction(); * command.Transaction = trans; * * try * { * command.ExecuteNonQuery(); * trans.Commit(); * return true; * } * catch (Exception ex) * { * trans.Rollback(); * throw new Exception(ex.Message); * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * } * } * * public static bool Updatecontroles(ObjDEVIS devis, CsControleTravaux controle) * { * string connectString = Session.GetSqlConnexionString(); * //Objet connection * SqlConnection connection = new SqlConnection(connectString); * //Objet Command * SqlCommand command = new SqlCommand("SPX_CONTROLETRAVAUX_UPDATE", connection); * command.CommandType = CommandType.StoredProcedure; * * * command.Parameters.Clear(); * SqlParameter param0 = command.Parameters.Add(new SqlParameter("@NumDevis", SqlDbType.VarChar)); * param0.Direction = ParameterDirection.Input; * SqlParameter param1 = command.Parameters.Add(new SqlParameter("@Ordre", SqlDbType.TinyInt)); * param1.Direction = ParameterDirection.Input; * SqlParameter param2 = command.Parameters.Add(new SqlParameter("@MatriculeChefEquipe", SqlDbType.VarChar)); * param2.Direction = ParameterDirection.Input; * SqlParameter param3 = command.Parameters.Add(new SqlParameter("@NomChefEquipe", SqlDbType.VarChar)); * param3.Direction = ParameterDirection.Input; * SqlParameter param4 = command.Parameters.Add(new SqlParameter("@MetMoyControle", SqlDbType.VarChar)); * param4.Direction = ParameterDirection.Input; * SqlParameter param5 = command.Parameters.Add(new SqlParameter("@Datecontrole", SqlDbType.DateTime)); * param5.Direction = ParameterDirection.Input; * SqlParameter param6 = command.Parameters.Add(new SqlParameter("@VolumeTerTrvx", SqlDbType.VarChar)); * param6.Direction = ParameterDirection.Input; * SqlParameter param7 = command.Parameters.Add(new SqlParameter("@DegradationVoie", SqlDbType.VarChar)); * param7.Direction = ParameterDirection.Input; * SqlParameter param8 = command.Parameters.Add(new SqlParameter("@Note", SqlDbType.TinyInt)); * param8.Direction = ParameterDirection.Input; * * param0.Value = controle.NumDevis; * param1.Value = controle.Ordre; * param2.Value = controle.MatriculeChefEquipe; * param3.Value = controle.NomChefEquipe; * param4.Value = controle.MetMoyControle; * param5.Value = controle.DateControle; * param6.Value = controle.VolumeTerTrvx; * param7.Value = controle.DegradationVoie; * param8.Value = controle.Note; * * if (connection.State == ConnectionState.Closed) * connection.Open(); * * SqlTransaction trans = connection.BeginTransaction(); * command.Transaction = trans; * * try * { * command.ExecuteNonQuery(); * trans.Commit(); * return true; * } * catch (Exception ex) * { * trans.Rollback(); * throw new Exception(ex.Message); * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * } * } * */ public static CsControleTravaux SelectControles(int pIdDevis, int pOrdre) { try { return(Entities.GetEntityFromQuery <CsControleTravaux>(DevisProcedures.DEVIS_CONTROLETRAVAUX_RETOURNEByDevisId(pIdDevis, pOrdre))); } catch (Exception ex) { throw ex; } }
/* * public static List<ObjDEVISPIA> FillWithName(IDataReader reader, List<ObjDEVISPIA> rows, int start, int pageLength) * { * // advance to the starting row * for (int i = 0; i < start; i++) * { * if (!reader.Read()) * return rows; // not enough rows, just return * } * * for (int i = 0; i < pageLength; i++) * { * if (!reader.Read()) * break; // we are done * * ObjDEVISPIA c = new ObjDEVISPIA(); * c.NumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.OriginalNumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.Ordre = (Convert.IsDBNull(reader["Ordre"])) ? (byte)0 : (System.Byte)reader["Ordre"]; * c.OriginalOrdre = (Convert.IsDBNull(reader["Ordre"])) ? (byte)0 : (System.Byte)reader["Ordre"]; * c.MatriculePIA = (Convert.IsDBNull(reader["MatriculePIA"])) ? string.Empty : (System.String)reader["MatriculePIA"]; * if (Convert.IsDBNull(reader["DatePIA"])) * c.DatePIA = null; * else * c.DatePIA = (System.DateTime)reader["DatePIA"]; * c.NomMetreur = (Convert.IsDBNull(reader["NomMetreur"])) ? string.Empty : (System.String)reader["NomMetreur"]; * rows.Add(c); * } * return rows; * } * * public static List<ObjDEVISPIA> Fill(IDataReader reader, List<ObjDEVISPIA> rows, int start, int pageLength) * { * // advance to the starting row * for (int i = 0; i < start; i++) * { * if (!reader.Read()) * return rows; // not enough rows, just return * } * * for (int i = 0; i < pageLength; i++) * { * if (!reader.Read()) * break; // we are done * * ObjDEVISPIA c = new ObjDEVISPIA(); * c.NumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.OriginalNumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.Ordre = (Convert.IsDBNull(reader["Ordre"])) ? (byte)0 : (System.Byte)reader["Ordre"]; * c.OriginalOrdre = (Convert.IsDBNull(reader["Ordre"])) ? (byte)0 : (System.Byte)reader["Ordre"]; * c.MatriculePIA = (Convert.IsDBNull(reader["MatriculePIA"])) ? string.Empty : (System.String)reader["MatriculePIA"]; * if (Convert.IsDBNull(reader["DatePIA"])) * c.DatePIA = null; * else * c.DatePIA = (System.DateTime)reader["DatePIA"]; * rows.Add(c); * } * return rows; * } * * * public static ObjDEVISPIA GetByNumDevisOrdre(string numDevis, byte ordre) * { * ObjDEVISPIA row = new ObjDEVISPIA(); * string connectString = Session.GetSqlConnexionString(); * * //Objet connection * SqlConnection connection = new SqlConnection(connectString); * //Objet Command * SqlCommand command = new SqlCommand("SPX_DEVIS_DEVISPIA_RETOURNEByNumDevisOrdre", connection); * command.CommandType = CommandType.StoredProcedure; * * SqlParameter param = command.Parameters.Add(new SqlParameter("@NumDevis", numDevis)); * param.Direction = ParameterDirection.Input; * SqlParameter param1 = command.Parameters.Add(new SqlParameter("@Ordre", ordre)); * param1.Direction = ParameterDirection.Input; * * try * { * if (connection.State == ConnectionState.Closed) * connection.Open(); * * SqlDataReader reader = command.ExecuteReader(); * * List<ObjDEVISPIA> tmp = new List<ObjDEVISPIA>(); * FillWithName(reader, tmp, 0, int.MaxValue); * reader.Close(); * * if (tmp.Count == 1) * { * row = tmp[0]; * } * else if (tmp.Count == 0) * { * row = null; * } * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * connection.Dispose(); * command.Dispose(); * } * return row; * } * * public static bool Insert(SqlCommand command, ObjDEVISPIA entity) * { * //Objet Command * int rowsAffected = -1; * command.CommandText = "SPX_DEVIS_DEVISPIA_INSERER"; * command.CommandType = CommandType.StoredProcedure; * * command.Parameters.Clear(); * * command.Parameters.Add("@NumDevis", SqlDbType.VarChar, 8).Value = entity.NumDevis; * command.Parameters.Add("@Ordre", SqlDbType.TinyInt).Value = entity.Ordre; * command.Parameters.Add("@MatriculePIA", SqlDbType.VarChar, 5).Value = entity.MatriculePIA; * command.Parameters.Add("@DatePIA", SqlDbType.DateTime).Value = entity.DatePIA; * * SetDBNullParametre(command.Parameters); * * try * { * rowsAffected = command.ExecuteNonQuery(); * entity.OriginalNumDevis = entity.NumDevis; * entity.OriginalOrdre = entity.Ordre; * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * return Convert.ToBoolean(rowsAffected); * } * * public static bool Delete(SqlCommand command, ObjDEVIS entity) * { * //Objet Command * int rowsAffected = -1; * command.CommandText = "SPX_DEVIS_DEVISPIA_SUPPRIMER"; * command.CommandType = CommandType.StoredProcedure; * command.Parameters.Clear(); * * command.Parameters.Add("@NumDevis", SqlDbType.VarChar, 8).Value = entity.PK_NUMDEVIS; * command.Parameters.Add("@Ordre", SqlDbType.TinyInt).Value = entity.ORDRE; * * try * { * rowsAffected = command.ExecuteNonQuery(); * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * return Convert.ToBoolean(rowsAffected); * } * */ public static ObjDEVISPIA GetByDevisIdOrdre(int IdDevis, int ordre) { try { return(Entities.GetEntityFromQuery <ObjDEVISPIA>(DevisProcedures.DEVIS_DEVISPIA_RETOURNEByDevisIdOrdre(IdDevis, ordre))); } catch (Exception ex) { throw ex; } }
public static List <ObjDEVIS> GetByIsAnalysed(Boolean isAnalysed) { try { return(Entities.GetEntityListFromQuery <ObjDEVIS>(DevisProcedures.DEVIS_DEVIS_RETOURNEByIsAnalysed(isAnalysed))); } catch (Exception ex) { throw ex; } }
public static List <ObjDEVIS> GetByCodeProduitIdTypeDevis(int codeProduit, int idTypeDevis) { try { return(Entities.GetEntityListFromQuery <ObjDEVIS>(DevisProcedures.DEVIS_DEVIS_RETOURNEByCodeProduitIdTypeDevis(codeProduit, idTypeDevis))); } catch (Exception ex) { throw ex; } }
public static List <ObjDEPOSIT> SearchAllDeposit() { try { return(Entities.GetEntityListFromQuery <ObjDEPOSIT>(DevisProcedures.DEVIS_DEPOSIT_RETOURNE())); } catch (Exception ex) { throw ex; } }
public static ObjDEPOSIT SearchByNumDevis(string pNumDevis) { try { return(Entities.GetEntityFromQuery <ObjDEPOSIT>(DevisProcedures.DEVIS_DEPOSIT_RETOURNEByNumdevis(pNumDevis))); } catch (Exception ex) { throw ex; } }
public static List <ObjELEMENTDEVIS> SelectElementsDevisByDevisIdForValidationRemiseStock(int pDevisId, int ordre, bool isSummary) { try { return(Entities.GetEntityListFromQuery <ObjELEMENTDEVIS>(DevisProcedures.DEVIS_ELEMENTDEVIS_ValidationRemiseStock_SelByDevisId(pDevisId, ordre, isSummary))); } catch (Exception ex) { throw ex; } }
public static List <ObjELEMENTDEVIS> SelectElementsDevisConsommeByDevisId(int pDevisId, int ordre) { try { return(Entities.GetEntityListFromQuery <ObjELEMENTDEVIS>(DevisProcedures.DEVIS_ELEMENTDEVIS_Consomme_SelByDevisId(pDevisId, ordre))); } catch (Exception ex) { throw ex; } }
public static List <CsEtatProcesVerbal> EditerDevisPourBonControle(int pIdDevis, int pOrdre) { try { return(Entities.GetEntityListFromQuery <CsEtatProcesVerbal>(DevisProcedures.DEVIS_DEVIS_EditionBonControle(pIdDevis, pOrdre))); } catch (Exception ex) { throw ex; } }
/* * private static List<ObjDOCUMENTSCANNE> Fill(IDataReader reader, List<ObjDOCUMENTSCANNE> rows, int start, int pageLength) * { * // advance to the starting row * for (int i = 0; i < start; i++) * { * if (!reader.Read()) * return rows; // not enough rows, just return * } * * for (int i = 0; i < pageLength; i++) * { * if (!reader.Read()) * break; // we are done * * ObjDOCUMENTSCANNE c = new ObjDOCUMENTSCANNE(); * c.Id = (Convert.IsDBNull(reader["Id"])) ? Guid.Empty : (System.Guid)reader["Id"]; * c.OriginalId = (Convert.IsDBNull(reader["Id"])) ? Guid.Empty : (System.Guid)reader["Id"]; * c.NomDocument = (Convert.IsDBNull(reader["NomDocument"])) ? string.Empty : (System.String)reader["NomDocument"]; * c.Contenu = (Convert.IsDBNull(reader["Contenu"])) ? new byte[] { } : (System.Byte[])reader["Contenu"]; * rows.Add(c); * } * return rows; * } * * public static ObjDOCUMENTSCANNE GetDocumentScanneById(Guid pId) * { * ObjDOCUMENTSCANNE row = new ObjDOCUMENTSCANNE(); * string connectString = Session.GetSqlConnexionString(); * * SqlConnection connection = new SqlConnection(connectString); * //Objet Command * SqlCommand command = new SqlCommand("SPX_DEVIS_DOCUMENTSCANNE_RETOURNEById", connection); * command.CommandType = CommandType.StoredProcedure; * * SqlParameter param = command.Parameters.Add(new SqlParameter("@Id", pId)); * param.Direction = ParameterDirection.Input; * * try * { * //Ouverture * if (connection.State == ConnectionState.Closed) * connection.Open(); * * //Object datareader * SqlDataReader reader = command.ExecuteReader(); * * List<ObjDOCUMENTSCANNE> tmp = new List<ObjDOCUMENTSCANNE>(); * Fill(reader, tmp, 0, int.MaxValue); * reader.Close(); * * if (tmp.Count == 1) * { * row = tmp[0]; * } * else if (tmp.Count == 0) * { * row = null; * } * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * finally * { * //Fermeture base * if (connection.State == ConnectionState.Open) * connection.Close(); * connection.Dispose(); * command.Dispose(); * } * return row; * } * * public static bool InsertDocumentScanne(SqlCommand command, ObjDOCUMENTSCANNE entity) * { * //Objet Command * int rowsAffected = -1; * command.CommandText = "SPX_DEVIS_DOCUMENTSCANNE_INSERER"; * command.CommandType = CommandType.StoredProcedure; * * command.Parameters.Clear(); * * command.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value = entity.Id; * command.Parameters.Add("@NomDocument", SqlDbType.VarChar, 63).Value = entity.NomDocument; * command.Parameters.Add("@Contenu", SqlDbType.Image).Value = entity.Contenu; * * SetDBNullParametre(command.Parameters); * * try * { * rowsAffected = command.ExecuteNonQuery(); * entity.OriginalId = entity.Id; * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * return Convert.ToBoolean(rowsAffected); * } * * public static bool UpdateDocumentScanne(SqlCommand command, ObjDOCUMENTSCANNE entity) * { * //Objet Command * int rowsAffected = -1; * command.CommandText = "SPX_DEVIS_DOCUMENTSCANNE_UPDATE"; * command.CommandType = CommandType.StoredProcedure; * * command.Parameters.Clear(); * * command.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value = entity.Id; * command.Parameters.Add("@OriginalId", SqlDbType.UniqueIdentifier).Value = entity.OriginalId; * command.Parameters.Add("@NomDocument", SqlDbType.VarChar, 63).Value = entity.NomDocument; * command.Parameters.Add("@Contenu", SqlDbType.Image).Value = entity.Contenu; * * SetDBNullParametre(command.Parameters); * * try * { * rowsAffected = command.ExecuteNonQuery(); * entity.OriginalId = entity.Id; * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * return Convert.ToBoolean(rowsAffected); * } * * public static bool DeleteDocumentScanne(SqlCommand command, ObjDOCUMENTSCANNE entity) * { * //Objet Command * int rowsAffected = -1; * command.CommandText = "SPX_DEVIS_DOCUMENTSCANNE_SUPPRIMER"; * command.CommandType = CommandType.StoredProcedure; * * command.Parameters.Clear(); * * command.Parameters.AddWithValue("@Id", entity.Id); * * try * { * rowsAffected = command.ExecuteNonQuery(); * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * return Convert.ToBoolean(rowsAffected); * } */ public static ObjDOCUMENTSCANNE GetDocumentScanneById(Guid pId) { try { return(Entities.GetEntityFromQuery <ObjDOCUMENTSCANNE>(DevisProcedures.DEVIS_DOCUMENTSCANNE_RETOURNEById(pId))); } catch (Exception ex) { throw ex; } }
public static ObjSUIVIDEVIS GetSuiviDevisByDevisIdEtape(int pIdDevis, int pIdEtape) { try { return(Entities.GetEntityFromQuery <ObjSUIVIDEVIS>(DevisProcedures.DEVIS_SUIVIDEVIS_RETOURNEByDevisIdIdEtape(pIdDevis, pIdEtape))); } catch (Exception ex) { throw ex; } }
public static ObjFOURNITURE GetFournitureByNumFourniture(System.Int32 numFourniture) { try { return(Entities.GetEntityFromQuery <ObjFOURNITURE>(DevisProcedures.DEVIS_FOURNITURE_RETOURNEByNumFourniture(numFourniture))); } catch (Exception ex) { throw ex; } }
public static List <ObjDEPOSIT> SearchByNumReceipt(string pReceipt) { try { return(Entities.GetEntityListFromQuery <ObjDEPOSIT>(DevisProcedures.DEVIS_DEPOSIT_RETOURNEByReceipt(pReceipt))); } catch (Exception ex) { throw ex; } }
public static List <ObjDEVIS> GetByIdEtapeDevis(int idEtapeDevis) { try { return(Entities.GetEntityListFromQuery <ObjDEVIS>(DevisProcedures.DEVIS_DEVIS_RETOURNEByIdEtapeDevis(idEtapeDevis))); } catch (Exception ex) { throw ex; } }
/* * public static List<ObjTRAVAUXDEVIS> Fill(IDataReader reader, List<ObjTRAVAUXDEVIS> rows, int start, int pageLength) * { * // advance to the starting row * for (int i = 0; i < start; i++) * { * if (!reader.Read()) * return rows; // not enough rows, just return * } * * for (int i = 0; i < pageLength; i++) * { * if (!reader.Read()) * break; // we are done * * ObjTRAVAUXDEVIS c = new ObjTRAVAUXDEVIS(); * c.NumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.OriginalNumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.Ordre = (Convert.IsDBNull(reader["Ordre"])) ? (byte)0 : (System.Byte)reader["Ordre"]; * c.OriginalOrdre = (Convert.IsDBNull(reader["Ordre"])) ? (byte)0 : (System.Byte)reader["Ordre"]; * c.MatriculeChefEquipe = (Convert.IsDBNull(reader["MatriculeChefEquipe"])) ? string.Empty : (System.String)reader["MatriculeChefEquipe"]; * c.NomChefEquipe = (Convert.IsDBNull(reader["NomChefEquipe"])) ? string.Empty : (System.String)reader["NomChefEquipe"]; * c.ProcesVerbal = (Convert.IsDBNull(reader["ProcesVerbal"])) ? null : (System.String)reader["ProcesVerbal"]; * if (Convert.IsDBNull(reader["MontantRegle"])) * c.MontantRegle = null; * else * c.MontantRegle = (System.Single)reader["MontantRegle"]; * if (Convert.IsDBNull(reader["MontantRemboursement"])) * c.MontantRemboursement = null; * else * c.MontantRemboursement = (System.Single)reader["MontantRemboursement"]; * if (Convert.IsDBNull(reader["IdPrestataire"])) * c.IdPrestataire = null; * else * c.IdPrestataire = (System.Byte)reader["IdPrestataire"]; * c.DatePrevisionnelle = (Convert.IsDBNull(reader["DatePrevisionnelle"])) ? DateTime.MinValue : (System.DateTime)reader["DatePrevisionnelle"]; * if (Convert.IsDBNull(reader["DateDebutTrvx"])) * c.DateDebutTrvx = null; * else * c.DateDebutTrvx = (System.DateTime)reader["DateDebutTrvx"]; * if (Convert.IsDBNull(reader["DateFinTrvx"])) * c.DateFinTrvx = null; * else * c.DateFinTrvx = (System.DateTime)reader["DateFinTrvx"]; * c.MatriculeReglement = (Convert.IsDBNull(reader["MatriculeReglement"])) ? null : (System.String)reader["MatriculeReglement"]; * if (Convert.IsDBNull(reader["DateReglement"])) * c.DateReglement = null; * else * c.DateReglement = (System.DateTime)reader["DateReglement"]; * c.IsUsedForBilan = (Convert.IsDBNull(reader["IsUsedForBilan"])) ? false : (System.Boolean)reader["IsUsedForBilan"]; * rows.Add(c); * } * return rows; * } * * public static ObjTRAVAUXDEVIS SelectTravaux(string numDevis, byte Ordre) * { * ObjTRAVAUXDEVIS row = new ObjTRAVAUXDEVIS(); * SqlCommand command = null; * SqlConnection connection = null; * try * { * string connectString = Session.GetSqlConnexionString(); * connection = new SqlConnection(connectString); * command = new SqlCommand("SPX_DEVIS_TRAVAUXDEVIS_RETOURNEByNumDevisOrdre", connection); * command.CommandType = CommandType.StoredProcedure; * * command.Parameters.AddWithValue("@NumDevis", numDevis); * command.Parameters.AddWithValue("@Ordre", Ordre); * * if(connection.State == ConnectionState.Closed) * connection.Open(); * * //Object datareader * SqlDataReader reader = command.ExecuteReader(); * * List<ObjTRAVAUXDEVIS> tmp = new List<ObjTRAVAUXDEVIS>(); * Fill(reader, tmp, 0, int.MaxValue); * reader.Close(); * * if (tmp.Count == 1) * { * row = tmp[0]; * } * else if (tmp.Count == 0) * { * row = null; * } * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * finally * { * //Fermeture base * if (connection.State == ConnectionState.Open) * connection.Close(); * if (connection != null) connection.Dispose(); * if (command !=null) command.Dispose(); * } * return row; * } * * public static void InsertTravaux(SqlCommand command, ObjTRAVAUXDEVIS travaux) * { * command.CommandText = "SPX_DEVIS_TRAVAUXDEVIS_INSERER"; * command.CommandType = CommandType.StoredProcedure; * * command.Parameters.Clear(); * * command.Parameters.AddWithValue("@NumDevis", travaux.NumDevis); * command.Parameters.AddWithValue("@Ordre", travaux.Ordre); * command.Parameters.AddWithValue("@MatriculeChefEquipe", travaux.MatriculeChefEquipe); * command.Parameters.AddWithValue("@NomChefEquipe", travaux.NomChefEquipe); * command.Parameters.AddWithValue("@ProcesVerbal", travaux.ProcesVerbal); * command.Parameters.AddWithValue("@MontantRegle", travaux.MontantRegle); * command.Parameters.AddWithValue("@MontantRemboursement", travaux.MontantRemboursement); * command.Parameters.AddWithValue("@IdPrestataire", travaux.IdPrestataire); * command.Parameters.AddWithValue("@DatePrevisionnelle", travaux.DatePrevisionnelle); * command.Parameters.AddWithValue("@DateDebutTrvx", travaux.DateDebutTrvx); * command.Parameters.AddWithValue("@DateFinTrvx", travaux.DateFinTrvx); * command.Parameters.AddWithValue("@MatriculeReglement", travaux.MatriculeReglement); * command.Parameters.AddWithValue("@DateReglement", travaux.DateReglement); * command.Parameters.AddWithValue("@IsUsedForBilan", travaux.IsUsedForBilan); * * DBService.SetDBNullParametre(command.Parameters); * * command.ExecuteNonQuery(); * travaux.OriginalNumDevis = travaux.NumDevis; * travaux.OriginalOrdre = travaux.Ordre; * } * * public static void UpdateTravaux(SqlCommand command, ObjTRAVAUXDEVIS travaux) * { */ public static ObjTRAVAUXDEVIS SelectTravaux(int pDevisId, int Ordre) { try { return(Entities.GetEntityFromQuery <ObjTRAVAUXDEVIS>(DevisProcedures.DEVIS_TRAVAUXDEVIS_RETOURNEByDevisIdOrdre(pDevisId, Ordre))); } catch (Exception ex) { throw ex; } }
public static List <ObjDEVIS> GetByCodeAppareilFromAPPAREILSDEVIS(Int32 pCodeAppareil) { try { return(Entities.GetEntityListFromQuery <ObjDEVIS>(DevisProcedures.DEVIS_DEVIS_RETOURNEByCodeAppareilFromAPPAREILSDEVIS(pCodeAppareil))); } catch (Exception ex) { throw ex; } }
/* * public static List<ObjAPPAREILSDEVIS> Fill(IDataReader reader, List<ObjAPPAREILSDEVIS> rows, int start, int pageLength) * { * // advance to the starting row * for (int i = 0; i < start; i++) * { * if (!reader.Read()) * return rows; // not enough rows, just return * } * * for (int i = 0; i < pageLength; i++) * { * if (!reader.Read()) * break; // we are done * * ObjAPPAREILSDEVIS c = new ObjAPPAREILSDEVIS(); * c.NumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.OriginalNumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.CodeAppareil = (Convert.IsDBNull(reader["CodeAppareil"])) ? (int)0 : (System.Int32)reader["CodeAppareil"]; * c.OriginalCodeAppareil = (Convert.IsDBNull(reader["CodeAppareil"])) ? (int)0 : (System.Int32)reader["CodeAppareil"]; * if (Convert.IsDBNull(reader["Nbre"])) * c.Nbre = null; * else * c.Nbre = (System.Int32)reader["Nbre"]; * if (Convert.IsDBNull(reader["Puissance"])) * c.Puissance = null; * else * c.Puissance = (System.Int32)reader["Puissance"]; * rows.Add(c); * } * return rows; * } * * public static List<ObjAPPAREILSDEVIS> FillForDevis(IDataReader reader, List<ObjAPPAREILSDEVIS> rows, int start, int pageLength) * { * // advance to the starting row * for (int i = 0; i < start; i++) * { * if (!reader.Read()) * return rows; // not enough rows, just return * } * * for (int i = 0; i < pageLength; i++) * { * if (!reader.Read()) * break; // we are done * * ObjAPPAREILSDEVIS c = new ObjAPPAREILSDEVIS(); * c.NumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.OriginalNumDevis = (Convert.IsDBNull(reader["NumDevis"])) ? string.Empty : (System.String)reader["NumDevis"]; * c.CodeAppareil = (Convert.IsDBNull(reader["CodeAppareil"])) ? (int)0 : (System.Int32)reader["CodeAppareil"]; * c.OriginalCodeAppareil = (Convert.IsDBNull(reader["CodeAppareil"])) ? (int)0 : (System.Int32)reader["CodeAppareil"]; * if (Convert.IsDBNull(reader["Nbre"])) * c.Nbre = null; * else * c.Nbre = (System.Int32)reader["Nbre"]; * if (Convert.IsDBNull(reader["Puissance"])) * c.Puissance = null; * else * c.Puissance = (System.Int32)reader["Puissance"]; * c.Designation = (Convert.IsDBNull(reader["Designation"])) ? string.Empty : (System.String)reader["Designation"]; * * rows.Add(c); * } * return rows; * } * * public static List<ObjAPPAREILSDEVIS> GetByNumDevis(System.String numDevis) * { * SqlConnection connection = new SqlConnection(Session.GetSqlConnexionString()); * SqlCommand command = new SqlCommand("SPX_DEVIS_APPAREILSDEVIS_RETOURNEByNumDevis", connection); * command.CommandType = CommandType.StoredProcedure; * command.Parameters.Add("@NumDevis", SqlDbType.VarChar, 8).Value = numDevis; * * try * { * //Ouverture * if (connection.State == ConnectionState.Closed) * connection.Open(); * * //Object datareader * SqlDataReader reader = command.ExecuteReader(); * * List<ObjAPPAREILSDEVIS> rows = new List<ObjAPPAREILSDEVIS>(); * FillForDevis(reader, rows, 0, int.MaxValue); * reader.Close(); * return rows; * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * } * } * * public static List<ObjAPPAREILSDEVIS> GetByAll() * { * SqlConnection connection = new SqlConnection(Session.GetSqlConnexionString()); * SqlCommand command = new SqlCommand("SPX_DEVIS_APPAREILSDEVIS_RETOURNE", connection); * command.CommandType = CommandType.StoredProcedure; * * try * { * //Ouverture * if (connection.State == ConnectionState.Closed) * connection.Open(); * * //Object datareader * SqlDataReader reader = command.ExecuteReader(); * * List<ObjAPPAREILSDEVIS> rows = new List<ObjAPPAREILSDEVIS>(); * Fill(reader, rows, 0, int.MaxValue); * reader.Close(); * return rows; * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * } * } * * public bool Delete(ObjAPPAREILSDEVIS entity) * { * SqlConnection connection = new SqlConnection(Session.GetSqlConnexionString()); * //Fin jab * SqlCommand command = new SqlCommand("SPX_DEVIS_APPAREILSDEVIS_SUPPRIMER", connection); * command.CommandType = CommandType.StoredProcedure; * * int rowsAffected = -1; * * command.Parameters.Add("@NumDevis", SqlDbType.VarChar, 8).Value = entity.NumDevis; * command.Parameters.Add("@CodeAppareil", SqlDbType.Int).Value = entity.CodeAppareil; * * if (command.Connection.State == ConnectionState.Closed) * command.Connection.Open(); * try * { * * rowsAffected = command.ExecuteNonQuery(); * if (rowsAffected == 0) * { * //throw new DataException("The record has been already deleted."); * return false; * } * return Convert.ToBoolean(rowsAffected); * } * catch (Exception ex) * { * throw ex; * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * } * } * * public int Delete(List<ObjAPPAREILSDEVIS> entityCollection) * { * int number = 0; * foreach (ObjAPPAREILSDEVIS entity in entityCollection) * { * if (Delete(entity)) * { * number++; * } * } * return number; * } * * public static bool Insert(ObjAPPAREILSDEVIS entity) * { * SqlConnection connection = new SqlConnection(Session.GetSqlConnexionString()); * SqlCommand command = new SqlCommand("SPX_DEVIS_APPAREILSDEVIS_INSERER", connection); * command.CommandType = CommandType.StoredProcedure; * * int rowsAffected = -1; * * command.Parameters.Add("@NumDevis", SqlDbType.VarChar, 8).Value = entity.NumDevis; * command.Parameters.Add("@CodeAppareil", SqlDbType.Int).Value = entity.CodeAppareil; * command.Parameters.Add("@Nbre", SqlDbType.Int).Value = entity.Nbre; * command.Parameters.Add("@Puissance", SqlDbType.Int).Value = entity.Puissance; * * if (command.Connection.State == ConnectionState.Closed) * command.Connection.Open(); * * try * { * * SetDBNullParametre(command.Parameters); * rowsAffected = command.ExecuteNonQuery(); * * return Convert.ToBoolean(rowsAffected); * } * catch (Exception ex) * { * throw ex; * } * finally * { * if (connection.State == ConnectionState.Open) * connection.Close(); * command.Dispose(); * connection.Dispose(); * } * } * * public static bool Insert(List<ObjAPPAREILSDEVIS> entityCollection) * { * int number = 0; * foreach (ObjAPPAREILSDEVIS entity in entityCollection) * { * if (entity.Nbre == null && (entity.Nbre != 0)) * { * if (Insert(entity)) * { * number++; * } * } * } * return number > 0; * } * * public static bool Insert(ObjAPPAREILSDEVIS entity, SqlCommand pCommand) * { * int rowsAffected = -1; * try * { * pCommand.Parameters.Clear(); * pCommand.CommandText = ".SPX_DEVIS_APPAREILSDEVIS_INSERER"; * pCommand.CommandType = CommandType.StoredProcedure; * * pCommand.Parameters.Add("@NumDevis", SqlDbType.VarChar, 8).Value = entity.NumDevis; * pCommand.Parameters.Add("@CodeAppareil", SqlDbType.Int).Value = entity.CodeAppareil; * pCommand.Parameters.Add("@Nbre", SqlDbType.Int).Value = entity.Nbre; * pCommand.Parameters.Add("@Puissance", SqlDbType.Int).Value = entity.Puissance; * * if (pCommand.Connection.State == ConnectionState.Closed) * pCommand.Connection.Open(); * * SetDBNullParametre(pCommand.Parameters); * rowsAffected = pCommand.ExecuteNonQuery(); * } * catch (Exception ex) * { * throw ex; * } * return Convert.ToBoolean(rowsAffected); * } * * public static bool Delete(string pIdDevis, SqlCommand pCommand) * { * int rowsAffected = -1; * try * { * pCommand.Parameters.Clear(); * pCommand.CommandText = "SPX_DEVIS_APPAREILSDEVIS_SUPPRIMER"; * pCommand.CommandType = CommandType.StoredProcedure; * SqlParameter param = pCommand.Parameters.Add(new SqlParameter("@NumDevis", pNumDevis)); * param.Direction = ParameterDirection.Input; * * //Object datareader * rowsAffected = pCommand.ExecuteNonQuery(); * * return Convert.ToBoolean(rowsAffected); * } * catch (Exception ex) * { * throw new Exception(ex.Message); * } * } * * public static bool Insert(List<ObjAPPAREILSDEVIS> entityCollection, SqlCommand pCommand) * { * int number = 0; * foreach (ObjAPPAREILSDEVIS entity in entityCollection) * { * if (Insert(entity, pCommand)) * { * number++; * } * } * return number != 0; * } */ public static List <ObjAPPAREILSDEVIS> GetByNumDevis(int pIdDevis) { try { return(Entities.GetEntityListFromQuery <ObjAPPAREILSDEVIS>(DevisProcedures.DEVIS_APPAREILSDEVIS_RETOURNEByDevisId(pIdDevis))); } catch (Exception ex) { throw ex; } }
public static ObjDEVIS GetByIdDevis(int pIdDevis) { try { return(Entities.GetEntityFromQuery <ObjDEVIS>(DevisProcedures.DEVIS_DEVIS_RETOURNEById(pIdDevis))); } catch (Exception ex) { throw ex; } }
public List <CsPuissance> GetPuissanceParProduitId(int pProduitId) { try { return(Entities.GetEntityListFromQuery <CsPuissance>(DevisProcedures.DEVIS_PUISSANCE_GetByProduitId(pProduitId))); } catch (Exception ex) { throw ex; } }