Esempio n. 1
0
    public DataTable getSIGSearch(SIGCodes sigInfo)
    {
        SqlConnection con = new SqlConnection(ConStr);
        DataTable dtable = new DataTable();
        try
        {
            SqlCommand sqlCmd = new SqlCommand("select * from SIG_Codes where SIG_Code = '" + sigInfo.SIGCode + "'", con);
            SqlDataReader sqlDr;

            // DataRow dr;
            con.Open();
            sqlDr = sqlCmd.ExecuteReader();
            dtable.Load(sqlDr);

        }

        catch (Exception ex)
        {
            throw new Exception("**Problem occurred with Searching SIGCode", ex);
        }
        finally
        {
            con.Close();

        }
        return dtable;
    }
Esempio n. 2
0
    public string Delete_SIGCodes(SIGCodes sig,string userID)
    {
        string msg = string.Empty;

        SqlConnection con = new SqlConnection(ConStr);
        try
        {

            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = con;
            sqlCmd.CommandText = "sp_delete_SIGCodes";
            sqlCmd.CommandType = CommandType.StoredProcedure;
            SqlParameter pSIG_ID = sqlCmd.Parameters.Add("@SIGID", SqlDbType.Int);
            pSIG_ID.Value = sig.SIG_ID;

            SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
            pUserID.Value = userID;

            con.Open();
            sqlCmd.ExecuteNonQuery();
            msg = "SIG Code Deleted Successfully...";

        }
        catch (SqlException SqlEx)
        {
            objNLog.Error("SQLException : " + SqlEx.Message);
            throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Inserting SIG Code.", SqlEx);
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
            throw new Exception("**Problem occured with Deleting SIG Code", ex);
        }
        finally
        {
            con.Close();
        }
        return msg;
    }
Esempio n. 3
0
    public string Ins_SIGCodes(SIGCodes sig,string userID)
    {
        string msg = string.Empty;
        SqlConnection con = new SqlConnection(ConStr);
        try
        {
            SqlCommand sqlCmd = new SqlCommand();
            sqlCmd.Connection = con;

            sqlCmd.CommandText = "sp_set_SIGCodes";
            sqlCmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pSIGCode = sqlCmd.Parameters.Add("@SIGCode", SqlDbType.VarChar, 10);
            pSIGCode.Value = sig.SIGCode;

            SqlParameter pSIGName = sqlCmd.Parameters.Add("@SIGName", SqlDbType.VarChar, 50);
            pSIGName.Value = sig.SIGName;

            SqlParameter pSIGFactor = sqlCmd.Parameters.Add("@SIGFactor", SqlDbType.Float);
            if (sig.SIGFactor != "")
                pSIGFactor.Value = float.Parse(sig.SIGFactor);
            else
                pSIGFactor.Value = Convert.DBNull;

            SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
            pUserID.Value = userID;

            con.Open();
            sqlCmd.ExecuteNonQuery();
            msg = "SIG Code Inserted Successfully...";

        }
        catch (SqlException SqlEx)
        {
            objNLog.Error("SQLException : " + SqlEx.Message);
            throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Inserting SIG Code.", SqlEx);
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
            throw new Exception("**Error occured while Inserting SIG Code.", ex);
        }
        finally
        {
            con.Close();

        }

        return msg;
    }