public static BColectieClientiComenziEtape GetListaVenituriDetaliat(int pIdTehnician, DateTime pDataInceput, DateTime pDataSfarsit, IDbTransaction pTranzactie) { BColectieClientiComenziEtape lstDClientiComenziEtape = new BColectieClientiComenziEtape(); using (DataSet ds = DClientiComenziEtape.GetListaDetaliatVenituri(pIdTehnician, pDataInceput, pDataSfarsit, pTranzactie)) { foreach (DataRow dr in ds.Tables[0].Rows) { lstDClientiComenziEtape.Add(new BClientiComenziEtape(dr)); } } return(lstDClientiComenziEtape); }
public static List <int> GetIdListByParamIdComandaClient(int pIdComandaClient, CDefinitiiComune.EnumStare pStare, IDbTransaction pTranzactie) { List <int> lstDClientiComenziEtape = new List <int>(); using (DataSet ds = DClientiComenziEtape.GetListByParamIdComandaClient(pIdComandaClient, pStare, pTranzactie)) { foreach (DataRow dr in ds.Tables[0].Rows) { lstDClientiComenziEtape.Add(new BClientiComenziEtape(dr).Id); } } return(lstDClientiComenziEtape); }
public static BColectieClientiComenziEtape GetListByTehnicianSiLucrareIntrePerioada(int pIdTehnician, int pIdLucrare, DateTime pDataInceput, DateTime pDataSfarsit, BComportamentAplicatie.Enum_TablouDeBord_DataInteres pDataInteres, IDbTransaction pTranzactie) { BColectieClientiComenziEtape lstDClientiComenziEtape = new BColectieClientiComenziEtape(); using (DataSet ds = DClientiComenziEtape.GetListByTehnicianSiLucrareIntrePerioada(pIdTehnician, pIdLucrare, pDataInceput, pDataSfarsit, getDataInteres(pDataInteres), pTranzactie)) { foreach (DataRow dr in ds.Tables[0].Rows) { lstDClientiComenziEtape.Add(new BClientiComenziEtape(dr)); } } return(lstDClientiComenziEtape); }
public static BColectieClientiComenziEtape GetListByIdComanda(int pIdComanda, CDefinitiiComune.EnumStare pStare, IDbTransaction pTranzactie) { BColectieClientiComenziEtape lstDClientiComenziEtape = new BColectieClientiComenziEtape(); using (DataSet ds = DClientiComenziEtape.GetListByParamIdComandaClient(pIdComanda, pStare, pTranzactie)) { foreach (DataRow dr in ds.Tables[0].Rows) { lstDClientiComenziEtape.Add(new BClientiComenziEtape(dr)); } } return(lstDClientiComenziEtape); }
public static BColectieClientiComenziEtape getByListaId(List <int> pListaId, IDbTransaction pTranzactie) { BColectieClientiComenziEtape listaRetur = new BColectieClientiComenziEtape(); if (!CUtil.EsteListaIntVida(pListaId)) { using (DataSet ds = DClientiComenziEtape.GetByListId(pListaId, pTranzactie)) { foreach (DataRow dr in ds.Tables[0].Rows) { listaRetur.Add(new BClientiComenziEtape(dr)); } } } return(listaRetur); }
/// <summary> /// Metoda de clasa pentru obtinerea DataRow-ului corespunzator obiectului in baza de date /// </summary> /// <param name="pId"></param> /// <returns>Un DataRow ce contine informatiile corespunzatoare obiectului</returns> /// <remarks></remarks> private static DataRow GetDataRowForObjet(int pId, IDbTransaction pTranzactie) { if (pId <= 0) { throw new IdentificareBazaImposibilaException("BClientiComenziEtape"); } using (DataSet ds = DClientiComenziEtape.GetById(pId, pTranzactie)) { if (ds.Tables[0].Rows.Count > 0) { return(ds.Tables[0].Rows[0]); } else { throw new IdentificareBazaImposibilaException("BClientiComenziEtape"); } } }
/// <summary> /// Metoda de instanta ce permite actualizarea informatiilor din baza de date pentru a fi conforme cu informatiile actuale ale obiectului /// </summary> /// <param name="pTranzactie">Tranzactia</param> /// <returns>True daca inregistrarea a fost modificata; False in caz contrar</returns> /// <remarks>Exceptie daca nu avem initializate proprietatile ce permit identificarea obiectului in baza</remarks> public override bool UpdateAll(IDbTransaction pTranzactie) { if (!this.ExistaProprietatiModificate()) { return(true); } IDbTransaction Tranzactie = null; try { if (pTranzactie == null) { Tranzactie = CCerereSQL.GetTransactionOnConnection(); } else { Tranzactie = pTranzactie; } //Facem actualizarea in baza bool succesModificare = DClientiComenziEtape.UpdateById(getDictProprietatiModificate(), this.Id, Tranzactie); if (pTranzactie == null) { //Facem Comit tranzactiei doar daca aceasta nu a fost transmisa in parametru. Altfel comitul va fi gestionat de functia apelanta CCerereSQL.CloseTransactionOnConnection(Tranzactie, true); } return(succesModificare); } catch (Exception) { if ((pTranzactie == null) && (Tranzactie != null)) { CCerereSQL.CloseTransactionOnConnection(Tranzactie, false); } throw; } finally { //Reinitializam obiectul pentru a recupera, printre altele, data de actualizare generata de baza de date this.Refresh(pTranzactie); } }
public static Dictionary <int, Tuple <double, double> > GetListaVenituri(DateTime pDataInceput, DateTime pDataSfarsit, IDbTransaction pTranzactie) { Dictionary <int, Tuple <double, double> > listaRetur = new Dictionary <int, Tuple <double, double> >(); using (DataSet ds = DClientiComenziEtape.GetListaVenituri(pDataInceput, pDataSfarsit, pTranzactie)) { int idUtilizator = 0; double nrElemente = 0; double totalCuvenit = 0; foreach (DataRow dr in ds.Tables[0].Rows) { idUtilizator = CUtil.GetAsInt32(dr[DClientiComenziEtape.EnumCampuriRezumat.xnIdTehnician.ToString()]); nrElemente = CUtil.GetAsDouble(dr[DClientiComenziEtape.EnumCampuriRezumat.NrElemente.ToString()]); totalCuvenit = CUtil.GetAsDouble(dr[DClientiComenziEtape.EnumCampuriRezumat.TotalCuvenit.ToString()]); listaRetur.Add(idUtilizator, new Tuple <double, double>(nrElemente, totalCuvenit)); } } return(listaRetur); }
/// <summary> /// Metoda de instanta ce permite inchiderea(dezactivarea) obiectului /// </summary> /// <param name="pInchidere">inchidem sau activam?</param> /// <param name="pMotivInchidere">Motivul inchiderii</param> /// <param name="pTranzactie">Tranzactia</param> /// <remarks>Exceptie daca nu se poate identifica obiectul</remarks> public void Close(bool pInchidere, string pMotivInchidere, IDbTransaction pTranzactie) { if (this.Id <= 0) { throw new IdentificareBazaImposibilaException("BClientiComenziEtape"); } IDbTransaction Tranzactie = null; try { if (pTranzactie == null) { Tranzactie = CCerereSQL.GetTransactionOnConnection(); } else { Tranzactie = pTranzactie; } //Inchidem obiectul in baza de date DClientiComenziEtape.CloseById(BUtilizator.GetIdUtilizatorConectat(Tranzactie), this.Id, pInchidere, pMotivInchidere, Tranzactie); if (pTranzactie == null) { //Facem Comit tranzactiei doar daca aceasta nu a fost transmisa in parametru. Altfel comitul va fi gestionat de functia apelanta CCerereSQL.CloseTransactionOnConnection(Tranzactie, true); } } catch (Exception) { if ((pTranzactie == null) && (Tranzactie != null)) { CCerereSQL.CloseTransactionOnConnection(Tranzactie, false); } throw; } finally { //Reinitializam obiectul pentru a recupera, printre altele, data de inchidere generata de baza de date this.Refresh(pTranzactie); } }
/// <summary> /// Metoda de clasa ce permite adaugarea unui obiect de tip DClientiComenziEtape /// </summary> /// <param name="pIdComandaClient"></param> /// <param name="pIdEtapa"></param> /// <param name="pDataInceput"></param> /// <param name="pDataFinal"></param> /// <param name="pIdTehnician"></param> /// <param name="pObservatii"></param> /// <param name="pStatus"></param> /// <param name="pRefacere"></param> /// <returns></returns> /// <remarks></remarks> public static int Add(int pIdComandaClient, int pIdEtapa, DateTime pDataInceput, DateTime pDataFinal, int pIdTehnician, string pObservatii, int pStatus, bool pRefacere, IDbTransaction pTranzactie) { int id = DClientiComenziEtape.Add(BUtilizator.GetIdUtilizatorConectat(pTranzactie), pIdComandaClient, pIdEtapa, pDataInceput, pDataFinal, pIdTehnician, pObservatii, pStatus, pRefacere, pTranzactie); return(id); }