static public void DeleteGrupaMunca(int GrupaMuncaID) { string connStr = Salaries.Configuration.ModuleConfig.GetSettings().ConnectionString; SqlConnection m_con = new SqlConnection(connStr); SqlCommand myCommand = new SqlCommand("InsertUpdateDeleteGrupaMunca", m_con); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add(UtilitiesDb.AddInputParameter("@tip_actiune", SqlDbType.Int, 4, 2)); myCommand.Parameters.Add(UtilitiesDb.AddInputParameter("@GrupaMuncaID", SqlDbType.Int, 4, GrupaMuncaID)); myCommand.Parameters.Add(UtilitiesDb.AddInputParameter("@Nume", SqlDbType.NVarChar, 50, "")); myCommand.Parameters.Add(UtilitiesDb.AddInputParameter("@Descriere", SqlDbType.NVarChar, 255, "")); SqlDataAdapter dAdapt = new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); dAdapt.Fill(ds); }
/// <summary> /// Procedura verifica daca mai exista in baza de date o grupa de munca cu acelasi nume /// </summary> /// <param name="grupaMuncaID">Id-ul grupei de munca care nu se testeaza</param> /// <param name="nume">Numele grupei care nu trebuie sa coincida</param> /// <returns>Returneaza true daca se poate face actualizarea si false altfel</returns> static public bool CheckIfGrupaMuncaCanBeAdded(int grupaMuncaID, string nume) { string connStr = Salaries.Configuration.ModuleConfig.GetSettings().ConnectionString; SqlConnection m_con = new SqlConnection(connStr); SqlCommand myCommand = new SqlCommand("spCheckIfGrupaMuncaCanBeAdded", m_con); myCommand.Parameters.Add(UtilitiesDb.AddInputParameter("@Nume", SqlDbType.NVarChar, 50, nume)); myCommand.Parameters.Add(UtilitiesDb.AddInputParameter("@GrupaMuncaID", SqlDbType.Int, 4, grupaMuncaID)); myCommand.Parameters.Add(UtilitiesDb.AddOutputParameter("@NrGrupe", SqlDbType.Int, 4)); myCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter dAdapt = new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); dAdapt.Fill(ds); return(byte.Parse(myCommand.Parameters[2].Value.ToString()) == 0); }