public int ChangeConsignmentName(NewConsignmentName ncn)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand    command    = new SqlCommand("usp_changeConsignmentName");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@ConsignmentID", ncn.ConsignmentID));
            command.Parameters.Add(new SqlParameter("@NewName", ncn.NewConsignmentNameString));
            command.Connection = connection;

            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter(command);
            DataTable      table   = new DataTable();

            adapter.Fill(table);
            connection.Close();

            if (table.Rows[0][0].ToString() == ncn.NewConsignmentNameString)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 2
0
        public void ChangeConsignmentNameTest()
        {
            NewConsignmentName ncn = new NewConsignmentName();

            ncn.ConsignmentID            = GetConsignmentID();
            ncn.NewConsignmentNameString = "TESTCONSIGNMENT2";

            int result = controller.ChangeConsignmentName(ncn);

            Assert.AreEqual(result, 1);
        }