示例#1
0
 /// <summary>
 /// Procedura selecteaza detaliile tipurilor de absente
 /// </summary>
 /// <returns>Returneaza un DataSet care contine aceste date</returns>
 public TipAbsente[] GetDetaliiTipuriAbsente()
 {
     try
     {
         DataSet ds = RunProcedure("tm_GetTipuriAbsente", new SqlParameter[0], "TipuriAbsente");
         using ( ds )
         {
             TipAbsente [] tipAbs = new TipAbsente[ds.Tables["TipuriAbsente"].Rows.Count];
             int           i      = -1;
             foreach (DataRow dr in ds.Tables["TipuriAbsente"].Rows)
             {
                 i++;
                 tipAbs[i].TipAbsentaID = int.Parse(dr["TipAbsentaID"].ToString());
                 tipAbs[i].Denumire     = dr["Denumire"].ToString();
                 tipAbs[i].Procent      = float.Parse(dr["Procent"].ToString());
                 tipAbs[i].Descriere    = dr["Descriere"].ToString();
                 tipAbs[i].Medical      = (bool)dr["Medical"];
                 tipAbs[i].CodAbsenta   = dr["CodAbsenta"].ToString();
                 tipAbs[i].Modificare   = (bool)dr["Modificare"];
                 tipAbs[i].Folosire     = (bool)dr["Folosire"];
                 tipAbs[i].Lucratoare   = (bool)dr["Lucratoare"];
             }
             return(tipAbs);
         }
     }
     catch
     {
         TipAbsente [] tAbs = new TipAbsente[1];
         tAbs[0].TipAbsentaID = -1;
         return(tAbs);
     }
 }
示例#2
0
        /// <summary>
        /// Procedura selecteaza detaliile unui tip de absenta
        /// </summary>
        /// <param name="tipAbsentaID">Id-ul tipului de absenta selectat</param>
        /// <returns>Returneaza un obiect care contine aceste date</returns>
        public TipAbsente GetDetaliiTipuriAbsente(int tipAbsentaID)
        {
            try
            {
                SqlParameter [] parameters =
                {
                    new SqlParameter("@TipAbsentaID", SqlDbType.Int, 4)
                };

                parameters[0].Value = tipAbsentaID;
                DataSet ds = RunProcedure("tm_GetTipIntervalAbsenta", parameters, "TipuriAbsente");

                using ( ds )
                {
                    TipAbsente tipAbs = new TipAbsente();

                    DataRow dr = ds.Tables["TipuriAbsente"].Rows[0];

                    tipAbs.TipAbsentaID = int.Parse(dr["TipAbsentaID"].ToString());
                    tipAbs.Denumire     = dr["Denumire"].ToString();
                    tipAbs.Procent      = float.Parse(dr["Procent"].ToString());
                    tipAbs.Descriere    = dr["Descriere"].ToString();
                    tipAbs.Medical      = (bool)dr["Medical"];
                    tipAbs.CodAbsenta   = dr["CodAbsenta"].ToString();
                    tipAbs.Modificare   = (bool)dr["Modificare"];
                    tipAbs.Folosire     = (bool)dr["Folosire"];
                    tipAbs.Lucratoare   = (bool)dr["Lucratoare"];

                    return(tipAbs);
                }
            }
            catch
            {
                TipAbsente tAbs = new TipAbsente();
                tAbs.TipAbsentaID = -1;
                return(tAbs);
            }
        }
示例#3
0
 /// <summary>
 /// Procedura adauga un tip de absenta
 /// </summary>
 /// <param name="tipAbs">Obiectul care contine datele tipului de absenta</param>
 /// <returns>Returneaza true daca s-a facut adaugarea si false altfel</returns>
 public bool InsertTipAbsente(TipAbsente tipAbs)
 {
     return(this.InsertTipAbsente(tipAbs.Denumire, tipAbs.Procent, tipAbs.Descriere, tipAbs.Medical, tipAbs.CodAbsenta, tipAbs.Modificare, tipAbs.Folosire, tipAbs.Lucratoare));
 }