Example #1
0
        public int AddConsignment(ConsignmentInformation info)
        {
            SqlConnection connection = new SqlConnection(Connection.connectionString());
            SqlCommand    command    = new SqlCommand("usp_addConsignment");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@SKUMin", info.SKUMin));
            command.Parameters.Add(new SqlParameter("@SKUMax", info.SKUMax));
            command.Parameters.Add(new SqlParameter("@ConsignmentName", info.ConsignmentName));
            command.Parameters.Add(new SqlParameter("@Total", info.Total));
            command.Parameters.Add(new SqlParameter("@IsTest", info.IsTest));
            command.Connection = connection;

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

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

            if (table.Rows.Count > 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Example #2
0
        public void AddConsignmentTest()
        {
            ConsignmentInformation info = new ConsignmentInformation();

            info.SKUMin          = "0";
            info.SKUMax          = "0";
            info.ConsignmentName = "TESTCONSIGNMENT";
            info.Total           = "0";
            info.IsTest          = 1;

            int result = controller.AddConsignment(info);

            Assert.AreEqual(result, 1);
        }