Beispiel #1
0
        public void Update_Should_not_call_update_When_disabled()
        {
            using World world = new World(3);

            Entity entity1 = world.CreateEntity();

            entity1.Set <bool>();

            Entity entity2 = world.CreateEntity();

            entity2.Set <bool>();

            Entity entity3 = world.CreateEntity();

            entity3.Set <bool>();

            using (ISystem <int> system = new System(world))
            {
                system.IsEnabled = false;
                system.Update(0);
            }

            Check.That(entity1.Get <bool>()).IsFalse();
            Check.That(entity2.Get <bool>()).IsFalse();
            Check.That(entity3.Get <bool>()).IsFalse();
        }
Beispiel #2
0
        public override void Run()
        {
            Channel channel = System.PlaySound(sound, mainGroup, true);

            var channelHead = channel.GetDSP(ChannelControlDSPIndex.DspHead);

            DspConnection reverbConnection = reverbUnit.AddInput(channelHead, DSPConnectionType.Send);

            channel.Paused = false;

            do
            {
                OnUpdate();

                System.Update();

                reverbConnection.Mix = wetVolume;
                mainGroup.Volume     = dryVolume;

                DrawText("==================================================");
                DrawText("Convolution Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2018.");
                DrawText("==================================================");
                DrawText("Press Up and Down arrows to change dry mix");
                DrawText("Press Left and Right Arrows to change wet mix");
                DrawText($"Wet mix: {wetVolume}, Dry mix: {dryVolume}");
                DrawText("Press Esc to Quit.");

                Sleep(50);
            }while (!ShouldEndExample);
        }
Beispiel #3
0
        public override void Run()
        {
            var master = System.MasterChannelGroup;

            master.AddDSP(0, dspLowpass);
            master.AddDSP(0, dspHighpass);
            master.AddDSP(0, dspEcho);
            master.AddDSP(0, dspFlange);

            do
            {
                OnUpdate();

                System.Update();
                FmodBool Paused = true;

                if (channel != null)
                {
                    var res = Fmod.Library.Channel_GetPaused(channel, out Paused);

                    if (res != Result.Ok)
                    {
                        Paused = true;

                        if (res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                        {
                            res.CheckResult();
                        }
                    }
                }

                char lp, hp, e, f;

                lp = dspLowpass.Bypass  ? ' ' : 'x';
                hp = dspHighpass.Bypass ? ' ' : 'x';
                e  = dspEcho.Bypass     ? ' ' : 'x';
                f  = dspFlange.Bypass   ? ' ' : 'x';

                DrawText("==================================================");
                DrawText("Effects Example");
                DrawText("");
                DrawText("==================================================");
                DrawText();
                DrawText("Press Space to toggle pause sound");
                DrawText("Press 1 to toggle dsp Lowpass effect");
                DrawText("Press 2 to toggle dsp Highpass effect");
                DrawText("Press 3 to toggle dsp echo effect");
                DrawText("Press 4 to toggle dsp flange effect");
                DrawText("Press Esc to quit");
                DrawText();
                DrawText($"{(Paused ? "Paused" : "Playing")} : lowpass[{lp}] highpass[{hp}] echo[{e}] flange[{f}]");

                Sleep(50);
            }while (!ShouldEndExample);

            master.RemoveDSP(dspLowpass);
            master.RemoveDSP(dspHighpass);
            master.RemoveDSP(dspEcho);
            master.RemoveDSP(dspFlange);
        }
Beispiel #4
0
        public void Update_with_runner_Should_call_update()
        {
            using DefaultParallelRunner runner = new DefaultParallelRunner(2);
            using World world = new World(3);

            Entity entity1 = world.CreateEntity();

            entity1.Set <bool>();

            Entity entity2 = world.CreateEntity();

            entity2.Set <bool>();

            Entity entity3 = world.CreateEntity();

            entity3.Set <bool>();

            using (ISystem <int> system = new System(world, runner))
            {
                system.Update(0);
            }

            Check.That(entity1.Get <bool>()).IsTrue();
            Check.That(entity2.Get <bool>()).IsTrue();
            Check.That(entity3.Get <bool>()).IsTrue();
        }
Beispiel #5
0
        public GaplessPlaybackExample() : base("Fmod Gapless Playback Example")
        {
            RegisterCommand(ConsoleKey.D1, () => channelGroup.Paused = !channelGroup.Paused);
            RegisterCommand(ConsoleKey.D2, () =>
            {
                float pitch = channelGroup.Pitch;

                for (int i = 0; i < 50; ++i)
                {
                    pitch += 0.01f;
                    channelGroup.Pitch = pitch;
                    System.Update();
                    Sleep(10);
                }
            });

            RegisterCommand(ConsoleKey.D3, () =>
            {
                float pitch = channelGroup.Pitch;

                for (int i = 0; i < 50; ++i)
                {
                    if (pitch <= 0.01f)
                    {
                        break;
                    }

                    pitch -= 0.01f;
                    channelGroup.Pitch = pitch;
                    System.Update();
                    Sleep(10);
                }
            });
        }
Beispiel #6
0
        public override void Run()
        {
            DrawText("==================================================");
            DrawText("Tiny Music Player Example");
            DrawText("");
            DrawText("==================================================");
            DrawText("Press Esc to exit.");
            DrawText("Press Spacebar to toggle pause.");
            DrawText("Up and Down arrow keys for volume control.");
            DrawText();

            DrawText("Now playing " + sound.Name);

            SetConsoleUpdateStart();

            int lenms = (int)sound.GetLength(TimeUnit.MS);

            do
            {
                OnUpdate();
                System.Update();

                DrawTime((int)channel.GetPosition(TimeUnit.MS), lenms);

                Sleep(10);
            }while (!ShouldEndExample && channel.IsPlaying);
        }
Beispiel #7
0
        public void Update_Should_not_use_runner_When_minComponentCountByRunnerIndex_not_respected()
        {
            IParallelRunner runner = Substitute.For <IParallelRunner>();

            runner.DegreeOfParallelism.Returns(4);
            runner.When(m => m.Run(Arg.Any <IParallelRunnable>())).Throw <Exception>();
            using World world = new World(3);

            Entity entity1 = world.CreateEntity();

            entity1.Set <bool>();

            Entity entity2 = world.CreateEntity();

            entity2.Set <bool>();

            Entity entity3 = world.CreateEntity();

            entity3.Set <bool>();

            using (ISystem <int> system = new System(world, runner, 10))
            {
                Check.ThatCode(() => system.Update(0)).DoesNotThrow();
            }

            Check.That(entity1.Get <bool>()).IsTrue();
            Check.That(entity2.Get <bool>()).IsTrue();
            Check.That(entity3.Get <bool>()).IsTrue();
        }
Beispiel #8
0
        public void Update_Should_call_update()
        {
            using World world = new World(3);

            Entity entity1 = world.CreateEntity();

            entity1.Set <bool>();

            Entity entity2 = world.CreateEntity();

            entity2.Set <bool>();

            Entity entity3 = world.CreateEntity();

            entity3.Set <bool>();

            using (ISystem <int> system = new System(world))
            {
                system.Update(0);
            }

            Check.That(entity1.Get <bool>()).IsTrue();
            Check.That(entity2.Get <bool>()).IsTrue();
            Check.That(entity3.Get <bool>()).IsTrue();
        }
Beispiel #9
0
        public unsafe override void Run()
        {
            Span <char> display = stackalloc char[50];

            channel.Paused = false;

            System.GetDSPBufferSize(out var sampleLen, out _);

            do
            {
                OnUpdate();

                System.Update();

                bool bypass   = dsp.Bypass;
                var  volume   = dsp.GetParameterFloat(1);
                var  ptr      = dsp.GetParameterData(0, out var len);
                var  channels = dsp.GetParameterInt(2);

                var data = new ReadOnlySpan <float>(ptr, (int)len);

                string volstr = (volume * 100).ToString("N1");

                DrawText("==================================================");
                DrawText("Custom DSP Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2018.");
                DrawText("==================================================");
                DrawText();
                DrawText("Press 1 to toggle filter bypass");
                DrawText("Press 2 to decrease volume 10%");
                DrawText("Press 3 to increase volume 10%");
                DrawText("Press Esc to Quit");
                DrawText();
                DrawText("Filter is " + (bypass ? "inactive" : "active"));
                DrawText("Volume is " + volstr + "%");

                if (data.Length != 0)
                {
                    Debug.Assert((uint)channels <= 10);

                    float[] levels = DetermineChannelLevels(data, channels, (int)sampleLen);

                    for (int channel = 0; channel < levels.Length; ++channel)
                    {
                        display.Clear();

                        channel.TryFormat(display.Slice(0, 2), out _);

                        display.Slice(3, Math.Min((int)(levels[channel] * 40f), display.Length - 3)).Fill('=');

                        DrawText(display);
                    }
                }

                Sleep(50);
            }while (!ShouldEndExample);
        }
 public void updateLabel(System.Windows.Forms.Label label)
 {
     for (int i = 0; i < 100; i++)
     {
         Thread.Sleep(200);
         label.Text = i.ToString();
         label.Update();
     }
 }
Beispiel #11
0
        public override void Run()
        {
            do
            {
                OnUpdate();

                System.Update();

                System.GetChannelsPlaying(out int channelsPlaying, out _);

                DrawText("==================================================");
                DrawText("Channel Groups Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2018.");
                DrawText("==================================================");
                DrawText();
                DrawText("Group A : drumloop.wav, jaguar.wav, swish.wav");
                DrawText("Group B : c.ogg, d.ogg, e.ogg");
                DrawText();
                DrawText("Press 1 to toggle mute group A");
                DrawText("Press 2 to toggle mute group B");
                DrawText("Press 3 to toggle mute master group");
                DrawText("Press Esc to quit");
                DrawText();
                DrawText($"Channels playing: {channelsPlaying}");

                Sleep(50);
            }while (!ShouldEndExample);

            //A little fade out over 2 seconds
            float pitch = 1.0f, vol = 1.0f;

            for (int i = 0; i < 200; ++i)
            {
                Master.Volume = vol;
                Master.Pitch  = pitch;

                vol   -= 1.0f / 200;
                pitch -= 0.5f / 200;

                System.Update();

                Sleep(10);
            }
        }
Beispiel #12
0
        public override void Run()
        {
            do
            {
                OnUpdate();

                System.Update();

                float freq = 0, volume = 0;
                bool  playing = false;

                if (channel != null)
                {
                    freq    = channel.Frequency;
                    volume  = channel.Volume;
                    playing = channel.IsPlaying;
                }

                DrawText("==================================================");
                DrawText("Generate Tone Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2018.");
                DrawText("==================================================");
                DrawText("");
                DrawText("Press 1 to play a sine wave");
                DrawText("Press 2 to play a square wave");
                DrawText("Press 3 to play a saw wave");
                DrawText("Press 4 to play a triangle wave");
                DrawText("Press Space to stop the channel");
                DrawText("Press Up and Down Arrows to change volume");
                DrawText("Press Left and Right Arrows to change frequency");
                DrawText("Press Esc to quit");
                DrawText("");
                DrawText($"Channel is {(playing ? "playing" : "stopped")}");
                DrawText("Volume: " + volume.ToString("N2"));
                DrawText("Frequency: " + freq.ToString("N2"));

                Sleep(50);
            }while (!ShouldEndExample);
        }
Beispiel #13
0
        public override void Run()
        {
            DrawText("==================================================");
            DrawText("Granular Synthesis SetDelay Example.");
            DrawText("Copyright (c) Firelight Technologies 2004-2018.");
            DrawText("==================================================");
            DrawText();
            DrawText("Press 1 to Toggle Pause");
            DrawText("Press Esc to Quit");
            DrawText();

            SetConsoleUpdateStart();

            do
            {
                OnUpdate();

                System.Update();

                var res = Fmod.Library.Channel_IsPlaying(Channels[Slot], out var isPlaying);

                if (res != Result.Ok && res != Result.Err_Invalid_Handle)
                {
                    res.CheckResult();
                }

                if (!isPlaying && !Paused)
                {
                    QueueNextSound();
                }

                DrawText($"Channels are {(Paused ? "Paused" : "Playing")}");

                Sleep(10);
            }while (!ShouldEndExample);
        }
Beispiel #14
0
        protected override void OnUpdate(GameTime Time)
        {
            // Create a copy of our systems and entities so we can update without worry of disposed ones.
            // We can of course easily optimize this if need be.
            var EntitiesCopy = new Entity[_Entities.Count];
            var SystemsCopy  = new SceneSystem[_Systems.Count];

            _Entities.CopyTo(EntitiesCopy, 0);
            _Systems.CopyTo(SystemsCopy, 0);
            foreach (var Entity in EntitiesCopy)
            {
                if (!Entity.IsDisposed)
                {
                    Entity.Update(Time);
                }
            }
            foreach (var System in SystemsCopy)
            {
                if (!System.IsDisposed)
                {
                    System.Update(Time);
                }
            }
        }
Beispiel #15
0
        public override void Run()
        {
            do
            {
                OnUpdate();

                System.Update();

                uint     ms = 0, lenms = 0;
                FmodBool isPlaying = false, paused = false;
                int      channelsPlaying = 0;


                if (Channel != null)
                {
                    var library = Fmod.Library;

                    var res = library.Channel_IsPlaying(Channel, out isPlaying);
                    if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                    {
                        res.CheckResult();
                    }

                    res = library.Channel_GetPaused(Channel, out paused);
                    if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                    {
                        res.CheckResult();
                    }

                    res = library.Channel_GetPosition(Channel, out ms, TimeUnit.MS);
                    if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                    {
                        res.CheckResult();
                    }

                    library.Channel_GetCurrentSound(Channel, out SoundHandle shandle);

                    if (shandle != default)
                    {
                        res = library.Sound_GetLength(shandle, out lenms, TimeUnit.MS);
                        if (res != Result.Ok && res != Result.Err_Invalid_Handle && res != Result.Err_Channel_Stolen)
                        {
                            res.CheckResult();
                        }
                    }
                }

                System.GetChannelsPlaying(out channelsPlaying, out _);

                DrawText("==================================================");
                DrawText("Load From Memory Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2019.");
                DrawText("==================================================");
                DrawText();
                DrawText("Press 1 to play a mono sound (drumloop)");
                DrawText("Press 2 to play a mono sound (jaguar)");
                DrawText("Press 3 to play a stereo sound (swish)");
                DrawText();
                DrawTime((int)ms, (int)lenms);
                DrawText($"Channels Playing: {channelsPlaying}");
            }while (!ShouldEndExample);
        }
Beispiel #16
0
		private void CompareResults_Update_Ds_Str_Exception(DataSet dsResultException,ref Sys.Data.Common.DbDataAdapter dbDA) {
			int NumberOfAffectedRows = 0;
			Exception exp = null;
			Exception e = null;

		
			// --------- check for DBConcurrencyException /UniqueConstraint -----------------
			//	call AcceptChanges after each exception check in order to make sure that we check only the the current row 


			try {
				BeginCase("DBConcurrencyException - Delete");
				dsResultException.Tables[0].Rows.Find(9994).Delete();
				//no row with row version delete exists - records affected = 0
				NumberOfAffectedRows = -1;
				try {NumberOfAffectedRows = dbDA.Update(dsResultException,dsResultException.Tables[0].TableName);}
				catch (DBConcurrencyException dbExp){e = dbExp;}
				Compare(e.GetType(),typeof(DBConcurrencyException));
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null; e = null;}
			try {
				BeginCase("Number Of Affected Rows - Delete Exception");
				Compare(NumberOfAffectedRows ,-1 );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
			dsResultException.AcceptChanges();

			try {
				BeginCase("DBConcurrencyException - Update");
				dsResultException.Tables[0].Rows.Find(9995)["Title"] = "Jack the ripper"; 
				//no row with row version Update exists - records affected = 0
				NumberOfAffectedRows = -1;
				try {NumberOfAffectedRows = dbDA.Update(dsResultException,dsResultException.Tables[0].TableName);}
				catch (DBConcurrencyException dbExp){e = dbExp;}
				Compare(e.GetType(),typeof(DBConcurrencyException));
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null; e = null;}
			try {
				BeginCase("Number Of Affected Rows - Update Exception");
				Compare(NumberOfAffectedRows ,-1 );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
			dsResultException.AcceptChanges();


			try {
				BeginCase("DBConcurrencyException - Insert");
				dsResultException.Tables[0].Rows.Add(new object[] {9996,"Ofer","Borshtein","Insert"});
				//no row with row version Insert exists - records affected = 0
				NumberOfAffectedRows = -1;
				try {NumberOfAffectedRows = dbDA.Update(dsResultException,dsResultException.Tables[0].TableName);}
				catch (Exception dbExp){e = dbExp;} //throw Sys.Exception
				Compare(e != null ,true);
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null; e = null;}
			try {
				BeginCase("Number Of Affected Rows - Insert Exception");
				Compare(NumberOfAffectedRows ,-1 );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
			dsResultException.AcceptChanges();


		}
Beispiel #17
0
		protected void DbDataAdapter_Update_Ds_Str(Sys.Data.Common.DbDataAdapter dbDA) {
			int NumberOfAffectedRows = 0;
			Exception exp = null;

			// --------- get data from DB -----------------
			DataSet ds = PrepareDBData_Update(dbDA);

			// --------- prepare dataset for update method -----------------
			DataSet dsDB1 = ds.Copy(); 
		
			// --------- prepare dataset for DBConcurrencyException -----------------
			DataSet dsDB2 = ds.Copy(); 
		
			//update dataset
			dsDB2.Tables[0].Rows.Add(new object[] {9994,"Ofer", "Borshtein", "Delete"});
			dsDB2.Tables[0].Rows.Add(new object[] {9995,"Ofer", "Borshtein", "Update"});
			dsDB2.Tables[0].Rows.Find(9996).Delete();
			dsDB2.AcceptChanges();

		
			dsDB1.Tables[0].Rows.Add(new object[] {9991,"Ofer","Borshtein","Insert"});
			dsDB1.Tables[0].Rows.Find(9992).Delete();
			dsDB1.Tables[0].Rows.Find(9993)["Title"] = "Jack the ripper"; 

			//execute update to db
			NumberOfAffectedRows = dbDA.Update(dsDB1,dsDB1.Tables[0].TableName);
		
			try {
				BeginCase("Number Of Affected Rows");
				Compare(NumberOfAffectedRows ,3 );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
	

			//get result from db in order to check them
			DataSet dsExpected = new DataSet(); //ds.Reset();
			dbDA.Fill(dsExpected);
			dsExpected.Tables[0].PrimaryKey = new DataColumn[] {dsExpected.Tables[0].Columns["EmployeeID"]};

			CompareResults_Update(dsDB1,dsDB2,ref dbDA);
			CompareResults_Update_Ds_Str_Exception(dsDB2,ref dbDA);

			//Create rows which not exists in the DB but exists in the DS with row state = deleted
			//this will cause the Update to fail.
			dsDB1.Tables[0].Rows.Add(new object[] {9997,"Ofer", "Borshtein", "Delete"});
			dsDB1.Tables[0].Rows.Add(new object[] {9998,"Ofer", "Borshtein", "Delete"});
			dsDB1.AcceptChanges();
			dsDB1.Tables[0].Rows.Find(9997).Delete();
			dsDB1.Tables[0].Rows.Find(9998).Delete();


			//Check Sys.Data.DBConcurrencyException
			//The exception that is thrown by the DataAdapter during the update operation if the number of rows affected equals zero.
			try {
				BeginCase("Check DBConcurrencyException");
				try {
					NumberOfAffectedRows = dbDA.Update(dsDB1,dsDB1.Tables[0].TableName);
				}
				catch (DBConcurrencyException ex) {exp=ex;}
				Compare(exp.GetType(),typeof(DBConcurrencyException) );
				exp = null;
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}

			//close connection
			if (  ((IDbDataAdapter)dbDA).SelectCommand.Connection.State != ConnectionState.Closed )
				((IDbDataAdapter)dbDA).SelectCommand.Connection.Close();


		}
Beispiel #18
0
		protected void DataAdapter_ContinueUpdateOnError(Sys.Data.Common.DbDataAdapter dbDA) {
			/*
				!!!!!! Not working (TestName "ContinueUpdateOnError - true, check value 2")!!!!!
				If ContinueUpdateOnError is set to true, no exception is thrown when an error occurs during the update of a row. 
				The update of the row is skipped and the error information is placed in the RowError property of the row in error. 
				The DataAdapter continues to update subsequent rows.
				If ContinueUpdateOnError is set to false, an exception is thrown when an error occurs during the update of a row.
			*/
			Exception exp = null;

	
			IDbDataAdapter Ida = (IDbDataAdapter)dbDA;
			IDbCommand ICmd = Ida.SelectCommand; 
			IDbConnection IConn = ICmd.Connection; 
			IConn.ConnectionString = MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString;

			PrepareDataForTesting( MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString);
			IConn.Open();

			//get the total rows count
			ICmd.CommandText = "SELECT Count(*) FROM Customers where CustomerID in ('GH100','GH200','GH300','GH400','GH500','GH600','GH700')";
			int ExpectedRows = Sys.Convert.ToInt32(ICmd.ExecuteScalar());
			try {
				BeginCase("Check that Expected rows count > 0");
				Compare(ExpectedRows > 0 ,true);
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}

			ICmd.CommandText = "SELECT CustomerID, CompanyName, City, Country, Phone FROM Customers where CustomerID in ('GH100','GH200','GH300','GH400','GH500','GH600','GH700')";


			DataSet dsMem = new DataSet();	//Disconected dataset
			DataSet dsDB = new DataSet();	//DataBase data
			dbDA.AcceptChangesDuringFill = true;
			//get data from DB
			try {
				BeginCase("Execute Fill - check return rows count");
				int i = dbDA.Fill(dsMem);
				Compare(i ,ExpectedRows );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
		

			//update data with invalid information (Max. length for Phone is 24)
			//					123456789012345678901234
			string newValue1 = "Very Long String That Will Raise An Error Yep!";
			string oldValue1 = dsMem.Tables[0].Rows[3]["Phone"].ToString();
			string oldValue2 = dsMem.Tables[0].Rows[4]["Phone"].ToString();
			string newValue2 = "03-1234";


			dsMem.Tables[0].Rows[3]["Phone"] = newValue1;
			dsMem.Tables[0].Rows[4]["Phone"] = newValue2;
			dbDA.ContinueUpdateOnError = true;
        
			//will not throw exception
			try {
				BeginCase("ContinueUpdateOnError - true, check exception");
				try {
					dbDA.Update(dsMem);
				}
				catch(Exception ex){exp = ex;}
				Compare(exp == null,true);
				exp = null;
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}

			dbDA.Fill(dsDB); //get data from DB to check the update operation

			try {
				BeginCase("ContinueUpdateOnError - true, check RowError");
				Compare(dsMem.Tables[0].Rows[3].RowError.Length > 0 , true);
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}

			try {
				BeginCase("ContinueUpdateOnError - true, check value 1");
				Compare(dsDB.Tables[0].Rows[3]["Phone"] , oldValue1);
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}


			/*		- Test excluded, it is not working in .NET too!
					//should continue the update
					try
					{
						BeginCase("ContinueUpdateOnError - true, check value 2");
						Compare(dsDB.Tables[0].Rows[4]["Phone"] , newValue2);  //--------- NOT WORKING !!! -----------
					}
					catch(Exception ex)	{exp = ex;}
					finally	{EndCase(exp); exp = null;}
			*/
			dsMem.Reset();
			dsDB.Reset();
			dbDA.Fill(dsMem);
			dsMem.Tables[0].Rows[3]["Phone"] = newValue1 ;
			dsMem.Tables[0].Rows[4]["Phone"] = newValue2;
			dbDA.ContinueUpdateOnError = false;
        
			try {
				BeginCase("ContinueUpdateOnError - false, check exception");
				try {
					dbDA.Update(dsMem);
				}
				catch(Exception ex){exp = ex;}
				Compare(exp == null,false);
				exp = null;
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}

			dbDA.Fill(dsDB); //get data from DB to check the update operation
			try {
				BeginCase("ContinueUpdateOnError - false,check RowError");
				Compare(dsMem.Tables[0].Rows[3].RowError.Length > 0 ,true);
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
			try {
				BeginCase("ContinueUpdateOnError - false,check value 1");
				Compare(dsDB.Tables[0].Rows[3]["Phone"] , oldValue1 );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}


			try {
				BeginCase("ContinueUpdateOnError - false,check value 2");
				Compare(dsDB.Tables[0].Rows[4]["Phone"] , oldValue2 );
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}

			//close connection
			if (  ((IDbDataAdapter)dbDA).SelectCommand.Connection.State != ConnectionState.Closed )
				((IDbDataAdapter)dbDA).SelectCommand.Connection.Close();

		}
Beispiel #19
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + PanelDescription + "', composition='" + PanelComposition + "', standard='" + PanelStandard + "', color='" + PanelColor + "', size=" + PanelSize
            + ", sizeUnits='" + PanelSizeUnits
            + "', maxWidth=" + PanelMaxWidth + ", widthUnits='" + MaxWidthUnits + "', maxLength='" + PanelMaxLength + "', usdPrice=" + UsdPrice
            + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #20
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string partNum)
        {
            int bitStatus;

            if (SchematicStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE tblSchematics SET description ='" + SchematicDescription + "', usdPrice=" + SchematicUsdPrice
            + ", cadPrice=" + SchematicCadPrice + ", status=" + bitStatus +
            " WHERE schematicNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #21
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (InsulatedFloorStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + InsulatedFloorDescription + "', composition='" + InsulatedFloorComposition
            + "', size=" + InsulatedFloorSize + ", sizeUnits='" + InsulatedFloorSizeUnits
            + "', maxWidth=" + InsulatedFloorMaxWidth + ", widthUnits='" + InsulatedFloorMaxWidthUnits
            + "', maxLength='" + InsulatedFloorMaxLength + "', usdPrice=" + InsulatedFloorUsdPrice
            +", cadPrice=" + InsulatedFloorCadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #22
0
        public override void Run()
        {
            DrawText("==================================================");
            DrawText("Multiple Speaker Example.");
            DrawText("Copyright (c) Firelight Technologies 2004-2019.");
            DrawText("==================================================");
            DrawText();
            DrawText("Speaker mode is set to " + SpeakerModeString[(int)SpeakerMode] + (SpeakerMode < SpeakerMode._7Point1 ? " causing some speaker options to be unavailable" : string.Empty));
            DrawText();
            DrawText("Press Up arrow or Down arrow to select");
            DrawText("Press Enter to play the sound.");
            DrawText("Press Esc to quit");
            DrawText();
            SetConsoleUpdateStart();

            BufferedStringBuilder builder = new BufferedStringBuilder(new char[50]);

            do
            {
                OnUpdate();

                System.Update();

                uint ms = 0, lenms = 0;
                bool playing = false, paused = false;

                if (channel != null)
                {
                    playing = channel.IsPlaying;

                    if (playing)
                    {
                        paused = channel.Paused;

                        ms = channel.GetPosition(TimeUnit.MS);

                        lenms = channel.CurrentSound.GetLength(TimeUnit.MS);
                    }
                }

                for (int i = 0; i < SelectionString.Length; ++i)
                {
                    bool disabled = !IsSelectionAvailable(SpeakerMode, i);

                    //Did not feel like writing this to be allocation heavy, so I did this
                    builder.WriteToBuffer('[');
                    builder.WriteToBuffer(selection == i ? (disabled ? '-' : 'X') : ' ');
                    builder.WriteToBuffer("] ");

                    if (disabled)
                    {
                        builder.WriteToBuffer("[N/A] ");
                    }

                    builder.WriteToBuffer(SelectionString[i]);

                    DrawText(builder.CurrentContent);

                    builder.Clear();
                }

                DrawText();

                builder.WriteToBuffer("Status: ");
                builder.WriteToBuffer(playing ? (paused ? "Paused" : "Playing") : "Stopped");

                DrawText(builder.CurrentContent);

                builder.Clear();

                DrawTime((int)ms, (int)lenms);

                Sleep(50);
            }while (!ShouldEndExample);
        }
Beispiel #23
0
 public void updateLabel(System.Windows.Forms.Label textlabel)
 {
     while (timerIsRunning)
     {
         if (textlabel.InvokeRequired) //if the thread acessing the text label is not the same as the thread that created the text label
         {
             textlabel.Invoke((MethodInvoker)(() => textlabel.Text = this.ToString())); //Runs this command as if it was running in the parent thread
             textlabel.Invoke((MethodInvoker)(() => textlabel.Update())); //Runs this command as if it was running in the parent thread
             //Invoke command referenced from http://tinyurl.com/m6nz8n8
         }
         else
         {
             textlabel.Text = this.ToString();
             textlabel.Update();
         }
         if (seconds > 0)
         {
             seconds--;
         }
         else
         {
             if (minutes > 0)
             {
                 minutes--;
                 seconds = 59;
             }
             else
             {
                 if (hours > 0)
                 {
                     hours--;
                     minutes = 59;
                     seconds = 59;
                 }
                 else
                 {
                     this.stopTimer();
                 }
             }
         }
         System.Threading.Thread.Sleep(1000); //delay for one second (1000 miliseconds)
     }
 }
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Sunrail300AccessoriesStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + Sunrail300AccessoriesDescription + "', usdPrice=" + Sunrail300AccessoriesUsdPrice + ", cadPrice=" + Sunrail300AccessoriesCadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #25
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + ExtrusionDescription + "', size=" + ExtrusionSize + ", sizeUnits='" + SizeUnits
            + "', extrusionAngleA=" + AngleA + ", angleAUnits='" + AngleAUnits + "', extrusionAngleB=" + AngleB
            + ", angleBUnits='" + AngleBUnits + "', extrusionAngleC=" + AngleC + ", angleCUnits='" + AngleCUnits
            + "', maxLength=" + ExtrusionMaxLength + ", lengthUnits='" + MaxLengthUnits + "', usdPrice=" + UsdPrice
            + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
        public static string Learn(System.Windows.Forms.TextBox status)
        {
            CancelLearn = false;

            string irCode = "";
            Controller mc = new Controller();
            learnCompletedEventArgs = null;
            mc.Learning += new UsbUirt.Controller.LearningEventHandler(mc_Learning);
            mc.LearnCompleted += new UsbUirt.Controller.LearnCompletedEventHandler(mc_LearnCompleted);

            try
            {
                try
                {
                    mc.LearnAsync(CodeFormat.Pronto, LearnCodeModifier.None, learnCompletedEventArgs);
                }
                catch (Exception ex)
                {
                    throw;
                }

                while (learnCompletedEventArgs == null)
                {
                    string s = Console.ReadLine();
                    if (CancelLearn == true)
                    {
                        if (learnCompletedEventArgs == null)
                        {
                            mc.LearnAsyncCancel(learnCompletedEventArgs);
                            Thread.Sleep(1000);
                            break;
                        }
                    }
                    else
                    {
                        status.Text = LearnState;
                        status.Update();
                        Thread.Sleep(100);
                    }
                }

                if (learnCompletedEventArgs != null &&
                    learnCompletedEventArgs.Cancelled == false &&
                    learnCompletedEventArgs.Error == null)
                {
                    irCode = learnCompletedEventArgs.Code;
                }

            }
            finally
            {
                mc.Learning -= new UsbUirt.Controller.LearningEventHandler(mc_Learning);
                mc.LearnCompleted -= new UsbUirt.Controller.LearnCompletedEventHandler(mc_LearnCompleted);
            }

            return irCode;
        }
Beispiel #27
0
        public override void Run()
        {
            Channel channel         = null;
            uint    SamplesRecorded = 0;
            uint    SamplesPlayed   = 0;

            System.RecordStart(DriverIndex, sound, true);

            uint SoundLength = sound.GetLength(TimeUnit.PCM);

            do
            {
                OnUpdate();

                System.Update();

                var res = Fmod.Library.System_GetRecordPosition(System, DriverIndex, out uint recordPos);

                if (res != Result.Ok)
                {
                    if (res != Result.Err_Record_Disconnected)
                    {
                        res.CheckResult();
                    }

                    recordPos = 0; //Not garuenteed to be 0 on error
                }

                uint recordDelta = (recordPos >= LastRecordPos) ? recordPos - LastRecordPos : recordPos + SoundLength - LastRecordPos;
                LastRecordPos    = recordPos;
                SamplesRecorded += recordDelta;

                if (recordDelta > 0 && recordDelta < MinRecordDelta)
                {
                    MinRecordDelta  = recordDelta;
                    adjustedLatency = (recordDelta <= desiredLatency) ? desiredLatency : recordDelta;
                }

                if (channel == null && SamplesRecorded >= adjustedLatency)
                {
                    channel = System.PlaySound(sound);
                }

                if (channel != null)
                {
                    res = Fmod.Library.System_IsRecording(System, DriverIndex, out FmodBool isRecording);

                    if (res != Result.Ok)
                    {
                        if (res != Result.Err_Record_Disconnected)
                        {
                            res.CheckResult();
                        }

                        isRecording = false; //Not garuenteed to be false on error
                    }

                    if (!isRecording)
                    {
                        channel.Paused = true;
                    }

                    uint playPos = channel.GetPosition(TimeUnit.PCM);

                    uint playDelta = (playPos >= LastPlayPos) ? playPos - LastPlayPos : playPos + SoundLength - LastPlayPos;
                    LastPlayPos    = playPos;
                    SamplesPlayed += playDelta;

                    /*
                     *  Compensate for any drift.
                     */
                    int latency = (int)(SamplesRecorded - SamplesPlayed);
                    actualLatency = (int)((0.97f * actualLatency) + (0.03f * latency));

                    int playbackRate = nativeRate;
                    if (actualLatency < (int)(adjustedLatency - driftThreshold))
                    {
                        playbackRate -= (nativeRate / 50); //Play position is catching up to the record position, slow playback down by 2%
                    }
                    else if (actualLatency > (int)(adjustedLatency + driftThreshold))
                    {
                        playbackRate += (nativeRate / 50); //Play position is falling behind the record position, speed playback up by 2%
                    }

                    channel.Frequency = playbackRate;
                }

                DrawText("==================================================");
                DrawText("Record Example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2018.");
                DrawText("==================================================");
                DrawText("");
                DrawText("Adjust LATENCY define to compensate for stuttering");
                DrawText($"Current value is {Latency_MS}");
                DrawText("");
                DrawText($"Press 1 to {(dspEnabled ? "Disable" : "Enable")} DSP effect");
                DrawText("Press Esc to quit.");
                DrawText("");
                DrawText($"Adjusted latency: {adjustedLatency} ({adjustedLatency * 1000 / nativeRate}ms)");
                DrawText($"Actual Latency: {actualLatency} ({actualLatency * 1000 / nativeRate}ms)");
                DrawText("");
                DrawText($"Recorded: {SamplesRecorded} ({SamplesRecorded / nativeRate}s)");
                DrawText($"Played: {SamplesPlayed} ({SamplesPlayed / nativeRate}s)");

                Sleep(10);
            }while (!ShouldEndExample);
        }
Beispiel #28
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string partNum)
        {
            dataSource.UpdateCommand = "UPDATE tblSchematicParts SET usdPrice=" + PartUsdPrice
            + ", cadPrice=" + PartCadPrice
            + " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #29
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Sunrail300Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + Sunrail300Description + "', maxLengthFeet=" + Sunrail300MaxLengthFeet + ", maxLengthInches="
            + Sunrail300MaxLengthInches + ", usdPrice=" + Sunrail300UsdPrice + ", cadPrice=" + Sunrail300CadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #30
0
        public static void AnimateControl(System.Windows.Forms.Control control, bool show, int animationTime, Rectangle rectStart, Rectangle rectEnd)
        {
            control.Bounds = rectStart;
            if (!control.Visible)
                control.Visible = true;

            bool directSet = false;
            TimeSpan time = new TimeSpan(0, 0, 0, 0, animationTime);
            int dxLoc, dyLoc;
            int dWidth, dHeight;
            dxLoc = dyLoc = dWidth = dHeight = 0;
            if (rectStart.Left == rectEnd.Left &&
                rectStart.Top == rectEnd.Top &&
                rectStart.Right == rectEnd.Right && rectStart.Height != rectEnd.Height)
            {
                dHeight = (rectEnd.Height > rectStart.Height ? 1 : -1);
            }
            else if (rectStart.Left == rectEnd.Left &&
                rectStart.Top == rectEnd.Top &&
                rectStart.Bottom == rectEnd.Bottom && rectStart.Width != rectEnd.Width)
            {
                dWidth = (rectEnd.Width > rectStart.Width ? 1 : -1);
            }
            else if (rectStart.Right == rectEnd.Right &&
                rectStart.Top == rectEnd.Top &&
                rectStart.Bottom == rectEnd.Bottom && rectStart.Width != rectEnd.Width)
            {
                dxLoc = (rectEnd.Width > rectStart.Width ? -1 : 1);
                dWidth = (rectEnd.Width > rectStart.Width ? 1 : -1);
            }
            else if (rectStart.Right == rectEnd.Right &&
                rectStart.Left == rectEnd.Left &&
                rectStart.Bottom == rectEnd.Bottom && rectStart.Height != rectEnd.Height)
            {
                dyLoc = (rectEnd.Height > rectStart.Height ? -1 : 1);
                dHeight = (rectEnd.Height > rectStart.Height ? 1 : -1);
            }
            else if (rectEnd.X != rectStart.X && rectEnd.Y == rectStart.Y && rectStart.Height == rectEnd.Height && rectEnd.Width == rectStart.Width)
            {
                // Simple to left move of the control
                dxLoc = (rectEnd.X > rectStart.X ? 1 : -1);
            }
            else if (rectEnd.Y != rectStart.Y && rectEnd.X == rectStart.X && rectStart.Height == rectEnd.Height && rectEnd.Width == rectStart.Width)
            {
                // Simple to left move of the control
                dxLoc = (rectEnd.Y > rectStart.Y ? 1 : -1);
            }
            else
                directSet = true;

            if (directSet)
            {
                control.Bounds = rectEnd;
            }
            else
            {
                int speedFactor = 1;
                int totalPixels = (rectStart.Width != rectEnd.Width) ?
                    Math.Abs(rectStart.Width - rectEnd.Width) :
                    Math.Abs(rectStart.Height - rectEnd.Height);
                if (totalPixels == 0 && rectStart.Width == rectEnd.Width && rectStart.Height == rectEnd.Height)
                {
                    if (rectEnd.X - rectStart.X != 0)
                        totalPixels = Math.Abs(rectStart.X - rectEnd.X);
                    else if (rectEnd.Y - rectStart.Y != 0)
                        totalPixels = Math.Abs(rectStart.Y - rectEnd.Y);
                }
                int remainPixels = totalPixels;
                DateTime startingTime = DateTime.Now;
                Rectangle rectAnimation = rectStart;
                while (rectAnimation != rectEnd)
                {
                    DateTime startPerMove = DateTime.Now;

                    rectAnimation.X += dxLoc * speedFactor;
                    rectAnimation.Y += dyLoc * speedFactor;
                    rectAnimation.Width += dWidth * speedFactor;
                    rectAnimation.Height += dHeight * speedFactor;
                    if (Math.Sign(rectEnd.X - rectAnimation.X) != Math.Sign(dxLoc))
                        rectAnimation.X = rectEnd.X;
                    if (Math.Sign(rectEnd.Y - rectAnimation.Y) != Math.Sign(dyLoc))
                        rectAnimation.Y = rectEnd.Y;
                    if (Math.Sign(rectEnd.Width - rectAnimation.Width) != Math.Sign(dWidth))
                        rectAnimation.Width = rectEnd.Width;
                    if (Math.Sign(rectEnd.Height - rectAnimation.Height) != Math.Sign(dHeight))
                        rectAnimation.Height = rectEnd.Height;
                    control.Bounds = rectAnimation;
                    if (control.Parent != null)
                        control.Parent.Update();
                    else
                        control.Update();

                    remainPixels -= speedFactor;

                    while (true)
                    {
                        TimeSpan elapsedPerMove = DateTime.Now - startPerMove;
                        TimeSpan elapsedTime = DateTime.Now - startingTime;
                        if ((time - elapsedTime).TotalMilliseconds <= 0)
                        {
                            speedFactor = remainPixels;
                            break;
                        }
                        else
                        {
                            if ((int)(time - elapsedTime).TotalMilliseconds == 0)
                                speedFactor = 1;
                            else
                            {
                                try
                                {

                                    speedFactor = remainPixels * (int)elapsedPerMove.TotalMilliseconds / (int)((time - elapsedTime).TotalMilliseconds);
                                }
                                catch { }
                            }
                        }
                        if (speedFactor >= 1)
                            break;
                    }
                }
            }

            if (!show)
            {
                control.Visible = false;
                control.Bounds = rectStart;
            }
        }
Beispiel #31
0
        public unsafe override void Run()
        {
            /*
             *  Get information needed later for scheduling.  The mixer block size, and the output rate of the mixer.
             */

            System.GetDSPBufferSize(out uint dspBlockLen, out _);
            System.GetSoftwareFormat(out int outputRate, out _, out _);

            /*
             *  Play all the sounds at once! Space them apart with set delay though so that they sound like they play in order.
             */
            for (int i = 0; i < Notes.Length; ++i)
            {
                Sound s = sounds[Notes[i]];

                Channel channel = System.PlaySound(s, channelGroup, true);

                if (clockStart == 0)
                {
                    channel.GetDSPClock(out _, out clockStart);

                    /*
                     * Start the sound into the future, by 2 mixer blocks worth.
                     * Should be enough to avoid the mixer catching up and hitting the clock value before we've finished setting up everything.
                     * Alternatively the channelgroup we're basing the clock on could be paused to stop it ticking.
                     */
                    clockStart += dspBlockLen * 2;
                }
                else
                {
                    uint slen = s.GetLength(TimeUnit.PCM);          /* Get the length of the sound in samples. */
                    s.GetDefaults(out float freq, out _);           /* Get the default frequency that the sound was recorded at. */
                    slen        = (uint)(slen / freq * outputRate); /* Convert the length of the sound to 'output samples' for the output timeline. */
                    clockStart += slen;                             /* Place the sound clock start time to this value after the last one. */
                }

                channel.SetDelay(clockStart, 0, false);     /* Schedule the channel to start in the future at the newly calculated channelgroup clock value. */

                channel.Paused = false;                     /* Unpause the sound.  Note that you won't hear the sounds, they are scheduled into the future. */
            }

            /*
             *  Main loop.
             */
            do
            {
                OnUpdate();

                System.Update();

                System.GetChannelsPlaying(out int playing, out _);

                DrawText("==================================================");
                DrawText("Gapless Playback example.");
                DrawText("Copyright (c) Firelight Technologies 2004-2018.");
                DrawText("==================================================");
                DrawText();
                DrawText("Press 1 to toggle pause");
                DrawText("Press 2 to increase pitch");
                DrawText("Press 3 to decrease pitch");
                DrawText("Press Esc to quit");
                DrawText();
                DrawText($"Channels Playing {playing} : {(channelGroup.Paused ? "Paused" : (channelGroup.IsPlaying ? "Playing" : "Stopped"))}");

                Sleep(50);
            }while (!ShouldEndExample);
        }
Beispiel #32
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET width =" + VinylRollWidth + ", widthUnits='" + VinylRollWidthUnits + "', weight=" + VinylRollWeight + ", weightUnits='" + VinylRollWeightUnits
            + "', usdPrice=" + UsdPrice + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #33
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (Status)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + SuncrylicDescription
            + "', maxLength=" + SuncrylicMaxLength + ", lengthUnits='" + SuncrylicLengthUnits + "', usdPrice=" + UsdPrice
            + ", cadPrice=" + CadPrice + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }
Beispiel #34
0
        //Database update
        public void Update(System.Web.UI.WebControls.SqlDataSource dataSource, string table, string partNum)
        {
            int bitStatus;

            if (accessoryStatus)
            {
                bitStatus = 1;
            }
            else
            {
                bitStatus = 0;
            }

            dataSource.UpdateCommand = "UPDATE " + table
            + " SET description ='" + AccessoryDescription + "', packQuantity=" + AccessoryPackQuantity + ", width=" + AccessoryWidth
            + ", widthUnits='" + AccessoryWidthUnits + "', length=" + AccessoryLength + ", lengthUnits='" + AccessoryLengthUnits
            + "', size=" + AccessorySize + ", sizeUnits='" + AccessorySizeUnits
            + "', usdPrice=" + AccessoryUsdPrice + ", cadPrice=" + AccessoryCadPrice
            + ", status=" + bitStatus +
            " WHERE partNumber = '" + partNum + "'";

            dataSource.Update();
        }