Пример #1
0
 public override TaskReturnValue Run(HierarchicalBlackboard blackboard)
 {
     while (true)
     {
         TaskReturnValue result = Child.Run(blackboard);
         if (result != TaskReturnValue.SUCCESS)
         {
             break;
         }
     }
     return(TaskReturnValue.SUCCESS);
 }
Пример #2
0
        public TaskReturnValue SaveTask(HostSecurityToken oHostSecurityToken, Task taskDetails)
        {
            TaskReturnValue returnValue = new TaskReturnValue();

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oDiaryService = new DiaryService();
                returnValue   = oDiaryService.SaveTask(Functions.GetLogonIdFromToken(oHostSecurityToken), taskDetails);
            }
            else
            {
                returnValue         = new TaskReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
Пример #3
0
        public TaskReturnValue GetMatterTaskDetails(HostSecurityToken oHostSecurityToken, Guid projectId, Int32 taskId)
        {
            TaskReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oDiaryService = new DiaryService();
                returnValue   = oDiaryService.GetMatterTaskDetails(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId, taskId);
            }
            else
            {
                returnValue         = new TaskReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
 public TaskReturnValue SaveTask(HostSecurityToken oHostSecurityToken, Task taskDetails)
 {
     TaskReturnValue returnValue = new TaskReturnValue();
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oDiaryService = new DiaryService();
         returnValue = oDiaryService.SaveTask(Functions.GetLogonIdFromToken(oHostSecurityToken), taskDetails);
     }
     else
     {
         returnValue = new TaskReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
 public TaskReturnValue GetMemberTaskDetails(HostSecurityToken oHostSecurityToken, Int32 taskId)
 {
     TaskReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oDiaryService = new DiaryService();
         returnValue = oDiaryService.GetMemberTaskDetails(Functions.GetLogonIdFromToken(oHostSecurityToken), taskId);
     }
     else
     {
         returnValue = new TaskReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }
        private void LoadTaskDetails()
        {
            Guid projectId = DataConstants.DummyGuid;
            if (_hdnTaskId.Value.Trim().Length > 0)
            {
                DiaryServiceClient diaryService = new DiaryServiceClient();
                try
                {
                    TaskReturnValue  taskReturnValue = new TaskReturnValue();
                    //If Project Id for matter is null call method GetMemberTaskDetails, else call GetMatterTaskDetails
                    if (Session[SessionName.TaskProjectId] == null)
                    {
                        taskReturnValue = diaryService.GetMemberTaskDetails(_logonSettings.LogonId, Convert.ToInt32(_hdnTaskId.Value));
                    }
                    else
                    {
                        taskReturnValue = diaryService.GetMatterTaskDetails(_logonSettings.LogonId, new Guid(Convert.ToString(Session[SessionName.TaskProjectId])), Convert.ToInt32(_hdnTaskId.Value));
                    }
                    if (taskReturnValue.Success)
                    {
                        if (taskReturnValue != null)
                        {
                            _txtAttendees.Text = taskReturnValue.Task.AttendeesName;
                            _hdnAttendeesMemberId.Value = taskReturnValue.Task.Attendees;
                            _TaskOU.CurrentUsers = taskReturnValue.Task.AttendeesName;
                            _TaskOU.CurrentUsersID = taskReturnValue.Task.Attendees;
                            _txtSubject.Text = taskReturnValue.Task.Subject;
                            if (taskReturnValue.Task.DueDate != DataConstants.BlankDate)
                            {
                                _ccDueDate.DateText = Convert.ToString(taskReturnValue.Task.DueDate);
                            }
                            else
                            {
                                _ccDueDate.DateText = string.Empty;
                            }
                            _chkCompleted.Checked = taskReturnValue.Task.IsCompleted;
                            _chkExposeToThirdParties.Checked = taskReturnValue.Task.IsPublic;

                            if (_ddlType.Items.FindByValue(taskReturnValue.Task.TypeId.ToString()) != null)
                            {
                                _ddlType.SelectedIndex = -1;
                                _ddlType.Items.FindByValue(taskReturnValue.Task.TypeId.ToString()).Selected = true;
                            }

                            _txtNotes.Text = taskReturnValue.Task.Notes;

                            projectId = taskReturnValue.Task.ProjectId;
                            _hdnProjectId.Value = Convert.ToString(projectId);
                        }
                        else
                        {
                            throw new Exception("Load failed.");
                        }
                    }
                    else
                    {
                        throw new Exception(taskReturnValue.Message);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (diaryService.State != System.ServiceModel.CommunicationState.Faulted)
                        diaryService.Close();
                }

                try
                {
                    if (projectId != DataConstants.DummyGuid)
                    {
                        //ViewState["TaskProjectId"] = projectId;
                        _cliMatDetails.ProjectId = projectId;
                        LoadClientMatterDetails(projectId);
                    }
                    else
                    {
                        _cliMatDetails.LoadData = false;
                        //ViewState["TaskProjectId"] = DataConstants.DummyGuid.ToString();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public TaskReturnValue GetMemberTaskDetails(Guid logonId, Int32 taskId)
        {
            TaskReturnValue returnValue = new TaskReturnValue();

            try
            {
                // Get the logged on user from the current logons and add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);
                try
                {
                    Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid);
                    switch (UserInformation.Instance.UserType)
                    {
                        case DataConstants.UserType.Staff:
                            // Can do everything
                            break;
                        case DataConstants.UserType.Client:
                        case DataConstants.UserType.ThirdParty:
                            throw new Exception("Access denied");
                        default:
                            throw new Exception("Access denied");
                    }

                    string attendeesNames = string.Empty;
                    string attendeesIds = string.Empty;

                    Task taskDetails = new Task();
                    SrvBookingEntry bookingEntryData = new SrvBookingEntry();
                    bookingEntryData.OccurrenceData.Id = taskId;

                    bookingEntryData.Load(bookingEntryData.OccurrenceData.Id);

                    this.GetBookingMembers(bookingEntryData.OccurrenceData.Id, ref attendeesNames, ref attendeesIds);

                    taskDetails.AttendeesName = attendeesNames;
                    taskDetails.Attendees = attendeesIds;

                    if (bookingEntryData.OccurrenceData.Id != 0)
                    {
                        taskDetails.Id = bookingEntryData.OccurrenceData.Id;

                        DsMattersForBooking.MatterForBookingDataTable dsMattersForBooking = bookingEntryData.DsBookingsMatters.MatterForBooking;
                        if (dsMattersForBooking.Rows.Count > 0)
                        {
                            taskDetails.ProjectId = new Guid(dsMattersForBooking[0].ProjectId.ToString());
                        }
                        else
                        {
                            taskDetails.ProjectId = DataConstants.DummyGuid;
                        }

                        //taskDetails.StartTime = bookingEntryData.OccurrenceData.StartTime;
                        //taskDetails.EndTime = bookingEntryData.OccurrenceData.EndTime;
                        taskDetails.TypeId = bookingEntryData.OccurrenceData.BookingTypeId;
                        taskDetails.DueDate = bookingEntryData.OccurrenceData.DueDate;
                        taskDetails.Subject = bookingEntryData.OccurrenceData.Text;
                        taskDetails.Notes = bookingEntryData.OccurrenceData.OccurrenceNotes;

                        if (bookingEntryData.OccurrenceData.Progress == 100)
                        {
                            taskDetails.IsCompleted = true;
                        }
                        else
                        {
                            taskDetails.IsCompleted = false;
                        }
                        taskDetails.IsPublic = bookingEntryData.OccurrenceData.IsOccurrencePublic;

                        taskDetails.IsPrivate = bookingEntryData.OccurrenceData.IsPrivateBooking;

                        if (bookingEntryData.OccurrenceData.ReminderDate != Convert.ToDateTime("01/01/1753"))
                        {
                            taskDetails.IsReminderSet = true;
                            taskDetails.ReminderDate = bookingEntryData.OccurrenceData.ReminderDate;
                            taskDetails.ReminderTime = bookingEntryData.OccurrenceData.ReminderTime;
                            taskDetails.ReminderBeforeTime = bookingEntryData.OccurrenceData.ReminderMinutesBefore.ToString();
                        }
                        else
                        {
                            taskDetails.IsReminderSet = false;
                            taskDetails.ReminderTime = string.Empty;
                            taskDetails.ReminderBeforeTime = "0";
                        }
                        taskDetails.ReminderType = "On";

                    }
                    returnValue.Task = taskDetails;
                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }
            return returnValue;
        }
        public TaskReturnValue SaveTask(Guid logonId, Task taskDetails)
        {
            TaskReturnValue returnValue = new TaskReturnValue();

            try
            {
                // Get the logged on user from the current logons acnd add their
                // ApplicationSettings the list of concurrent sessions.
                Host.LoadLoggedOnUser(logonId);

                try
                {
                    Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid);
                    if (taskDetails.ProjectId == Guid.Empty || taskDetails.ProjectId == DataConstants.DummyGuid)
                    {
                        // Non matter task
                        switch (UserInformation.Instance.UserType)
                        {
                            case DataConstants.UserType.Staff:
                                // Can add/edit subject to permissions
                                break;
                            case DataConstants.UserType.Client:
                            case DataConstants.UserType.ThirdParty:
                                if (!UserSecuritySettings.GetUserSecuitySettings(273))
                                {
                                    throw new Exception("Access denied");
                                }
                                break;

                            default:
                                throw new Exception("Access denied");
                        }
                    }
                    else
                        // Matter task
                        switch (UserInformation.Instance.UserType)
                        {
                            case DataConstants.UserType.Staff:
                                // Can add/edit subject to permissions
                                break;
                            case DataConstants.UserType.Client:
                            case DataConstants.UserType.ThirdParty:
                                if (!SrvMatterCommon.WebAllowedToAccessMatter(taskDetails.ProjectId)
                                    || !UserSecuritySettings.GetUserSecuitySettings(273))
                                {
                                    throw new Exception("Access denied");
                                }
                                break;
                            default:
                                throw new Exception("Access denied");
                        }

                    SrvBookingEntry bookingEntryData = new SrvBookingEntry();
                    bookingEntryData.OccurrenceData.Id = taskDetails.Id;

                    var brClients = new BrClients();
                    if (!string.IsNullOrEmpty(taskDetails.ClientId) && !taskDetails.IsContactTask)
                    {
                        var client = brClients.GetClientFromID(new Guid(taskDetails.ClientId));
                        ClientMatterBooking.AddClientMatterToBooking(bookingEntryData, client.Clients[0].memId, client.Clients[0].orgId, DataConstants.DummyGuid);
                    }

                    bookingEntryData.Load(bookingEntryData.OccurrenceData.Id);

                    if (bookingEntryData.OccurrenceData.Id != 0)
                    {
                        // Editing a task
                        bookingEntryData.ActionEditMode = ActionEditMode.Amend;

                        //check that task is public and throw an access denied error if not
                        switch (UserInformation.Instance.UserType)
                        {
                            case DataConstants.UserType.Staff:
                                // Can add/edit subject to permissions
                                break;
                            case DataConstants.UserType.Client:
                            case DataConstants.UserType.ThirdParty:
                                //Must check that task is public and throw an access denied error if not
                                if (!taskDetails.IsPublic)
                                    throw new Exception("Access denied");
                                break;
                            default:
                                throw new Exception("Unknown UserType");
                        }

                    }
                    else
                    {
                        // Adding a new task
                        bookingEntryData.OccurrenceData.BookingText = taskDetails.Subject;
                        bookingEntryData.OccurrenceData.BookingColour = (System.Drawing.Color.Black);

                        // If the starttime/Est time is null, it will not be listed in the search tasks.
                        // To fix this issue, added the below code
                        // Ref:2757
                        if (string.IsNullOrEmpty(bookingEntryData.OccurrenceData.StartTime))
                        {
                            bookingEntryData.OccurrenceData.StartTime = ":";
                        }
                        if (string.IsNullOrEmpty(bookingEntryData.OccurrenceData.EstimatedTime))
                        {
                            bookingEntryData.OccurrenceData.EstimatedTime = ":";
                        }
                    }

                    if (UserInformation.Instance.UserType == DataConstants.UserType.Staff)
                    {
                        // Ensure staff have permission
                        if (bookingEntryData.ActionEditMode == ActionEditMode.Create)
                        {
                            // Create new bookings
                            if (!UserSecuritySettings.GetUserSecuitySettings(100))
                                throw new Exception("You do not have sufficient permissions to carry out this request");
                        }
                        else
                        {
                            // Edit existing bookings
                            if (!UserSecuritySettings.GetUserSecuitySettings(102))
                                throw new Exception("You do not have sufficient permissions to carry out this request");
                        }
                    }

                    DiaryViewMembersDts diaryViewMembers = this.GetDiaryViewMembersDts(taskDetails.Attendees);
                    this.SetBookingMembersData(diaryViewMembers, ref bookingEntryData);

                    #region Add Matter to Task
                    // Adding Matter to the Appointment
                    Guid oldProjectId = DataConstants.DummyGuid;
                    if (bookingEntryData.OccurrenceData.Id != 0)
                    {
                        DsMattersForBooking.MatterForBookingDataTable dsMattersForBooking = bookingEntryData.DsBookingsMatters.MatterForBooking;
                        if (bookingEntryData.DsBookingsMatters.MatterForBooking.Rows.Count > 0)
                        {
                            if (taskDetails.ProjectId != null)
                            {
                                oldProjectId = new Guid(dsMattersForBooking[0].ProjectId.ToString());

                                // If New Matter is same as that of the Old Matter, then don't add any new matters
                                if (oldProjectId != taskDetails.ProjectId)
                                {
                                    // Check if old matter been replaced by new matter is already present in the list or not
                                    // If New Matter is been replaced, then remove Old Matter
                                    // If New Matter been added is already present in the list of existing matters, then throw error
                                    if (!(bookingEntryData.DsBookingsMatters.MatterForBooking.Select(string.Format("ProjectId = '{0}'", taskDetails.ProjectId.ToString())).Length > 0))
                                    {
                                        // Remove Old Matter
                                        if (bookingEntryData.DsBookingsMatters.MatterForBooking.FindByProjectId(oldProjectId.ToString()) != null)
                                        {
                                            bookingEntryData.DsBookingsMatters.MatterForBooking.RemoveMatterForBookingRow(bookingEntryData.DsBookingsMatters.MatterForBooking.FindByProjectId(oldProjectId.ToString()));
                                            Collection<SrvBookingMatter> bookingMatterTableIndividual = bookingEntryData.BookingMatterTable;
                                            this.AddMatterData(ref bookingMatterTableIndividual, bookingEntryData.DsBookingsMatters);
                                        }
                                    }
                                    else if (bookingEntryData.DsBookingsMatters.MatterForBooking.Select(string.Format("ProjectId = '{0}'", taskDetails.ProjectId.ToString())).Length > 1)
                                    {
                                        throw new Exception("This matter is already present for this appointment");
                                    }
                                }
                            }
                        }
                    }

                    // string.IsNullOrEmpty(taskDetails.ClientId) will return false if we are adding the task to a client
                    if (taskDetails.ProjectId != Guid.Empty && string.IsNullOrEmpty(taskDetails.ClientId))
                    {
                        if (taskDetails.ProjectId != DataConstants.DummyGuid)
                        {
                            this.AddMatter(taskDetails.ProjectId, ref bookingEntryData);
                        }
                    }

                    #endregion

                    this.LoadBookingPriority(ref bookingEntryData);

                    bookingEntryData.OccurrenceData.OccurrenceNotes = taskDetails.Notes;
                    bookingEntryData.OccurrenceData.Text = taskDetails.Subject;
                    bookingEntryData.OccurrenceData.DueDate = taskDetails.DueDate;
                    bookingEntryData.OccurrenceData.BookingTypeId = taskDetails.TypeId;
                    bookingEntryData.OccurrenceData.IsOccurrencePublic = taskDetails.IsPublic;
                    bookingEntryData.RecurrenceData.IsTaskEntry = true;
                    bookingEntryData.OccurrenceData.TaskStartDate = Convert.ToDateTime("01/01/1753");

                    if (taskDetails.IsCompleted)
                    {
                        bookingEntryData.OccurrenceData.EndDate = DateTime.Now;
                        // Set Status Default to "Completed"
                        this.LoadBookingStatus(ref bookingEntryData, "Completed");
                        bookingEntryData.OccurrenceData.Progress = 100;
                    }
                    else
                    {
                        bookingEntryData.OccurrenceData.EndDate = DataConstants.BlankDate;
                        // Set Status Default to "Not Set"
                        this.LoadBookingStatus(ref bookingEntryData, "Not Set");
                        bookingEntryData.OccurrenceData.Progress = 0;
                    }

                    // If the status id is sent then set the status based on the id.
                    if (taskDetails.StatusId > 0)
                    {
                        this.LoadBookingStatusById(ref bookingEntryData, taskDetails.StatusId);
                    }

                    bookingEntryData.BookingDates = Convert.ToString(taskDetails.DueDate);

                    bookingEntryData.OccurrenceData.IsPrivateBooking = taskDetails.IsPrivate;

                    if (taskDetails.IsReminderSet)
                    {
                        bookingEntryData.OccurrenceData.ReminderDate = taskDetails.ReminderDate;
                        bookingEntryData.OccurrenceData.ReminderTime = taskDetails.ReminderTime;
                    }
                    else
                    {
                        bookingEntryData.OccurrenceData.ReminderDate = Convert.ToDateTime("01/01/1753");
                        bookingEntryData.OccurrenceData.ReminderTime = "09:00";
                    }

                    bookingEntryData.OccurrenceData.ReminderMinutesBefore = 0;
                    bookingEntryData.OccurrenceData.ReminderFutureAction = 0;
                    bookingEntryData.ReminderRepeatForOccurrences = false;

                    string errorMessage = string.Empty;
                    bool returnValueRows = false;

                    returnValueRows = bookingEntryData.Save(out errorMessage);
                    if (returnValueRows == false)
                    {
                        if (errorMessage != string.Empty)
                        {
                            returnValue.Success = false;
                            returnValue.Message = errorMessage;
                        }
                    }
                    else
                    {
                        taskDetails.Id = bookingEntryData.OccurrenceData.Id;
                        returnValue.Task = taskDetails;
                    }

                }
                finally
                {
                    // Remove the logged on user's ApplicationSettings from the
                    // list of concurrent sessions
                    Host.UnloadLoggedOnUser();
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                returnValue.Success = false;
                returnValue.Message = Functions.SQLErrorMessage;
            }
            catch (Exception Ex)
            {
                returnValue.Success = false;
                returnValue.Message = Ex.Message;
            }
            return returnValue;
        }
Пример #9
0
        public static void Main(string[] args)
        {
            int option    = 1;
            int i_option  = 1;
            int ii_option = 1;

            // YO AMO A MI ESPOSA :) LE VOY A COMPRAR MUCHOS REGALOS :)

            while (option != 0)
            {
                ConsoleUtility.WriteLine("Choose an option based in the next menu");
                ConsoleUtility.WriteLine("1.-Algorithm");
                ConsoleUtility.WriteLine("2.-DataStructures");
                ConsoleUtility.WriteLine("3.-Design Patterns");
                ConsoleUtility.WriteLine("4.-Language DotNet");
                option = Convert.ToInt32(Console.ReadLine());
                switch (option)
                {
                case 1:
                    ConsoleUtility.WriteLine("Algorithm");
                    ConsoleUtility.WriteLine("1.-Linear Table");
                    ConsoleUtility.WriteLine("2.-Linear Table Append");
                    ConsoleUtility.WriteLine("3.-Linear Table Delete");
                    ConsoleUtility.WriteLine("4.-Linear Table Insert");
                    ConsoleUtility.WriteLine("5.-Linear Table Search");
                    ConsoleUtility.WriteLine("6.-Factorial");
                    ConsoleUtility.WriteLine("7.-Bubble Sort");
                    ConsoleUtility.WriteLine("8.-Heap Sort");
                    ConsoleUtility.WriteLine("9.-Insert Sorting");
                    ConsoleUtility.WriteLine("10.-Merge Sort");
                    ConsoleUtility.WriteLine("11.-Quick Sort");
                    ConsoleUtility.WriteLine("12.-Select Sort");
                    ConsoleUtility.WriteLine("13.-Binary Search");
                    ConsoleUtility.WriteLine("14.-Fibonnacci");
                    ConsoleUtility.WriteLine("15.-Fibonacci with Memoization");
                    i_option = Convert.ToInt32(Console.ReadLine());
                    switch (i_option)
                    {
                    case 1:
                        ConsoleUtility.WriteLine("Running example of Linear Table");
                        LinearTable linearTable = new LinearTable();
                        linearTable.Run();
                        break;

                    case 2:
                        ConsoleUtility.WriteLine("Running example of Linear Table Append");
                        LinearTableAppend linearTableAppend = new LinearTableAppend();
                        linearTableAppend.Run();
                        break;

                    case 3:
                        ConsoleUtility.WriteLine("Running example of Linear Table Delete");
                        LinearTableDelete linearTableDelete = new LinearTableDelete();
                        linearTableDelete.Run();
                        break;

                    case 4:
                        ConsoleUtility.WriteLine("Running example of Linear Table Insert");
                        LinearTableInsert linearTableInsert = new LinearTableInsert();
                        linearTableInsert.Run();
                        break;

                    case 5:
                        ConsoleUtility.WriteLine("Running example of Linear Table Search");
                        LinearTableSearch linearTableSearch = new LinearTableSearch();
                        linearTableSearch.Run();
                        break;

                    case 6:
                        ConsoleUtility.WriteLine("Running example of Factorial");
                        Factorial factorial = new Factorial();
                        factorial.Run();
                        break;

                    case 7:
                        ConsoleUtility.WriteLine("Running example of Bubble Sort");
                        BubbleSort bubbleSort = new BubbleSort();
                        bubbleSort.Run();
                        break;

                    case 8:
                        ConsoleUtility.WriteLine("Running example of HeapSort");
                        HeapSort heapSort = new HeapSort();
                        heapSort.Run();
                        break;

                    case 9:
                        ConsoleUtility.WriteLine("Running example of InsertSorting");
                        InsertSorting insertSorting = new InsertSorting();
                        insertSorting.Run();
                        break;

                    case 10:
                        ConsoleUtility.WriteLine("Running example of Merge Sort");
                        MergeSort mergeSort = new MergeSort();
                        mergeSort.Run();
                        break;

                    case 11:
                        ConsoleUtility.WriteLine("Running example pf Quick Sort");
                        QuickSort quickSort = new QuickSort();
                        quickSort.Run();
                        break;

                    case 12:
                        ConsoleUtility.WriteLine("Running example of Select Sort");
                        SelectSort selectSort = new SelectSort();
                        selectSort.Run();
                        break;

                    case 13:
                        ConsoleUtility.WriteLine("Running example of Binary Search");
                        BinarySearch binarySearch = new BinarySearch();
                        binarySearch.Run();
                        break;

                    case 14:
                        ConsoleUtility.WriteLine("Running example of Fibonnacci");
                        Fibonnacci fibonnacci = new Fibonnacci();
                        fibonnacci.Run();
                        break;

                    case 15:
                        ConsoleUtility.WriteLine("Running example of Fibonnaci with Memoization");
                        FibonacciMemoization fibonacciMemoization = new FibonacciMemoization();
                        fibonacciMemoization.Run();
                        break;

                    default:
                        break;
                    }
                    break;

                case 2:
                    ConsoleUtility.WriteLine("Data Structures");
                    ConsoleUtility.WriteLine("1.-Binary Search Tree");
                    ConsoleUtility.WriteLine("2.-Binary Tree");
                    ConsoleUtility.WriteLine("3.-Doubly Linked List");
                    ConsoleUtility.WriteLine("4.-Double Linked List");
                    ConsoleUtility.WriteLine("5.-Hash Table");
                    ConsoleUtility.WriteLine("6.-Linked List");
                    ConsoleUtility.WriteLine("7.-One Way Circular List");
                    ConsoleUtility.WriteLine("8.-Queue");
                    ConsoleUtility.WriteLine("9.-Stack");
                    ConsoleUtility.WriteLine("10.-Two Way Circular List");
                    ConsoleUtility.WriteLine("11.-Unidirectional Linked List");
                    i_option = Convert.ToInt32(Console.ReadLine());
                    ConsoleUtility.WriteLine($"you choose option {i_option}");
                    switch (i_option)
                    {
                    case 1:
                        ConsoleUtility.WriteLine("Running example of Binary Search Tree");
                        BinarySearchTree binarySearchTree = new BinarySearchTree();
                        binarySearchTree.Run();
                        break;

                    case 2:
                        ConsoleUtility.WriteLine("Running example of Binary Tree");
                        BinaryTree binaryTree = new BinaryTree();
                        binaryTree.Run();
                        break;

                    case 3:
                        ConsoleUtility.WriteLine("Running example of DoublyLinkedList");
                        DoublyLinkedList doublyLinkedList = new DoublyLinkedList();
                        doublyLinkedList.Run();
                        break;

                    case 4:
                        ConsoleUtility.WriteLine("Running example of DoubleLinkedList");
                        DoubleLinkedList doubleLinkedList = new DoubleLinkedList();
                        doubleLinkedList.Run();
                        break;

                    case 5:
                        ConsoleUtility.WriteLine("Running example of HashTable");
                        HashTable hashTable = new HashTable();
                        hashTable.Run();
                        break;

                    case 6:
                        ConsoleUtility.WriteLine("Running example of Linked List");
                        LinkedList <int> linkedList = new LinkedList <int>();
                        linkedList.Run();
                        break;

                    case 7:
                        ConsoleUtility.WriteLine("Running example of One Way Circular List");
                        OneWayCircularList circularList = new OneWayCircularList();
                        circularList.Run();
                        break;

                    case 8:
                        ConsoleUtility.WriteLine("Running example of Queue");
                        Queue queue = new Queue();
                        queue.Run();
                        break;

                    case 9:
                        ConsoleUtility.WriteLine("Running example of Stack");
                        Stack stack = new Stack();
                        stack.Run();
                        break;

                    case 10:
                        ConsoleUtility.WriteLine("Running example of Two Way Circular List");
                        TwoWayCircularList twoWay = new TwoWayCircularList();
                        twoWay.Run();
                        break;

                    case 11:
                        ConsoleUtility.WriteLine("Running example fo Unidirectional Linked List");
                        UnidirectionalLinkedList unidirectionalLinkedList = new UnidirectionalLinkedList();
                        unidirectionalLinkedList.Run();
                        break;

                    default:
                        break;
                    }
                    break;

                case 3:
                    ConsoleUtility.WriteLine("Design Patterns");
                    ConsoleUtility.WriteLine("1.-Creational");
                    ConsoleUtility.WriteLine("2.-Structural");
                    ConsoleUtility.WriteLine("3.-Behavioral");
                    ConsoleUtility.WriteLine("4.-SOLID Principles");

                    i_option = Convert.ToInt32(Console.ReadLine());
                    ConsoleUtility.WriteLine($"you choose option {i_option}");
                    switch (i_option)
                    {
                    case 1:
                        ConsoleUtility.WriteLine("Example of creational design patterns");
                        ConsoleUtility.WriteLine("1.-Singleton");
                        ConsoleUtility.WriteLine("2.-Factory");
                        ConsoleUtility.WriteLine("3.-Builder");
                        ConsoleUtility.WriteLine("4.-Prototype");
                        ConsoleUtility.WriteLine("5.-Fluent Interface");
                        ConsoleUtility.WriteLine("6.-Factory Method");
                        ConsoleUtility.WriteLine("7.-Abstract Factory");
                        ConsoleUtility.WriteLine("Select one option");
                        ii_option = Convert.ToInt32(Console.ReadLine());
                        switch (ii_option)
                        {
                        case 1:
                            ConsoleUtility.WriteLine("Running example of singleton design pattern");
                            SingletonTest singletonTest = new SingletonTest();
                            singletonTest.Run();
                            break;

                        case 2:
                            ConsoleUtility.WriteLine("Runnig example of Factory design pattern");
                            FactoryTest factoryTest = new FactoryTest();
                            factoryTest.Run();
                            break;

                        case 3:
                            ConsoleUtility.WriteLine("Running example fo Builder Desiogn Pattern");
                            BuilderTest builderTest = new BuilderTest();
                            builderTest.Run();
                            break;

                        case 4:
                            ConsoleUtility.WriteLine("Running example of Prototype Design Pattern");
                            PrototypeTest prototype = new PrototypeTest();
                            prototype.Run();
                            break;

                        case 5:
                            ConsoleUtility.WriteLine("Running example of Fluent Interface Design Patter");
                            FluentInterface fluent = new FluentInterface();
                            fluent.Run();
                            break;

                        case 6:
                            ConsoleUtility.WriteLine("Running example of Factory Method Design Pattern");
                            FactoryMethodTest factory = new FactoryMethodTest();
                            factory.Run();
                            break;

                        case 7:
                            ConsoleUtility.WriteLine("Running example of Abstract Factory");
                            AbstractFactoryTest abstractFactory = new AbstractFactoryTest();
                            abstractFactory.Run();
                            break;

                        default:
                            break;
                        }
                        break;

                    case 2:
                        ConsoleUtility.WriteLine("Example of Structural Design Pattern");
                        ConsoleUtility.WriteLine("1.-Adapter");
                        ConsoleUtility.WriteLine("2.-Facade");
                        ConsoleUtility.WriteLine("3.-Decorator");
                        ConsoleUtility.WriteLine("4.-Composite");
                        ConsoleUtility.WriteLine("5.-Proxy");
                        ConsoleUtility.WriteLine("6.-Flyweight");
                        ConsoleUtility.WriteLine("7.-Bridge");
                        ii_option = Convert.ToInt32(Console.ReadLine());
                        switch (ii_option)
                        {
                        case 1:
                            ConsoleUtility.WriteLine("Running example of Adapter");
                            AdapterTest adapter = new AdapterTest();
                            adapter.Run();
                            break;

                        case 2:
                            ConsoleUtility.WriteLine("Running example of Facade");
                            FacadeTest facade = new FacadeTest();
                            facade.Run();
                            break;

                        case 3:
                            ConsoleUtility.WriteLine("Running example of Decorator");
                            DecoratorTest decorator = new DecoratorTest();
                            decorator.Run();
                            break;

                        case 4:
                            ConsoleUtility.WriteLine("Running example of Composite");
                            CompositeTest composite = new CompositeTest();
                            composite.Run();
                            break;

                        case 5:
                            ConsoleUtility.WriteLine("Running example of Proxy");
                            ProxyTest proxy = new ProxyTest();
                            proxy.Run();
                            break;

                        case 6:
                            ConsoleUtility.WriteLine("Running example of Flyweight");
                            FlyweightTest flyweight = new FlyweightTest();
                            flyweight.Run();
                            break;

                        case 7:
                            ConsoleUtility.WriteLine("Running example of Bridge");
                            BridgeTest bridge = new BridgeTest();
                            bridge.Run();
                            break;

                        default:
                            break;
                        }
                        break;

                    case 3:
                        ConsoleUtility.WriteLine("Example of Behavioral Design Pattern");
                        ConsoleUtility.WriteLine("1.-Chain of Responsability");
                        ConsoleUtility.WriteLine("2.-Command");
                        ConsoleUtility.WriteLine("3.-Observer");
                        ConsoleUtility.WriteLine("4.-Iterator");
                        ConsoleUtility.WriteLine("5.-State");
                        ConsoleUtility.WriteLine("6.-Template Method");
                        ConsoleUtility.WriteLine("7.-Visitor");
                        ConsoleUtility.WriteLine("8.-Strategy");
                        ConsoleUtility.WriteLine("9.-Mediator");
                        ConsoleUtility.WriteLine("10.-Memento");
                        ConsoleUtility.WriteLine("11.-Interpreter");
                        ii_option = Convert.ToInt32(Console.ReadLine());
                        switch (ii_option)
                        {
                        case 1:
                            ConsoleUtility.WriteLine("Running example of Change Of Responsability");
                            ChainOfResponsability chain = new ChainOfResponsability();
                            chain.Run();
                            break;

                        case 2:
                            ConsoleUtility.WriteLine("Running example of Command");
                            CommandTest command = new CommandTest();
                            command.Run();
                            break;

                        case 3:
                            ConsoleUtility.WriteLine("Running example of Observer");
                            ObserverTest observer = new ObserverTest();
                            observer.Run();
                            break;

                        case 4:
                            ConsoleUtility.WriteLine("Running example of Iterator");
                            IteratorTest iterator = new IteratorTest();
                            iterator.Run();
                            break;

                        case 5:
                            ConsoleUtility.WriteLine("Running example of State");
                            StateTest state = new StateTest();
                            state.Run();
                            break;

                        case 6:
                            ConsoleUtility.WriteLine("Running example of Template Method");
                            TemplateMehodTest templateMehod = new TemplateMehodTest();
                            templateMehod.Run();
                            break;

                        case 7:
                            ConsoleUtility.WriteLine("Running example of Visitor");
                            VisitorTest visitor = new VisitorTest();
                            visitor.Run();
                            break;

                        case 8:
                            ConsoleUtility.WriteLine("Running example of stratgegy");
                            StrategyTest strategy = new StrategyTest();
                            strategy.Run();
                            break;

                        case 9:
                            ConsoleUtility.WriteLine("Running example of Mediator");
                            MediatorTest mediator = new MediatorTest();
                            mediator.Run();
                            break;

                        case 10:
                            ConsoleUtility.WriteLine("Running example of Memento");
                            MementoTest memento = new MementoTest();
                            memento.Run();
                            break;

                        case 11:
                            ConsoleUtility.WriteLine("Running example of Interpreter");
                            InterpreterTest interpreter = new InterpreterTest();
                            interpreter.Run();
                            break;

                        default:
                            break;
                        }
                        break;

                    case 4:
                        ConsoleUtility.WriteLine("Example of SOLID Principles");
                        ConsoleUtility.WriteLine("1.-Single Responsibility Principle");
                        ConsoleUtility.WriteLine("2.-Open-Closed Principle");
                        ConsoleUtility.WriteLine("3.-Liskov Substitution Principle");
                        ConsoleUtility.WriteLine("4.-Interface Segregation Principle");
                        ConsoleUtility.WriteLine("5.-Dependency Inversion Principle");
                        ii_option = Convert.ToInt32(Console.ReadLine());
                        switch (ii_option)
                        {
                        case 1:
                            ConsoleUtility.WriteLine("Running example of Single Responsibility");
                            Invoice invoice = new Invoice();
                            invoice.Run();
                            break;

                        case 2:
                            ConsoleUtility.WriteLine("Running example of Open-Closed Principle");
                            InvoiceOCP invoiceOCP = new InvoiceOCP();
                            invoiceOCP.Run();
                            break;

                        case 3:
                            ConsoleUtility.WriteLine("Running example of Liskov Principle");
                            RunFruit run = new RunFruit();
                            run.Run();
                            break;

                        case 4:
                            ConsoleUtility.WriteLine("Running example of Interface Segregation Principle");
                            Printer printer = new Printer();
                            printer.Run();
                            break;

                        case 5:
                            ConsoleUtility.WriteLine("Running example of Dependency Inversion Principle");
                            RunDIP runDIP = new RunDIP();
                            runDIP.Run();
                            break;
                        }
                        break;

                    default:
                        break;
                    }
                    break;

                case 4:
                    ConsoleUtility.WriteLine("Language DotNet");
                    ConsoleUtility.WriteLine("1.-Abstract");
                    ConsoleUtility.WriteLine("2.-Action");
                    ConsoleUtility.WriteLine("3.-AsyncAwait");
                    ConsoleUtility.WriteLine("4.-Delegate");
                    ConsoleUtility.WriteLine("5.-Extensions");
                    ConsoleUtility.WriteLine("6.-Func");
                    ConsoleUtility.WriteLine("7.-Generics");
                    ConsoleUtility.WriteLine("8.-Predicate");
                    ConsoleUtility.WriteLine("9.-Lock");
                    ConsoleUtility.WriteLine("10.-Reflection");
                    ConsoleUtility.WriteLine("11.-IOC Implementation");
                    ConsoleUtility.WriteLine("12.-Task");
                    ConsoleUtility.WriteLine("13.-Out Variable");
                    ConsoleUtility.WriteLine("14.-Pattern Matching");
                    ConsoleUtility.WriteLine("15.-Digit Separator");
                    ConsoleUtility.WriteLine("16.-Tuples");
                    ConsoleUtility.WriteLine("17.-Ref locals and ref return");
                    ConsoleUtility.WriteLine("18.-AsynReturn");
                    i_option = Convert.ToInt32(Console.ReadLine());
                    switch (i_option)
                    {
                    case 1:
                        ConsoleUtility.WriteLine("Running example of Abstract Class");
                        Square square = new Square();
                        square.Run();
                        break;

                    case 2:
                        ConsoleUtility.WriteLine("Running example of Action");
                        LanguageDotNet.Action action = new LanguageDotNet.Action();
                        action.Run();
                        break;

                    case 3:
                        ConsoleUtility.WriteLine("Running example of AsyncAwait");
                        AsyncAwait asyncAwait = new AsyncAwait();
                        asyncAwait.Run();
                        break;

                    case 4:
                        ConsoleUtility.WriteLine("Running example of Delegate");
                        Number number = new Number();
                        number.Run();
                        break;

                    case 5:
                        ConsoleUtility.WriteLine("Running example of Extensions");
                        IntExtensions intExtensions = new IntExtensions();
                        intExtensions.Run();
                        break;

                    case 6:
                        ConsoleUtility.WriteLine("Running example of Func");
                        Func func = new Func();
                        func.Run();
                        break;

                    case 7:
                        ConsoleUtility.WriteLine("Running example of Generics");
                        Generic generic = new Generic();
                        generic.Run();
                        break;

                    case 8:
                        ConsoleUtility.WriteLine("Running example of Predicate");
                        Predicate predicate = new Predicate();
                        predicate.Run();
                        break;

                    case 9:
                        ConsoleUtility.WriteLine("Running example of Lock");
                        LockTest lockTest = new LockTest();
                        lockTest.runTest();
                        break;

                    case 10:
                        ConsoleUtility.WriteLine("Running example of Reflection");
                        Customer customer = new Customer();
                        customer.Run();
                        break;

                    case 11:
                        ConsoleUtility.WriteLine("Running example of IOC Implementation");
                        IOCImplementation.Run();
                        break;

                    case 12:
                        ConsoleUtility.WriteLine("Running example of Tasks");
                        TaskReturnValue taskReturnValue = new TaskReturnValue();
                        taskReturnValue.Run();
                        break;

                    case 13:
                        ConsoleUtility.WriteLine("Running example of Out variable");
                        OutVariables outVariables = new OutVariables();
                        outVariables.Run();
                        break;

                    case 14:
                        ConsoleUtility.WriteLine("Running example of Pattern Matching");
                        PatternMatching patternMatching = new PatternMatching();
                        patternMatching.Run();
                        break;

                    case 15:
                        ConsoleUtility.WriteLine("Running example of Digit Separators");
                        DigitSeparator digitSeparator = new DigitSeparator();
                        digitSeparator.Run();
                        break;

                    case 16:
                        ConsoleUtility.WriteLine("Running example of Tuple");
                        Tuples tuples = new Tuples();
                        tuples.Run();
                        break;

                    case 17:
                        ConsoleUtility.WriteLine("Running example of Ref locals and ref returns");
                        RefLocalRefReturn refLocalRefReturn = new RefLocalRefReturn();
                        refLocalRefReturn.Run();
                        break;

                    case 18:
                        ConsoleUtility.WriteLine("Running example of AsyncReturn");
                        AsyncReturn asyncReturn = new AsyncReturn();
                        asyncReturn.Run();
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    ConsoleUtility.WriteLine("Exit");
                    break;
                }
            }
        }
        protected void _btnSave_Click(object sender, EventArgs e)
        {
            string errorMessage = CheckMandatoryFields();

            if (string.IsNullOrEmpty(errorMessage))
            {
                DiaryServiceClient diaryService = null;
                try
                {
                    IRIS.Law.WebServiceInterfaces.Diary.Task taskDetails = GetControlData();

                    diaryService = new DiaryServiceClient();
                    TaskReturnValue returnValue = diaryService.SaveTask(_logonSettings.LogonId, taskDetails);

                    if (returnValue.Success)
                    {
                        _hdnTaskId.Value = Convert.ToString(returnValue.Task.Id);

                        _lblError.CssClass = "successMessage";
                        _lblError.Text     = "Task Saved Successfully.";
                    }
                    else
                    {
                        _lblError.CssClass = "errorMessage";

                        if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.")
                        {
                            _lblError.Text = "Due Date is invalid";
                        }
                        else
                        {
                            _lblError.Text = returnValue.Message;
                        }
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    _lblError.Text     = DataConstants.WSEndPointErrorMessage;
                    _lblError.CssClass = "errorMessage";
                }
                catch (Exception ex)
                {
                    _lblError.CssClass = "errorMessage";
                    _lblError.Text     = ex.Message;
                }
                finally
                {
                    if (diaryService != null)
                    {
                        if (diaryService.State != System.ServiceModel.CommunicationState.Faulted)
                        {
                            diaryService.Close();
                        }
                    }
                }
            }
            else
            {
                _lblError.CssClass = "errorMessage";
                _lblError.Text     = errorMessage;
            }
        }
        private void LoadTaskDetails()
        {
            Guid projectId = DataConstants.DummyGuid;

            if (_hdnTaskId.Value.Trim().Length > 0)
            {
                DiaryServiceClient diaryService = new DiaryServiceClient();
                try
                {
                    TaskReturnValue taskReturnValue = new TaskReturnValue();
                    //If Project Id for matter is null call method GetMemberTaskDetails, else call GetMatterTaskDetails
                    if (Session[SessionName.TaskProjectId] == null)
                    {
                        taskReturnValue = diaryService.GetMemberTaskDetails(_logonSettings.LogonId, Convert.ToInt32(_hdnTaskId.Value));
                    }
                    else
                    {
                        taskReturnValue = diaryService.GetMatterTaskDetails(_logonSettings.LogonId, new Guid(Convert.ToString(Session[SessionName.TaskProjectId])), Convert.ToInt32(_hdnTaskId.Value));
                    }
                    if (taskReturnValue.Success)
                    {
                        if (taskReturnValue != null)
                        {
                            _txtAttendees.Text          = taskReturnValue.Task.AttendeesName;
                            _hdnAttendeesMemberId.Value = taskReturnValue.Task.Attendees;
                            _TaskOU.CurrentUsers        = taskReturnValue.Task.AttendeesName;
                            _TaskOU.CurrentUsersID      = taskReturnValue.Task.Attendees;
                            _txtSubject.Text            = taskReturnValue.Task.Subject;
                            if (taskReturnValue.Task.DueDate != DataConstants.BlankDate)
                            {
                                _ccDueDate.DateText = Convert.ToString(taskReturnValue.Task.DueDate);
                            }
                            else
                            {
                                _ccDueDate.DateText = string.Empty;
                            }
                            _chkCompleted.Checked            = taskReturnValue.Task.IsCompleted;
                            _chkExposeToThirdParties.Checked = taskReturnValue.Task.IsPublic;

                            if (_ddlType.Items.FindByValue(taskReturnValue.Task.TypeId.ToString()) != null)
                            {
                                _ddlType.SelectedIndex = -1;
                                _ddlType.Items.FindByValue(taskReturnValue.Task.TypeId.ToString()).Selected = true;
                            }

                            _txtNotes.Text = taskReturnValue.Task.Notes;

                            projectId           = taskReturnValue.Task.ProjectId;
                            _hdnProjectId.Value = Convert.ToString(projectId);
                        }
                        else
                        {
                            throw new Exception("Load failed.");
                        }
                    }
                    else
                    {
                        throw new Exception(taskReturnValue.Message);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (diaryService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        diaryService.Close();
                    }
                }

                try
                {
                    if (projectId != DataConstants.DummyGuid)
                    {
                        //ViewState["TaskProjectId"] = projectId;
                        _cliMatDetails.ProjectId = projectId;
                        LoadClientMatterDetails(projectId);
                    }
                    else
                    {
                        _cliMatDetails.LoadData = false;
                        //ViewState["TaskProjectId"] = DataConstants.DummyGuid.ToString();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }