Пример #1
0
    public int UpdatePayScale(PayScaleBO ps)
    {
        SQLHelper helper = SQLHelper.GetInstance(this.connectionString);
        int       numberOfRowImpacted = 0;

        try
        {
            helper.OpenConnection();
            //query to add new earning
            query = @"UPDATE [dbo].[PayScaleMaster]
                       SET " +
                    "[EffectiveMonthYear] = '" + ps.EffectiveMonthYear + "'" +
                    " [EmpGroup] = '" + ps.EmpGroup + "'" +
                    " [PayBandNumber] = '" + ps.PayBandNumber + "'" +
                    " [StartPay] = '" + ps.StartPay + "'" +
                    " [EndPay] = '" + ps.EndPay + "'" +
                    " [GradePay] = '" + ps.GradePay + "'" +
                    " [SpecialPay] = '" + ps.SpecialPay + "'" +
                    " WHERE[ScaleCD] LIKE '" + ps.ScaleCD + "'";

            numberOfRowImpacted = helper.ExecuteNonQuery(query);
        }
        catch (Exception ex)
        {
            numberOfRowImpacted = -1;
            Console.WriteLine(ex.Message);
            dbErrMsg = ex.Message;
        }
        finally
        {
            helper.CloseConnection();
        }

        return(numberOfRowImpacted);
    }
Пример #2
0
    public int AddPayScale(PayScaleBO ps)
    {
        SQLHelper helper = SQLHelper.GetInstance(this.connectionString);
        int       numberOfRowImpacted = 0;

        try
        {
            helper.OpenConnection();
            //query to add new earning
            query = @"INSERT INTO [dbo].[PayScaleMaster]
                        ([ScaleCD]
                        ,[EffectiveMonthYear]
                        ,[EmpGroup]
                        ,[PayBandNumber]
                        ,[StartPay]
                        ,[EndPay]
                        ,[GradePay]
                        ,[SpecialPay])
                     VALUES
                           (   " +
                    "SELECT CAST((SELECT TOP 1 ps.[ScaleCD] FROM [dbo].[PayScaleMaster] as ps ORDER BY CAST(ps.[ScaleCD] as int) DESC)+1 as varchar)," +
                    "'" + ps.EffectiveMonthYear + "'," +
                    "'" + ps.EmpGroup + "'," +
                    "'" + ps.PayBandNumber + "'," +
                    "'" + ps.StartPay + "'," +
                    "'" + ps.EndPay + "'," +
                    "'" + ps.GradePay + "'," +
                    "'" + ps.SpecialPay + "',";


            numberOfRowImpacted = helper.ExecuteNonQuery(query);
        }
        catch (Exception ex)
        {
            numberOfRowImpacted = -1;
            Console.WriteLine(ex.Message);
            dbErrMsg = ex.Message;
        }
        finally
        {
            helper.CloseConnection();
        }

        return(numberOfRowImpacted);
    }