コード例 #1
0
 public bool RemoveTask(int taskId, string boardId)
 {
     BusinessLayer.Task t = FindTask(taskId, boardId);
     if (t == null)
     {
         return(false);
     }
     else
     {
         int col = t.GetColumn();
         if (col == 1)
         {
             toDo.Remove(t);
         }
         else if (col == 2)
         {
             inProgress.Remove(t);
         }
         else
         {
             done.Remove(t);
         }
         return(true);
     }
 }
コード例 #2
0
 public bool MoveTask(int taskId, string boardId)
 {
     BusinessLayer.Task t = FindTask(taskId, boardId);
     if (t == null)
     {
         return(false);
     }
     else
     {
         int col = t.GetColumn();
         if (col == 3)
         {
             return(false);
         }
         else
         {
             if (col == 1)
             {
                 t.SetColumn(2);
                 inProgress.Add(t);
                 toDo.Remove(t);
             }
             else
             {
                 t.SetColumn(3);
                 done.Add(t);
                 inProgress.Remove(t);
             }
             return(true);
         }
     }
 }
コード例 #3
0
        public void GetParentTaskTestBL()
        {
            Mock <ProjectManagerEntities> mockContext = MockDataSetList();
            var taskBL             = new BusinessLayer.Task(mockContext.Object);
            List <TaskModel> tasks = taskBL.GetParentTasks();

            Assert.IsNotNull(tasks);
            foreach (var task in tasks)
            {
                Assert.IsNotNull(task.Parent_ID);
            }
        }
コード例 #4
0
        public void DeleteTaskTestBL()
        {
            Mock <ProjectManagerEntities> mockContext = MockDataSetList();
            var       taskBL = new BusinessLayer.Task(mockContext.Object);
            TaskModel data   = new TaskModel
            {
                Task       = "Task1",
                Start_Date = DateTime.Now,
                End_Date   = DateTime.Now,
                Priority   = 26
            };

            Assert.IsFalse(taskBL.endTask(data));
        }
コード例 #5
0
 public BusinessLayer.Task AddTask(string title, string body, DateTime dueDate)
 {
     if (toDo.Count >= maxLength | (title.Length < 1 | title.Length > 50) | (body.Length > 300) | (dueDate.Date.CompareTo(DateTime.Now) < 0))
     {
         return(null);
     }
     else
     {
         int taskId           = taskCounter + 1;
         BusinessLayer.Task t = new BusinessLayer.Task(title, body, DateTime.Now, dueDate, taskId, boardId, 1);
         toDo.Add(t);
         taskCounter++;
         return(t);
     }
 }
コード例 #6
0
        public void AddProjectTestBL()
        {
            Mock <ProjectManagerEntities> mockContext = MockDataSetList();
            var       taskBL = new BusinessLayer.Task(mockContext.Object);
            TaskModel data   = new TaskModel
            {
                Task       = "Task1",
                Start_Date = DateTime.Now,
                End_Date   = DateTime.Now,
                Priority   = 26
            };

            Assert.IsFalse(taskBL.AddTask(data));

            TaskModel dataParent = new TaskModel
            {
                Task         = "Task1",
                Start_Date   = DateTime.Now,
                End_Date     = DateTime.Now,
                Priority     = 26,
                isParentTask = true
            };

            Assert.IsTrue(taskBL.AddTask(dataParent));

            TaskModel dataUpdate = new TaskModel
            {
                Task       = "Task1",
                Start_Date = DateTime.Now,
                End_Date   = DateTime.Now,
                Priority   = 26,
                Task_ID    = 1
            };

            Assert.IsFalse(taskBL.AddTask(dataUpdate));
        }
コード例 #7
0
ファイル: State.cs プロジェクト: MbProg/TestApolloAndroid
        public void SpinnerTaskItemSelected (object sender, AdapterView.ItemSelectedEventArgs e)
		{


			Spinner spinner = (Spinner)sender;
			GetControlReferences ();
			_selectedIndex = e.Position;

            // First disable all controls
            DisableControls();

			_task = _tasks [_selectedIndex];
			_spinnerArt.SetSelection (((ArtViewAdapter)_spinnerArt.Adapter).GetItemIndex (_tasks [_selectedIndex].Art));
			_spinnerTyp.SetSelection (((TypViewAdapter)_spinnerTyp.Adapter).GetItemIndex (_tasks [_selectedIndex].Typ));
			_spinnerMitarbeiter.SetSelection (((MitarbeiterViewAdapter)_spinnerMitarbeiter.Adapter).GetItemIndex (_tasks [_selectedIndex].Mitarbeiter));
			_spinnerStatus.SetSelection (((StringViewAdapter)_spinnerStatus.Adapter).GetItemIndex (_tasks [_selectedIndex].Status));
			_spinnerAbteilung.SetSelection (((AbteilungViewAdapter)_spinnerAbteilung.Adapter).GetItemIndex (_tasks [_selectedIndex].Abteilung));

			_edDatum.Text = _tasks [_selectedIndex].Datum;
			_edZeit.Text = _tasks [_selectedIndex].Zeit;
			_edAnsprechpartner.Text = _tasks [_selectedIndex].Ansprechpartner;
			_edStartTelefon.Text = _tasks [_selectedIndex].Time_TelStart;
			_edDauerTelefon.Text =  _tasks [_selectedIndex].Time_TelDauer;
			_edDatumEdit.Text =  _tasks [_selectedIndex].Datum_Edit;
			_edDatumClose.Text = _tasks [_selectedIndex].Datum_Close;
			_edText.Text =  _tasks [_selectedIndex].Memo;
			_edNummer.Text = _tasks [_selectedIndex].ID;

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
            {
                if (_task.ID.StartsWith("OF") == true)
                    ConfigureButtons(permission.Create, permission.Update, false, false, false);
                else
                    ConfigureButtons(permission.Create, false, false, false, false);

            }
            else
                ConfigureButtons(permission.Create , permission.Update, false, false, permission.UpDownload);
		}
コード例 #8
0
ファイル: State.cs プロジェクト: MbProg/TestApolloAndroid
		public async Task BtnTaskFragmentClickAsync()
		{
            await BusinessLayer.UtilityClasses.FillTaskUtilityClassesAsync(Utilities.GetCurrentLanguage(_mainActivity ),MainActivity.User);
            _ansprechpartnern = await BusinessLayer.Ansprechpartner.GetAnsprechpartnernAsync ( _stateClass._person.ID, Utilities.GetCurrentLanguage(_mainActivity),MainActivity.User);
			_tasks = await BusinessLayer.Task.GetTasksAsync ( _stateClass._person.ID,MainActivity.User);
            _taskStatus = CreateTaskStatusList (UI.Utilities.GetCurrentLanguage(_mainActivity));


			if (_tasks.Count > 0)
				// The object is the first item
				_task = _tasks [0];
			else
				// Just create a new empty object
				_task = BusinessLayer.Task.Create ();

            fragment = new TaskFragment(Resource.Layout.FrgTask, _mainActivity , this);

			_mainActivity.FragmentManager 
				.BeginTransaction()
				.SetCustomAnimations (Android.Resource.Animator.FadeIn,Android.Resource.Animator.FadeOut)
				.Replace(Resource.Id.frameContent, fragment)
				.AddToBackStack (null)
				.Commit();

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(permission.Create, false, false, false, false);
            else
                ConfigureButtons(permission.Create, false, false, false, permission.UpDownload);

		}
コード例 #9
0
ファイル: State.cs プロジェクト: MbProg/TestApolloAndroid
		public BusinessLayer.Person BtnDeleteClick()
		{
			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return null;

			// No Item is selected
			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return null;

			// No Item is selected
			if (_edAnsprechpartner.Text == "")
				return null;
			
			if (_task.Delete (MainActivity.User) ==  DataAccessLayer.SOAResult.TRUE) 
			{

				// Show success message
                Android.Widget.Toast.MakeText (_mainActivity, _mainActivity.Resources.GetString(Resource.String.DeletedSuccessfully), Android.Widget.ToastLength.Short).Show ();

				// Empty the controls
				this.ResetControls ();

				// Reorder the Ansprechpartner List
				_tasks.RemoveAt (_selectedIndex);

				// Redraw the spinner
				_spinnerTask = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTasks);
				_spinnerTask.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerTaskItemSelected);
				((TaskViewAdapter)_spinnerTask.Adapter).Remove (_selectedIndex);

				// Fill the Ansprechpartner object to avoid null references
				_task = BusinessLayer.Task.Create ();

				// Disable the controls
				DisableControls ();

				// if there is no ansprechpartner disable button
				if (_tasks.Count > 0) {
                    if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                        ConfigureButtons(permission.Create, false, false, false, false);
                    else
                        ConfigureButtons(permission.Create, permission.Update, false, false, permission.UpDownload);
				}
				else
				{
                    if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                        ConfigureButtons(permission.Create, false, false, false, false);
                    else
                        ConfigureButtons(permission.Create, false, false, false, permission.UpDownload);
				}
				// Do not return anything, because we care about the listview here and not in the parent control
				return null;
			}

			return null;
		}
コード例 #10
0
ファイル: State.cs プロジェクト: MbProg/TestApolloAndroid
		public void  BtnNewClick()
		{
			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;

			// Enable the controls to let the user enter value
			EnableControls ();

			// Create a new task
			_task = BusinessLayer.Task.Create ();

			// Reset controls
			ResetControls ();

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(false, false, true, false, false);
            else
                ConfigureButtons(false, false, true, false, permission.UpDownload);
                
			return ;

		}
コード例 #11
0
ファイル: State.cs プロジェクト: MbProg/TestApolloAndroid
		async public Task ListViewClickAsync()
		{

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;

			// Disable the controls 
			DisableControls ();

			// Specific Controls

			// Test if the controls are filled 
			if (GetControlReferences () == false)
				return ;


            _ansprechpartnern = await BusinessLayer.Ansprechpartner.GetAnsprechpartnernAsync ( _stateClass._person.ID, Utilities.GetCurrentLanguage(_mainActivity),MainActivity.User);
			_tasks = await BusinessLayer.Task.GetTasksAsync ( _stateClass._person.ID,MainActivity.User);
            _taskStatus =  CreateTaskStatusList (UI.Utilities.GetCurrentLanguage(_mainActivity));

			// Fill the spinners
			// Tasks
			_spinnerTask = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTasks);
			TaskViewAdapter _adapterTask = new TaskViewAdapter (_mainActivity, _tasks);
			_spinnerTask.Adapter = _adapterTask;

			// Ansprechpartner
			_spinnerAnsprechpartner = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAnsprechpartner);
			_spinnerAnsprechpartner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerAnsprechpartnerItemSelected );
			AnsprechpartnerViewAdapter _adapterAnsprechpartner = new AnsprechpartnerViewAdapter (_mainActivity,_ansprechpartnern);
			_spinnerAnsprechpartner.Adapter = _adapterAnsprechpartner;

			// Art Spinner
			_spinnerArt = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerArt);
            ArtViewAdapter _adapterArt = new ArtViewAdapter (_mainActivity, BusinessLayer.UtilityClasses.taskArts);
			_spinnerArt.Adapter = _adapterArt;

			// Typ Spinner
			_spinnerTyp = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerTyp);
            TypViewAdapter _adapterTyp = new TypViewAdapter (_mainActivity, BusinessLayer.UtilityClasses.taskTyps);
			_spinnerTyp.Adapter = _adapterTyp;

			// Status Spinner
			_spinnerStatus = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerStatus);
			StringViewAdapter _adapterString = new StringViewAdapter (_mainActivity, _taskStatus);
			_spinnerStatus.Adapter = _adapterString;

			// Mitarbeiter Spinner
			_spinnerMitarbeiter = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerMitarbeiter);
			_spinnerMitarbeiter.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (SpinnerMitarbeiterItemSelected );
            MitarbeiterViewAdapter _adapterMitarbeiter = new MitarbeiterViewAdapter (_mainActivity,BusinessLayer.UtilityClasses.mitarbeitern);
			_spinnerMitarbeiter.Adapter = _adapterMitarbeiter;

			// Abteilung Spinner
			_spinnerAbteilung = _mainActivity.FindViewById<Spinner> (Resource.Id.spinnerAbteilung);
            AbteilungViewAdapter _adapterAbteilung = new AbteilungViewAdapter (_mainActivity, BusinessLayer.UtilityClasses.abteilungen);
			_spinnerAbteilung.Adapter = _adapterAbteilung;

			// Specific Controls
			if (_tasks.Count > 0)
			{
				// Show by default the first item, if there is an item!!!
				_edDatum.Text = _tasks [_selectedIndex].Datum;
				_edZeit.Text = _tasks [_selectedIndex].Zeit;
				_edAnsprechpartner.Text = _tasks [_selectedIndex].Ansprechpartner;
				_edStartTelefon.Text = _tasks [_selectedIndex].Time_TelStart;
				_edDauerTelefon.Text =  _tasks [_selectedIndex].Time_TelDauer;
				_edDatumEdit.Text =  _tasks [_selectedIndex].Datum_Edit;
				_edDatumClose.Text = _tasks [_selectedIndex].Datum_Close;
				_edText.Text =  _tasks [_selectedIndex].Memo;
				_edNummer.Text = _tasks [_selectedIndex].ID;
			}
			else
			{
				// If not, just clear all controls
				_task = BusinessLayer.Task.Create ();
				ResetControls ();
			}

            // Configure the buttons
            if (MainActivity.User.NetworkStatus == DataAccessLayer.NetworkState.Disconnected)
                ConfigureButtons(permission.Create, false, false, false, false);
            else
                ConfigureButtons(permission.Create, false, false, false, permission.UpDownload);

            return ;

		}
コード例 #12
0
        /// <summary>
        /// Read the data of the control in a passed by reference object
        /// </summary>
        /// <param name="task">the selected Task</param>
        public override void GetControlsData(ref BusinessLayer.Task task)
        {

            task.Typ = GetTypIndex( TxtTaskType.Text);
            task.Art = GetArtIndex( TxtTaskArt.Text);
            task.Status = TxtTaskStatus.Text;
            task.Adr_Id = _person.ID;
            task.Datum = TxtTaskDate.Text;
            task.Zeit = TxtTaskTime.Text;
            task.Mitarbeiter = TxtTaskUser.Text;
            task.Abteilung = TxtTaskAbteilung.Text;
            task.Ansprechpartner = TxtTaskAnsprechpartner.Text;
            task.User_Save = Application._user.Name;
            if (task.Time_TelStart == null)
                task.Time_TelStart = "00:00:00,00";
            if (task.Time_TelDauer == null)
                task.Time_TelDauer = "00:00:00,00";


            // Test if the Ansprechpartner is selected or just written -> if selected we need the ID
            if (_ansprechpartner != null)
                task.AnsprechpartnerID = _ansprechpartner.ID;
            else
                _task.AnsprechpartnerID = "0";
            task.Memo = TxtTaskText.Text;
            task.Datum_Save = TxtTaskDateModified.Text;

            // Test if the task has been closed right now
            // If it is closed right now, we have to set the closed date and user
            if (task.Status == "0" && TxtTaskStatus.Text == "1")
            {
                task.User_Close = Application._user.Name;
                task.Datum_Close = DateTime.Now.ToString("dd.MM.yyyy");
                task.Time_Close = DateTime.Now.Hour.ToString("00") + ":" + DateTime.Now.Minute.ToString("00");
            }
            else if(task.ID == null && TxtTaskStatus.Text == "1")
            {
                task.User_Close = Application._user.Name;
                task.Datum_Close = DateTime.Now.ToString("dd.MM.yyyy");
                task.Time_Close = DateTime.Now.Hour.ToString("00") + ":" + DateTime.Now.Minute.ToString("00");
            }
            else
            {
                task.User_Close = "";
                task.Datum_Close = "";
                task.Time_Close = "00:00:00,00";
            }

            if (string.IsNullOrEmpty (_task.ID))
                task.Datum_Edit = DateTime.Now.ToString("dd.MM.yyyy");

            _task = task;

            return ;

        }
コード例 #13
0
        /// <summary>
        /// Fill the controls of TBTask with the appropriate task
        ///          + assign the local member _task with the passed-in task
        /// </summary>
        /// <param name="task">Fill the controls with this task.</param>
        public void FillTaskControls(BusinessLayer.Task task)
        {
            // assing the local class member
            _task = task;

            // Fill the controls
            TxtTask.Text =  FormatTaskText(task.Datum, task.Ansprechpartner, task.Memo);
            TxtTaskType.Text =GetTypBeschreibung( task.Typ);
            TxtTaskArt.Text = GetArtBeschreibung( task.Art);
            TxtTaskStatus.Text = task.Status;
            TxtTaskDate.Text = task.Datum;
            TxtTaskUser.Text = task.Mitarbeiter;
            TxtTaskAnsprechpartner.Text = task.Ansprechpartner;
            TxtTaskText.Text = task.Memo;
            TxtTaskTime.Text = task.Zeit;
            TxtTaskDateModified.Text = task.Datum_Edit;
            TxtTaskDateClosed.Text = task.Datum_Close;

            // Set the LockOffline Image
            // If it is offline and the Task is synchronized, it is locked            

            if (Application._user.NetworkStatus == DataAccessLayer.NetworkState.Disconnected && task.ID.StartsWith("OF"))
                SetLockedImage(false);
            else
                SetLockedImage(true);

        }
コード例 #14
0
 public async Task <int> Save(BusinessLayer.Task task)
 {
     return(await this.connection.InsertAsync(task));
 }
コード例 #15
0
 public async System.Threading.Tasks.Task Save(BusinessLayer.Task task)
 {
     await this.database.Save(task);
 }