public override string ToString()
        {
            var  sb    = new StringBuilder();
            bool first = true;

            foreach (var item in _cells)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    sb.Append(Seperator);
                }
                var a = item;

                var x = a.ToString();
                if (x.Contains(Seperator.ToString()))
                {
                    x = "\"" + x.Replace("\"", "\"\"") + "\"";
                }
                sb.Append(x);
            }
            return(sb.ToString());
        }
Example #2
0
        public void BeginSearchFiles(string path, string values, string ext)
        {
            abortSearch = false;

            if (string.IsNullOrEmpty(Seperator))
            {
                _values = new string[] { values.ToString() }
            }
            ;
            else
            {
                string seperator;
                if (Seperator.ToLower() == "[enter]")
                {
                    seperator = "\r\n";
                }
                else
                {
                    seperator = Seperator;
                }
                _values = values.ToString().Split(new string[] { seperator }, StringSplitOptions.RemoveEmptyEntries);
            }

            _extensions    = ext.Split(';');
            Values         = new Dictionary <string, int>();
            ValueFileLists = new Dictionary <string, List <string> >();
            CachedFiles    = new Dictionary <string, string>();
            ParameterizedThreadStart pt = new ParameterizedThreadStart(search);
            Thread t = new Thread(pt);

            t.Start(path);
        }
        /// <summary>
        /// Digital Library
        /// </summary>
        public void DigitalLibraryLayout()
        {
            try
            {
                TitleBar    lblPageName = new TitleBar("Digital Library");
                StackLayout slTitle     = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    Padding         = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children        = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                Label lblMessage = new Label
                {
                    Text      = "This page is under construction.",
                    FontSize  = 14,
                    TextColor = Color.Red
                };

                this.Content = new StackLayout
                {
                    Children        = { slTitle, spTitle.LineSeperatorView, lblMessage },
                    Orientation     = StackOrientation.Vertical,
                    BackgroundColor = LayoutHelper.PageBackgroundColor
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    // Detach pieces from left and right components
    public void RemoveComponents()
    {
        Seperator leftSeperator  = _leftComponent.transform.GetChild(0).GetComponent <Seperator>();
        Seperator rightSeperator = _rightComponent.transform.GetChild(0).GetComponent <Seperator>();

        leftSeperator?.RemoveMainParts();
        rightSeperator?.RemoveMainParts();
    }
Example #5
0
        public CommaSeparatedValues(string raw, Func <string[], T> converter, Seperator seperator = Seperator.Comma, bool hasHeader = false)
        {
            this.Raw       = raw ?? throw new ArgumentNullException(nameof(raw));
            this.Converter = converter ?? throw new ArgumentNullException(nameof(converter));
            var rows = raw.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries);

            var o = rows.Select(x => converter(x.Split((char)seperator)));

            this._list = new List <T>(o.Skip(hasHeader ? 1 : 0));
        }
Example #6
0
        protected override void Execute(NativeActivityContext context)
        {
            if (Seperator.Get(context) == '\0')
            {
                Seperator.Set(context, ' ');
            }

            List <string> exceptionList = new List <string>();
            List <string> dateTimeList  = new List <string>();
            //List<DateTime> dateTimeList = new List<DateTime>();

            int    counter        = 0;
            string logDatePattern = this.DateTimeFormat(Date_Time_Format.Get(context));

            System.IO.StreamReader file = new System.IO.StreamReader(Log_Path.Get(context));

            string    fullFile = file.ReadToEnd();
            ArrayList indexes  = new ArrayList();
            ArrayList values   = new ArrayList();

            foreach (Match match in Regex.Matches(fullFile, Start_Identifier.Get(context), RegexOptions.Singleline))//.Cast<Match>().Select(m => m.Value).ToArray())
            {
                indexes.Add(match.Index);

                values.Add(match.Value);
            }

            string currentException;

            for (int i = 0; i < indexes.Count - 1; i++)
            {
                currentException = fullFile.Substring(int.Parse(indexes[i].ToString()), int.Parse(indexes[i + 1].ToString()) - int.Parse(indexes[i].ToString()));
                if (currentException.Contains(Keyword.Get(context)))
                {
                    exceptionList.Add(currentException.Substring(23));
                    string[] strArray = currentException.Split(Seperator.Get(context));
                    dateTimeList.Add(strArray[Date_Location.Get(context)]);
                    //dateTimeList.Add(DateTime.Parse(strArray[Date_Location.Get(context)]));
                    counter++;
                }
            }

            currentException = fullFile.Substring(int.Parse(indexes[indexes.Count - 1].ToString()), fullFile.Length - int.Parse(indexes[indexes.Count - 1].ToString()));

            if (currentException.Contains(Keyword.Get(context)))
            {
                string[] strArray = currentException.Split(Seperator.Get(context));
                dateTimeList.Add(strArray[Date_Location.Get(context)]);
                //dateTimeList.Add(DateTime.Parse(strArray[Date_Location.Get(context)]));
                counter++;
            }
            List_of_DateTime.Set(context, dateTimeList);
            List_of_Exception.Set(context, exceptionList);
        }
Example #7
0
        public CSVResult <IEnumerable <T> > ProcessCSV <T>(Stream csvStream)
        {
            var result = new CSVResult <IEnumerable <T> >
            {
                Output = new List <T>()
            };

            var records = new List <T>();

            using (var reader = new StreamReader(csvStream))
            {
                var malformedRow  = false;
                var configuration = new CsvConfiguration(CultureInfo.InvariantCulture)
                {
                    Delimiter    = Seperator.ToString(),
                    BadDataFound = context =>
                    {
                        malformedRow = true;
                        result.FailedCount++;
                        Debug.Print(context.RawRecord);
                    }
                };

                using var csv      = new CsvReader(reader, configuration);
                csvStream.Position = 0;
                CsvHelperMapper.RegisterClassMaps(csv.Context);

                while (csv.Read())
                {
                    try
                    {
                        var record = csv.GetRecord <T>();
                        if (!malformedRow)
                        {
                            records.Add(record);
                            result.SuccessCount++;
                        }
                    }
                    catch
                    {
                        result.FailedCount++;
                    }

                    result.ProcessedCount++;
                    malformedRow = false;
                }
            }


            result.Output = records;
            return(result);
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            InputList = value as IEnumerable <object>;
            SetDefaultSeperatorIfNecessary();

            if (HasInputList)
            {
                return(String.Join(Seperator.ToString() + " ", InputList.Select(o => o.ToString()).ToArray()));
            }
            else
            {
                return(DefaultReturnValue);
            }
        }
Example #9
0
        public void DetectSeperator()
        {
            if (Content[0].Contains('\t'))
            {
                DetectedSeperator = Seperator.TAB_SEPERATOR;
            }

            else if (Content[0].Contains(','))
            {
                DetectedSeperator = Seperator.COMMA_SEPERATOR;
            }

            else
            {
                DetectedSeperator = Seperator.INVALID_SEPERATOR;
            }

            Seperator _tempSeperator = Seperator.NOT_YET_DETECTED;

            // Test all lines
            foreach (string line in Content)
            {
                if (line.Contains('\t'))
                {
                    _tempSeperator = Seperator.TAB_SEPERATOR;
                }

                else if (line.Contains(','))
                {
                    _tempSeperator = Seperator.COMMA_SEPERATOR;
                }

                try
                {
                    if (_tempSeperator != DetectedSeperator)
                    {
                        throw new Exceptions.InvalidSeperator("There are different seperators used in the file");
                    }
                }
                catch (Exception ex)
                {
                    Logger.logger.Fatal(ex.Message);
                    Logger.logger.Fatal(ex.StackTrace);
                    throw;
                }
            }

            return;
        }
Example #10
0
 public InputFile(int ID, string Folder, string FullPath, string Name, decimal PercentageLimit, List <Cell> Cells, int CellCount, int RowCount, double TotalDetectedMinutes, string[] Content,
                  int StimulationTimeframe, string SelectedNormalizationMethod, int TimeFrameCount, Seperator DetectedSeperator, bool Prepared, bool Invalid)
 {
     _id                          = ID;
     _name                        = Name;
     _fullpath                    = FullPath;
     _folder                      = Folder;
     _percentageLimit             = PercentageLimit;
     _cells                       = Cells;
     _cellCount                   = CellCount;
     _rowCount                    = RowCount;
     _totalDetectedMinutes        = TotalDetectedMinutes;
     _content                     = Content;
     _stimulationTimeframe        = StimulationTimeframe;
     _selectedNormalizationMethod = SelectedNormalizationMethod;
     _timeframeCount              = TimeFrameCount;
     _detectedSeperator           = DetectedSeperator;
     _prepared                    = Prepared;
     _invalid                     = Invalid;
 }
Example #11
0
        public static List <string> LoadCharacters(string fileName)
        {
            int           lineNumber = 0;
            const string  Seperator  = ";";
            List <string> characters = new List <string>();

            foreach (string line in System.IO.File.ReadAllLines(fileName))
            {
                string[] parts = line.Split(Seperator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length > 0)
                {
                    try
                    {
                        string text = Utilities.FixQuotes(parts[0]);
                        if (text.Trim().Length > 0)
                        {
                            if (characters.IndexOf(text) == -1)
                            {
                                if (parts.Length > 1)
                                {
                                    text = text + " [" + Utilities.FixQuotes(parts[1]) + "]";
                                }

                                if (lineNumber == 0 && (text.ToLower().StartsWith("character [") || text.ToLower() == "character"))
                                {
                                }
                                else
                                {
                                    characters.Add(text);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                lineNumber++;
            }
            return(characters);
        }
Example #12
0
            public IncludeSelectOptions(ODataQueryOptions options)
            {
                var se = options.SelectExpand;

                if (se != null)
                {
                    if (se.RawExpand != null)
                    {
                        Includes = se.RawExpand.Split(splitter);
                    }
                    if (se.RawSelect != null)
                    {
                        Selects = se.RawSelect.Split(splitter);
                    }
                }
                if (options.Filter != null)
                {
                    var navs = FindNavigationFilterOptions.GetPaths(options.Filter, Seperator.ToString());
                    if (navs.Any())
                    {
                        Includes = (Includes ?? new string[0]).Union(navs).ToArray();
                    }
                }
                if (options.OrderBy != null)
                {
                    var orderProps = new HashSet <string>(Includes ?? new string[0]);
                    foreach (var n in options.OrderBy.RawValue.Split(splitter))
                    {
                        int i = n.LastIndexOf(Seperator);
                        if (i > -1)
                        {
                            orderProps.Add(n.Substring(0, i));
                        }
                    }
                    Includes = orderProps.ToArray();
                }
            }
Example #13
0
        /// <summary>
        /// Student BehaviourNotice Layout.
        /// </summary>
        public void StudentBehaviourLayout()
        {
            TitleBar    lblPageName = new TitleBar("Student Behaviour Notice");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgClassDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblClass = new Label {
                TextColor = Color.Black, Text = "Class"
            };
            Picker pcrClass = new Picker {
                IsVisible = false, Title = "Class"
            };

            StackLayout slClassDisplay = new StackLayout {
                Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmClass = new Frame
            {
                Content           = slClassDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var classTap = new TapGestureRecognizer();

            classTap.NumberOfTapsRequired = 1; // single-tap
            classTap.Tapped += (s, e) =>
            {
                pcrClass.Focus();
            };
            frmClass.GestureRecognizers.Add(classTap);
            slClassDisplay.GestureRecognizers.Add(classTap);

            StackLayout slClassFrmaeLayout = new StackLayout
            {
                Children = { frmClass }
            };

            StackLayout slClassLayout = new StackLayout
            {
                Children          = { slClassFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgStudentNameDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStudentName = new Label {
                TextColor = Color.Black, Text = "Student Name"
            };
            Picker pcrStudentName = new Picker {
                IsVisible = false, Title = "Student Name"
            };

            StackLayout slStudentNameDisplay = new StackLayout {
                Children = { lblStudentName, pcrStudentName, imgStudentNameDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStudentName = new Frame
            {
                Content           = slStudentNameDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var studentNameTap = new TapGestureRecognizer();

            studentNameTap.NumberOfTapsRequired = 1; // single-tap
            studentNameTap.Tapped += (s, e) =>
            {
                pcrStudentName.Focus();
            };
            frmStudentName.GestureRecognizers.Add(studentNameTap);
            slStudentNameDisplay.GestureRecognizers.Add(studentNameTap);

            StackLayout slStudentNameFrmaeLayout = new StackLayout
            {
                Children = { frmStudentName }
            };

            StackLayout slStudentNameLayout = new StackLayout
            {
                Children          = { slStudentNameFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            //ExtendedEntry txtComment = new ExtendedEntry
            //{
            //    Placeholder = "Comment",
            //    TextColor = Color.Black
            //};

            Label lblComment = new Label
            {
                Text      = "Comment",
                TextColor = Color.Black
            };

            StackLayout slLableComment = new StackLayout
            {
                Children = { lblComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            Editor txtComment = new Editor
            {
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slTextComment = new StackLayout
            {
                Children = { txtComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtComment.Focused += (sender, e) =>
            //{
            //    if (txtComment.Text == "Comment")
            //    {
            //        txtComment.Text = string.Empty;
            //        //txtComment.TextColor = Color.Black;
            //    }
            //};

            StackLayout slComment = new StackLayout
            {
                Children          = { slLableComment, slTextComment },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            StackLayout slSearchinOneCol = new StackLayout
            {
                Children    = { slStandardLayout, slClassLayout },
                Orientation = StackOrientation.Horizontal
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStudentNameLayout, slComment }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrClass.Items.Clear();
                    pcrStudentName.Items.Clear();

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                    if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                    {
                        slClassLayout.IsVisible = true;
                        _NotAvailData.IsVisible = false;
                    }
                    else
                    {
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (ClassTypeModel item in _ClassTypeList)
                    {
                        pcrClass.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            //Class Picker Selected

            pcrClass.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrStudentName.Items.Clear();

                    string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                    _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                    List <StudentModel> lstStudentList = await StudentModel.GetStudent(_SelectedStandardID, _SelectedClassTypeID);

                    if (lstStudentList != null && lstStudentList.Count > 0)
                    {
                        slStudentNameLayout.IsVisible = true;
                        _NotAvailData.IsVisible       = false;

                        foreach (StudentModel item in _StudentModelList)
                        {
                            pcrStudentName.Items.Add(item.Name);
                        }
                    }
                    else
                    {
                        _NotAvailData.Text      = "There is no student for this class and standard";
                        _NotAvailData.IsVisible = true;
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            Button btnSave = new Button {
                IsVisible = false
            };

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            pcrStudentName.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    //btnSave.IsVisible = true;
                    string studentName = lblStudentName.Text = pcrStudentName.Items[pcrStudentName.SelectedIndex];

                    _SelectedStudentID = _StudentModelList.FirstOrDefault(x => x.Name == studentName).Id;

                    //Exam list call
                    slStudentNameLayout.IsVisible = true;
                });
            };

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    StudentBehaviourNoticeModel studentBehaviourNoticeModel = new StudentBehaviourNoticeModel();
                    studentBehaviourNoticeModel.ClassTypeId = _SelectedClassTypeID;
                    studentBehaviourNoticeModel.StandardId  = _SelectedStandardID;
                    studentBehaviourNoticeModel.StudentId   = _SelectedStudentID;
                    studentBehaviourNoticeModel.Comment     = txtComment.Text;

                    bool isSaveAttendance = await StudentBehaviourNoticeModel.SaveStudentBehaviour(studentBehaviourNoticeModel);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slStudentBehaviourNotice = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchinOneCol, slSearchLayout, _Loader, cvBtnSave, _NotAvailData },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slStudentBehaviourNotice,
            };
        }
Example #14
0
        /// <summary>
        /// View Result
        /// </summary>
        public void ViewResultLayout()
        {
            try
            {
                TitleBar    lblPageName = new TitleBar("View Result");
                StackLayout slTitle     = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    Padding         = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children        = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                Image stdExamMasterDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblStdExamMaster = new Label {
                    TextColor = Color.Black, Text = "Standard Exam Master"
                };
                Picker pcrStdExamMaster = new Picker {
                    Title = "Standard Exam Master", IsVisible = false
                };

                foreach (StandardExamMasterModel item in _StandardExamMasterList)
                {
                    pcrStdExamMaster.Items.Add(item.Name);
                }

                StackLayout slStdExamMasterDisplay = new StackLayout {
                    Children = { lblStdExamMaster, pcrStdExamMaster, stdExamMasterDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
                };

                Frame frmStdExamMaster = new Frame
                {
                    Content           = slStdExamMasterDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var stdExamMasterTap = new TapGestureRecognizer();

                stdExamMasterTap.NumberOfTapsRequired = 1; // single-tap
                stdExamMasterTap.Tapped += (s, e) =>
                {
                    pcrStdExamMaster.Focus();
                };
                frmStdExamMaster.GestureRecognizers.Add(stdExamMasterTap);
                slStdExamMasterDisplay.GestureRecognizers.Add(stdExamMasterTap);

                StackLayout slStdExamMasterFrameLayout = new StackLayout
                {
                    Children = { frmStdExamMaster }
                };

                StackLayout slStdExamMasterLayout = new StackLayout
                {
                    Children          = { slStdExamMasterFrameLayout },
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                StackLayout slSearchLayout = new StackLayout
                {
                    Orientation = StackOrientation.Vertical,
                    Padding     = new Thickness(0, 0, 0, 10),
                    Children    = { slStdExamMasterLayout }
                };

                _NotAvailData = new Label {
                    Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
                };

                _Loader = new LoadingIndicator();

                ListView ViewResultListView = new ListView
                {
                    RowHeight      = 80,
                    SeparatorColor = Color.Gray
                };

                ViewResultListView.ItemTemplate = new DataTemplate(() => new ViewResultCell());

                //Grid Header Layout
                Label lblTotalMarks = new Label
                {
                    Text      = "Total",
                    TextColor = Color.Black
                };

                StackLayout slTotalMarks = new StackLayout
                {
                    Children          = { lblTotalMarks },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

                Label lblSubjectName = new Label
                {
                    Text      = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubjectName = new StackLayout
                {
                    Children          = { lblSubjectName },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblObtainMarks = new Label
                {
                    Text      = "Obtain Marks",
                    TextColor = Color.Black
                };

                StackLayout slObtainMarks = new StackLayout
                {
                    Children          = { lblObtainMarks },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                Label lblIsPass = new Label
                {
                    Text      = "Is Pass",
                    TextColor = Color.Black
                };

                StackLayout slIsPass = new StackLayout
                {
                    Children          = { lblIsPass },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout grid = new StackLayout
                {
                    Children    = { slTotalMarks, slSubjectName, slObtainMarks, slIsPass },
                    Orientation = StackOrientation.Horizontal,
                    //VerticalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                Seperator spDisplayHeader = new Seperator {
                    IsVisible = false
                };

                pcrStdExamMaster.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        _Loader.IsShowLoading = true;
                        Items = new ObservableCollection <StudentMarksDetailModel>();

                        string StandardExamMaster     = lblStdExamMaster.Text = pcrStdExamMaster.Items[pcrStdExamMaster.SelectedIndex];
                        _SelectedStandardExamMasterID = _StandardExamMasterList.Where(x => x.Name == StandardExamMaster).FirstOrDefault().Id;

                        List <StudentMarksDetailModel> lstExamMarksResult = await StudentMarksDetailModel.ViewResult(_SelectedStandardExamMasterID);

                        if (lstExamMarksResult != null && lstExamMarksResult.Count > 0)
                        {
                            _NotAvailData.IsVisible   = false;
                            grid.IsVisible            = true;
                            spDisplayHeader.IsVisible = true;

                            Items = new ObservableCollection <StudentMarksDetailModel>(lstExamMarksResult);
                            ViewResultListView.ItemsSource = Items;
                        }
                        else
                        {
                            _NotAvailData.IsVisible   = true;
                            grid.IsVisible            = false;
                            spDisplayHeader.IsVisible = false;
                        }

                        _Loader.IsShowLoading = false;
                    });
                };

                StackLayout slExamTimeTable = new StackLayout
                {
                    Children =
                    {
                        new StackLayout {
                            Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                            Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData, ViewResultListView },
                            VerticalOptions = LayoutOptions.FillAndExpand,
                        },
                    },
                    BackgroundColor = LayoutHelper.PageBackgroundColor
                };

                Content = new ScrollView
                {
                    Content = slExamTimeTable,
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #15
0
        private void SearchValues(object values)
        {
            string sRet = "";

            values = values.ToString().Replace("'", "");

            string[] asValues;
            if (string.IsNullOrEmpty(Seperator))
            {
                asValues = new string[] { values.ToString() }
            }
            ;
            else
            {
                string seperator;
                if (Seperator.ToLower() == "[enter]")
                {
                    seperator = "\r\n";
                }
                else
                {
                    seperator = Seperator;
                }
                asValues = values.ToString().Split(new string[] { seperator }, StringSplitOptions.RemoveEmptyEntries);
            }

            Dictionary <string, int> dictValueFoundCount = new Dictionary <string, int>();

            SearchedValues = new Dictionary <string, a7SearchedValue>();
            int tablesAnalyzed      = 0;
            int selectedTablesCount = 0;

            foreach (KeyValuePair <string, a7TableSelection> kv in DictTables)
            {
                if (kv.Value.IsSelected)
                {
                    selectedTablesCount++;
                }
            }
            foreach (KeyValuePair <string, List <a7TableColumn> > kv in dictTable_ColumnNames)
            {
                if (!DictTables[kv.Key].IsSelected)
                {
                    continue;
                }
                int valuesAnalyzed = 0;
                foreach (string value in asValues)
                {
                    a7SearchedValue searchedValue;
                    if (SearchedValues.ContainsKey(value))
                    {
                        searchedValue = SearchedValues[value];
                    }
                    else
                    {
                        searchedValue         = new a7SearchedValue(value);
                        SearchedValues[value] = searchedValue;
                    }
                    string sql = "SELECT * FROM " + kv.Key + " WHERE ";
                    bool   stringColumnFound = false;
                    if (AndSeperator == "")
                    {
                        bool firstWhere = true;
                        foreach (a7TableColumn tc in kv.Value)
                        {
                            if (tc.IsStringColumn)
                            {
                                stringColumnFound = true;
                                if (firstWhere)
                                {
                                    firstWhere = false;
                                }
                                else
                                {
                                    sql += " OR ";
                                }
                                sql += tc.ColumnName + " LIKE ('%" + value.Trim() + "%')";
                            }
                        }
                    }
                    else
                    {
                        string[] andValues = value.Split(new string[] { AndSeperator }, StringSplitOptions.RemoveEmptyEntries);
                        bool     firstAnd  = true;
                        foreach (string singleAndValue in andValues)
                        {
                            if (firstAnd)
                            {
                                firstAnd = false;
                            }
                            else
                            {
                                sql += " AND ";
                            }
                            sql += " ( ";
                            bool firstWhere = true;
                            foreach (a7TableColumn tc in kv.Value)
                            {
                                if (tc.IsStringColumn)
                                {
                                    stringColumnFound = true;
                                    if (firstWhere)
                                    {
                                        firstWhere = false;
                                    }
                                    else
                                    {
                                        sql += " OR ";
                                    }
                                    sql += "[" + tc.ColumnName + "]" + " LIKE ('%" + singleAndValue.Trim() + "%')";
                                }
                            }
                            sql += " ) ";
                        }
                    }
                    if (abortSearch)
                    {
                        return;
                    }
                    if (!stringColumnFound)
                    {
                        continue;
                    }
                    SqlCommand     comm    = new SqlCommand(sql, ExportConfiguration.SqlConnection);
                    SqlDataAdapter adapter = new SqlDataAdapter(comm);
                    try
                    { //TODO - sypie sie brzydkie to jest :)
                        SqlCommandBuilder sqlBuilder = new SqlCommandBuilder(adapter);
                        adapter.UpdateCommand = sqlBuilder.GetUpdateCommand();
                        adapter.InsertCommand = sqlBuilder.GetInsertCommand();
                        adapter.DeleteCommand = sqlBuilder.GetDeleteCommand();
                    }
                    catch
                    {
                    }
                    DataTable dt = new DataTable(kv.Key);
                    adapter.Fill(dt);
                    searchedValue.AddDataTable(dt, adapter);
                    if (!dictValueFoundCount.ContainsKey(value))
                    {
                        dictValueFoundCount[value] = int.Parse(dt.Rows.Count.ToString());
                    }
                    else
                    {
                        dictValueFoundCount[value] += int.Parse(dt.Rows.Count.ToString());
                    }
                    valuesAnalyzed++;
                    OnActualizedWork(kv.Key, value, tablesAnalyzed, selectedTablesCount, valuesAnalyzed, asValues.Length);
                }
                tablesAnalyzed++;
            }
            foreach (KeyValuePair <string, int> kv in dictValueFoundCount)
            {
                if (kv.Value == 0)
                {
                    sRet += "'" + kv.Key + "',";
                }
            }
            if (FinishedSearch != null)
            {
                FinishedSearch(this, new DBSearchFinishedEventArgs(sRet));
            }
            OnPropertyChanged("SearchedValues");
        }
Example #16
0
        public void InterviewMatrixLayout(List <Models.CandidateDetails> candidateListForIm)
        {
            if (ACTContext.isLogin == true)
            {
                #region header text
                Label lblInterviewMatrixInfo = new Label {
                    Text = "Interview Matrix", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f"), FontSize = 18, FontAttributes = FontAttributes.Bold, HeightRequest = 30
                };
                Label interviewMatrixInfo = new Label {
                    Text = "", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, HeightRequest = 40
                };
                StackLayout sInterviewMatrixInfo = new StackLayout
                {
                    Children    = { lblInterviewMatrixInfo, interviewMatrixInfo },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 50, 0, 0)
                };
                #endregion

                #region candidate name
                Label lblCandidatePickerTitle = new Label {
                    Text = "Candidate Name", TextColor = Color.Gray
                };
                pkrCandidateName = new Picker {
                    IsVisible = false
                };
                pkrCandidateName.Title = "Candidate Name";
                foreach (CandidateDetails item in candidateListForIm)
                {
                    pkrCandidateName.Items.Add(item.CandidateName.ToString());
                }
                pkrCandidateName.SelectedIndexChanged += (s, e) =>
                {
                    lblCandidatePickerTitle.TextColor = Color.Black;
                    lblCandidatePickerTitle.Text      = pkrCandidateName.Items[pkrCandidateName.SelectedIndex].ToString();
                };
                Image imgPkrCandidateNameDropdown = new Image {
                    Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout sPkrCandidateName = new StackLayout {
                    Children = { lblCandidatePickerTitle, pkrCandidateName, imgPkrCandidateNameDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5)
                };
                Frame frmPkrCandidateName = new Frame {
                    Content = sPkrCandidateName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false
                };

                recognizerCandidateName.NumberOfTapsRequired = 1;
                recognizerCandidateName.Tapped += (s, e) =>
                {
                    pkrCandidateName.Focus();
                };
                frmPkrCandidateName.GestureRecognizers.Add(recognizerCandidateName);
                Seperator candidateNameSeparator = new Seperator();


                Button btnSubmitCandidate = new Button {
                    Text = "Submit", HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, WidthRequest = 80, FontAttributes = FontAttributes.None, HeightRequest = 40
                };
                StackLayout sBtnSubmitCandidate = new StackLayout
                {
                    Children    = { btnSubmitCandidate },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 5, 0, 5)
                };

                #endregion

                #region candidate information

                #region first name
                //First Name
                Label lblCandidateFirstName = new Label {
                    Text = "First name : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateFirstNameText = new Label {
                    Text = "demo demo demo", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black
                };
                StackLayout slblCandidateFirstName = new StackLayout
                {
                    Children          = { lblCandidateFirstName, lblCandidateFirstNameText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorFirstName = new Seperator();
                #endregion

                #region last name
                //Last Name
                Label lblCandidateLastName = new Label {
                    Text = "Last name : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateLastNameText = new Label {
                    Text = "demo demo", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black
                };
                StackLayout slblCandidateLastName = new StackLayout
                {
                    Children          = { lblCandidateLastName, lblCandidateLastNameText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorLastName = new Seperator();
                #endregion

                #region address
                //Address
                Label lblCandidateAddress = new Label {
                    Text = "Address : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateAddressText = new Label {
                    Text = "demo address", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black
                };
                StackLayout slblCandidateAddress = new StackLayout
                {
                    Children          = { lblCandidateAddress, lblCandidateAddressText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorAddress = new Seperator();
                #endregion

                #region educational qualification
                //Educational qualification
                Label lblCandidateEducationalQualification = new Label {
                    Text = "Educational Qualification : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateEducationalQualificationText = new Label {
                    Text = "demo qualification", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black
                };
                StackLayout slblCandidateEducationalQualification = new StackLayout
                {
                    Children          = { lblCandidateEducationalQualification, lblCandidateEducationalQualificationText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorEducationalQualification = new Seperator();
                #endregion

                #region candidate information stack layout
                slCandidateInformation = new StackLayout
                {
                    Children = { slblCandidateFirstName,                separatorFirstName,
                                 slblCandidateLastName,                 separatorLastName,
                                 slblCandidateAddress,                  separatorAddress,
                                 slblCandidateEducationalQualification, separatorEducationalQualification }
                };
                slCandidateInformation.IsVisible = false;
                #endregion

                #region submit button click
                btnSubmitCandidate.Clicked += (object sender, EventArgs e) =>
                {
                    if (Validate())
                    {
                        slCandidateInformation.IsVisible = true;

                        sListView.IsVisible    = true;
                        slHeaderText.IsVisible = true;
                        sSeparatorListviewInterviewRounds.IsVisible = true;

                        slHeaderTextForLineItem.IsVisible = true;
                        sListViewLineItemDetail.IsVisible = true;
                        spForLineItemDetail.IsVisible     = true;

                        sOverallRemarkAdd.IsVisible  = true;
                        spOverallRemarkAdd.IsVisible = true;

                        sAverageRatingAdd.IsVisible  = true;
                        spAverageRatingAdd.IsVisible = true;

                        sSwithForCandidateSelected.IsVisible = true;

                        sSwithForCandidateMoveToNextRound.IsVisible = true;

                        slAfterSaveResponseAllInformation.IsVisible = true;
                        sbtnSaveAllInfo.IsVisible = true;

                        slineItemAdd.IsVisible  = true;
                        spLineItemAdd.IsVisible = true;

                        slAfterSaveResponseLineItem.IsVisible = true;

                        sbtnSaveDataLineItem.IsVisible = true;

                        int candidateId = (from c in candidateListForIm where c.CandidateName == pkrCandidateName.Items[pkrCandidateName.SelectedIndex] select c.CandidateId).SingleOrDefault();
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            //var result = await Service.GetCandidateInformation(interviewId2, ACTContext.interviewerId);
                            var result = await Service.GetCandidateDetailWithInterview(candidateId, 1);
                            var resultCandidateDetailListWithInterview = await Service.GetCandidateDetailWithInterview(candidateId, 1);
                            if (result != null)
                            {
                                interviewsModel            = JsonConvert.DeserializeObject <InterviewsModel>(result);
                                canditeDetailWithInterview = JsonConvert.DeserializeObject <InterviewsModel>(resultCandidateDetailListWithInterview);
                            }
                            lblCandidateFirstNameText.Text = interviewsModel.FirstName;
                            lblCandidateLastNameText.Text  = interviewsModel.LastName;
                            lblCandidateAddressText.Text   = interviewsModel.Address1;
                            lblCandidateEducationalQualificationText.Text = interviewsModel.QualificationName;

                            //for line item listview
                            List <InterviewsModel> interviewLineItemDetailObservableCollection = new List <InterviewsModel>();
                            interviewLineItemDetailObservableCollection = canditeDetailWithInterview.InterviewList;

                            List <Ratings> ratingListObservableCollection = new List <Ratings>();
                            foreach (var item in canditeDetailWithInterview.InterviewList)
                            {
                                for (int i = 0; i < item.RatingList.Count; i++)
                                {
                                    ratingListObservableCollection.Add(item.RatingList[i]);
                                }
                            }

                            listViewLineItemDetail.HeightRequest = 50 * ratingListObservableCollection.Count;
                            listViewLineItemDetail.ItemsSource   = ratingListObservableCollection;
                            listViewLineItemDetail.ItemTemplate  = new DataTemplate(() => new LineItemDetailCell(interviewLineItemDetailObservableCollection, ratingListObservableCollection));


                            //for overall listview
                            List <InterviewsModel> interviewRoundDetailObservableCollection = new List <InterviewsModel>();
                            interviewRoundDetailObservableCollection = canditeDetailWithInterview.InterviewList;



                            listView.HeightRequest = 50 * interviewRoundDetailObservableCollection.Count;

                            listView.ItemsSource  = interviewRoundDetailObservableCollection;
                            listView.ItemTemplate = new DataTemplate(() => new InterviewMatrixCell(interviewRoundDetailObservableCollection, candidateListForIm, canditeDetailWithInterview));
                        });
                    }
                };
                #endregion

                #endregion

                #region listView
                sListView = new StackLayout
                {
                    Children    = { listView },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                sListView.IsVisible = false;
                #endregion

                #region interview round detail
                slHeaderText = new StackLayout();
                Label lblCandidateName = new Label {
                    Text = "Name", FontAttributes = FontAttributes.Bold, WidthRequest = 50, HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.FromHex("5e247f")
                };
                Label lblRound = new Label {
                    Text = "Round", FontAttributes = FontAttributes.Bold, WidthRequest = 50, HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.FromHex("5e247f")
                };
                Label lblRemark = new Label {
                    Text = "Remark", FontAttributes = FontAttributes.Bold, WidthRequest = 50, HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.FromHex("5e247f")
                };
                //Label lblAverageRating = new Label { Text = "Average Rating", FontAttributes = FontAttributes.Bold, WidthRequest = 80, HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f") };
                //Label lblSelected = new Label { Text = "Selected", FontAttributes = FontAttributes.Bold, WidthRequest = 80, HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f") };
                slHeaderText = new StackLayout
                {
                    Children    = { lblCandidateName, lblRound, lblRemark },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                slHeaderText.IsVisible = false;

                StackLayout slCandidateInterviewInfo = new StackLayout
                {
                    Children    = { sListView },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                BoxView separatorListviewInterviewRounds = new BoxView()
                {
                    Color = Color.Gray, HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                sSeparatorListviewInterviewRounds = new StackLayout
                {
                    Children    = { separatorListviewInterviewRounds },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                sSeparatorListviewInterviewRounds.IsVisible = false;
                #endregion

                #region separator
                BoxView separator1 = new BoxView()
                {
                    Color = Color.Gray, HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout sSeparator1 = new StackLayout
                {
                    Children    = { separator1 },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                BoxView separator2 = new BoxView()
                {
                    Color = Color.Gray, HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout sSeparator2 = new StackLayout
                {
                    Children    = { separator2 },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                BoxView separator3 = new BoxView()
                {
                    Color = Color.Gray, HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout sSeparator3 = new StackLayout
                {
                    Children    = { separator3 },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                BoxView separator4 = new BoxView()
                {
                    Color = Color.Gray, HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout sSeparator4 = new StackLayout
                {
                    Children    = { separator4 },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                #endregion

                #region listViewFor LineItem rating and remark


                Label lblRoundLineItem = new Label {
                    Text = "Round", FontAttributes = FontAttributes.Bold, WidthRequest = 50, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f"), HeightRequest = 30
                };
                Label lblLineItemName = new Label {
                    Text = "Parameter", FontAttributes = FontAttributes.Bold, WidthRequest = 70, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f"), HeightRequest = 30
                };
                Label lblRatingLineItem = new Label {
                    Text = "Rating", FontAttributes = FontAttributes.Bold, WidthRequest = 50, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f"), HeightRequest = 30
                };
                Label lblRemarkLineItem = new Label {
                    Text = "Remark", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f"), HeightRequest = 30
                };
                Label lblSelectedLineItem = new Label {
                    Text = "Selected", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.End, TextColor = Color.FromHex("5e247f"), HeightRequest = 30
                };
                slHeaderTextForLineItem = new StackLayout
                {
                    Children        = { lblRoundLineItem, lblLineItemName, lblRatingLineItem, lblRemarkLineItem, lblSelectedLineItem },
                    Orientation     = StackOrientation.Horizontal,
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    Padding         = new Thickness(0, 20, 0, 0)
                };
                slHeaderTextForLineItem.IsVisible = false;

                spForLineItemDetail.IsVisible = false;
                sListViewLineItemDetail       = new StackLayout
                {
                    Children    = { listViewLineItemDetail },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                sListViewLineItemDetail.IsVisible = false;
                #endregion

                #region overall remark
                overallRemarkAdd = new CustomEntryForGeneralPurpose {
                    Placeholder = "Add overall remark here", HorizontalOptions = LayoutOptions.FillAndExpand
                };
                sOverallRemarkAdd = new StackLayout
                {
                    Children    = { overallRemarkAdd },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                sOverallRemarkAdd.IsVisible  = false;
                spOverallRemarkAdd.IsVisible = false;
                #endregion

                #region average rating
                averageRatingAdd = new CustomEntryForGeneralPurpose {
                    Placeholder = "Add average rating here", HorizontalOptions = LayoutOptions.FillAndExpand, Keyboard = Keyboard.Numeric
                };
                averageRatingAdd.Behaviors.Add(new DecimalNumberValidationBehaviour());
                sAverageRatingAdd = new StackLayout
                {
                    Children    = { averageRatingAdd },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                sAverageRatingAdd.IsVisible  = false;
                spAverageRatingAdd.IsVisible = false;
                #endregion

                #region seleted or not
                Label lblCandidateSelected = new Label {
                    Text = "Selected", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black, WidthRequest = 80
                };
                Switch switchForLblCandidateSelected = new Switch {
                    MinimumWidthRequest = 50, HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.Transparent
                };
                sSwithForCandidateSelected = new StackLayout
                {
                    Children    = { lblCandidateSelected, switchForLblCandidateSelected },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 0)
                };
                sSwithForCandidateSelected.IsVisible = false;
                #endregion

                #region move to next round
                Label lblCandidateMoveToNextRound = new Label {
                    Text = "Move to next round", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black, WidthRequest = 80
                };
                Switch switchForLblCandidateMoveToNextRound = new Switch {
                    MinimumWidthRequest = 50, HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.Transparent
                };
                sSwithForCandidateMoveToNextRound = new StackLayout
                {
                    Children    = { lblCandidateMoveToNextRound, switchForLblCandidateMoveToNextRound },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 10)
                };
                sSwithForCandidateMoveToNextRound.IsVisible = false;
                #endregion

                #region save button for saving all information
                Label AfterSaveResponseAllInformation = new Label {
                    Text = "", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Green
                };
                slAfterSaveResponseAllInformation = new StackLayout
                {
                    Children    = { AfterSaveResponseAllInformation },
                    Orientation = StackOrientation.Horizontal,
                    Margin      = new Thickness(0, 8, 0, 0)
                };
                slAfterSaveResponseAllInformation.IsVisible = false;

                Button btnSaveAllInfo = new Button {
                    Text = "Save", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex("f7cc59"), TextColor = Color.Black, BorderRadius = 50, WidthRequest = 200, FontAttributes = FontAttributes.Bold
                };
                sbtnSaveAllInfo = new StackLayout
                {
                    Children    = { btnSaveAllInfo },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 8)
                };
                sbtnSaveAllInfo.IsVisible = false;



                #endregion

                #region post data
                btnSaveAllInfo.Clicked += (object sender, EventArgs e) =>
                {
                    if (ValidateForAllDataSave())
                    {
                        interviewsModel.IRRemarks        = overallRemarkAdd.Text;
                        interviewsModel.IRCombinedRating = decimal.Parse(averageRatingAdd.Text);
                        if (switchForLblCandidateSelected.IsToggled == true)
                        {
                            interviewsModel.IRSelected = 1;
                        }
                        if (switchForLblCandidateSelected.IsToggled == false)
                        {
                            interviewsModel.IRSelected = 0;
                        }
                        if (switchForLblCandidateMoveToNextRound.IsToggled == true)
                        {
                            interviewsModel.IRMovedToNextRound = 1;
                        }
                        if (switchForLblCandidateMoveToNextRound.IsToggled == false)
                        {
                            interviewsModel.IRMovedToNextRound = 0;
                        }
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            var result = await Service.SaveInterviewRound(interviewsModel);
                            AfterSaveResponseAllInformation.Text = "Data saved";
                        });
                        lineItemAdd.Text = string.Empty;
                    }
                };
                #endregion

                #region line item save
                lineItemAdd = new CustomEntryForGeneralPurpose {
                    Placeholder = "Add new line item here", HorizontalOptions = LayoutOptions.FillAndExpand
                };
                slineItemAdd = new StackLayout
                {
                    Children    = { lineItemAdd },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                slineItemAdd.IsVisible  = false;
                spLineItemAdd.IsVisible = false;

                Label AfterSaveResponseLineItem = new Label {
                    Text = "", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Green
                };
                slAfterSaveResponseLineItem = new StackLayout
                {
                    Children    = { AfterSaveResponseLineItem },
                    Orientation = StackOrientation.Horizontal,
                    Margin      = new Thickness(0, 8, 0, 0)
                };
                slAfterSaveResponseLineItem.IsVisible = false;

                Button btnSaveDataLineItem = new Button {
                    Text = "Add Line Item", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex("f7cc59"), TextColor = Color.Black, BorderRadius = 50, WidthRequest = 200, FontAttributes = FontAttributes.Bold
                };
                sbtnSaveDataLineItem = new StackLayout
                {
                    Children    = { btnSaveDataLineItem },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 8)
                };
                sbtnSaveDataLineItem.IsVisible = false;
                LineItem lineItems = new LineItem();

                btnSaveDataLineItem.Clicked += (object sender, EventArgs e) =>
                {
                    if (ValidateForLineItem())
                    {
                        lineItems.LineItemDescription = lineItemAdd.Text;
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            var result = await Service.PostLineItem(lineItems);
                            AfterSaveResponseLineItem.Text = "Line item saved";
                        });
                        lineItemAdd.Text = string.Empty;
                    }
                };
                #endregion

                #region contents and stack layouts

                StackLayout slInterviewMatrixInformation = new StackLayout
                {
                    Children = { sInterviewMatrixInfo,

                                 frmPkrCandidateName,              candidateNameSeparator,
                                 sBtnSubmitCandidate,
                                 slCandidateInformation,

                                 sInterviewRoundEdit,              slCandidateEditInfo,
                                 slHeaderTextForLineItem,          spForLineItemDetail,               sListViewLineItemDetail,
                                 slHeaderText,                     sSeparatorListviewInterviewRounds, slCandidateInterviewInfo,
                                 sOverallRemarkAdd,                spOverallRemarkAdd,                sAverageRatingAdd,           spAverageRatingAdd,sSwithForCandidateSelected, sSwithForCandidateMoveToNextRound,
                                 slAfterSaveResponseAllInformation,sbtnSaveAllInfo,
                                 slineItemAdd,                     spLineItemAdd,                     slAfterSaveResponseLineItem, sbtnSaveDataLineItem },
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Padding           = new Thickness(20, 0, 20, 0),
                    BackgroundColor   = Color.White
                };

                ScrollView svInterviewMatrixDetails = new ScrollView {
                    Content = slInterviewMatrixInformation
                };

                Content = svInterviewMatrixDetails;

                #endregion
            }
            else
            {
                Navigation.PushModalAsync(new Login());
            }
        }
        /// <summary>
        /// View Attendance Summary Layout.
        /// </summary>
        public void ViewAttendanceSummaryLayout()
        {
            TitleBar    lblPageName = new TitleBar("View Attendance Summary");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black, Text = "Select Month"
            };
            Picker pcrYearRange = new Picker {
                IsVisible = false, Title = "Year Range"
            };

            foreach (YearMonthModel item in _YearMonth)
            {
                pcrYearRange.Items.Add(item.Value);
            }

            StackLayout slSelectMonthDisplay = new StackLayout {
                Children = { lblCurrentDate, pcrYearRange, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmSelectMonth = new Frame
            {
                Content           = slSelectMonthDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var dateTimePickerTap = new TapGestureRecognizer();

            dateTimePickerTap.NumberOfTapsRequired = 1; // single-tap
            dateTimePickerTap.Tapped += (s, e) =>
            {
                pcrYearRange.Focus();
            };
            frmSelectMonth.GestureRecognizers.Add(dateTimePickerTap);
            slSelectMonthDisplay.GestureRecognizers.Add(dateTimePickerTap);

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmSelectMonth }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStartDateLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            Label lblTotalWorkingDays = new Label
            {
                TextColor = Color.Black
            };

            StackLayout slTotalWorkingDays = new StackLayout {
                Children = { lblTotalWorkingDays }, Padding = new Thickness(0, 0, 0, 10)
            };

            Label lblTotalPresentDay = new Label
            {
                TextColor = Color.Black
            };

            StackLayout slTotalPresentDay = new StackLayout {
                Children = { lblTotalPresentDay }, Padding = new Thickness(0, 0, 0, 10)
            };

            Label lblTotalAbsentDay = new Label
            {
                TextColor = Color.Black
            };

            StackLayout slTotalAbsentDay = new StackLayout {
                Children = { lblTotalAbsentDay }, Padding = new Thickness(0, 0, 0, 10)
            };

            pcrYearRange.SelectedIndexChanged += (s, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    try
                    {
                        _Loader.IsShowLoading    = true;
                        lblTotalWorkingDays.Text = string.Empty;
                        lblTotalPresentDay.Text  = string.Empty;
                        lblTotalAbsentDay.Text   = string.Empty;

                        lblCurrentDate.Text = pcrYearRange.Items[pcrYearRange.SelectedIndex].ToString();

                        DateTime dt = Convert.ToDateTime("1-" + lblCurrentDate.Text);

                        int dateCounter = dt.ConvetDatetoDateCounter();

                        AttendanceSummaryModel attendanceSummary = await AttendanceSummaryModel.GetAttendanceSummary(dateCounter);

                        if (!string.IsNullOrEmpty(Convert.ToString(attendanceSummary.AbsentDays)) && !string.IsNullOrEmpty(Convert.ToString(attendanceSummary.PresentDays)) && !string.IsNullOrEmpty(Convert.ToString(attendanceSummary.TotalWorkingDays)))
                        {
                            _NotAvailData.IsVisible = false;

                            lblTotalWorkingDays.Text = "Total WorkingDays: " + attendanceSummary.TotalWorkingDays.ToString();
                            lblTotalPresentDay.Text  = "Total PresentDays: " + attendanceSummary.PresentDays.ToString();
                            lblTotalAbsentDay.Text   = "Total AbsentDays: " + attendanceSummary.AbsentDays.ToString();
                        }
                        else
                        {
                            _NotAvailData.IsVisible      = true;
                            slTotalAbsentDay.IsVisible   = false;
                            slTotalPresentDay.IsVisible  = false;
                            slTotalWorkingDays.IsVisible = false;
                        }

                        _Loader.IsShowLoading = false;
                    }
                    catch (Exception ex)
                    {
                    }
                });
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData, slTotalWorkingDays, slTotalPresentDay, slTotalAbsentDay },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
Example #18
0
        /// <summary>
        /// Apply LeaveLayout.
        /// </summary>
        public void ApplyLeaveLayout()
        {
            TitleBar    lblPageName = new TitleBar("Apply Leave");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black
            };

            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            DatePicker dtStartDate = new DatePicker {
                IsVisible = false
            };

            StackLayout slStartDateDisplay = new StackLayout {
                Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmStartDate = new Frame
            {
                Content           = slStartDateDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var currentDateTap = new TapGestureRecognizer();

            currentDateTap.NumberOfTapsRequired = 1; // single-tap
            currentDateTap.Tapped += (s, e) =>
            {
                dtStartDate.Focus();
            };
            frmStartDate.GestureRecognizers.Add(currentDateTap);
            slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

            dtStartDate.DateSelected += (s, e) =>
            {
                lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yyyy");
            };

            //dtStartDate.Unfocused += (sender, e) =>
            //{
            //    if (lblCurrentDate.Text == "Date")
            //    {
            //        lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            //    }
            //};

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmStartDate }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //ExtendedEntry txtReasonOfLeave = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Reason of leave"
            //};

            Label lblReasonOfLeave = new Label
            {
                TextColor = Color.Black,
                Text      = "Reason of leave"
            };

            StackLayout slLabelReasonOfLeave = new StackLayout
            {
                Children = { lblReasonOfLeave },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            Editor txtReasonOfLeave = new Editor
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HeightRequest   = 80
                                  //TextColor = Color.Gray
            };

            StackLayout slTextReasonOfLeave = new StackLayout
            {
                Children = { txtReasonOfLeave },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slReasonOfLeave = new StackLayout
            {
                Children          = { slLabelReasonOfLeave, slTextReasonOfLeave },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            //txtReasonOfLeave.Focused += (sender, e) =>
            //    {
            //        if (txtReasonOfLeave.Text == "Reason of leave")
            //        {
            //            txtReasonOfLeave.Text = string.Empty;
            //            //txtReasonOfLeave.TextColor = Color.Black;
            //        }
            //    };

            ExtendedEntry txtNoOfDays = new ExtendedEntry
            {
                TextColor   = Color.Black,
                Keyboard    = Keyboard.Numeric,
                Placeholder = "Enter no of days"
            };

            StackLayout slNoOfDaysLayout = new StackLayout
            {
                Children          = { txtNoOfDays },
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStartDateLayout, slNoOfDaysLayout, slReasonOfLeave }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    try
                    {
                        if (!string.IsNullOrWhiteSpace(txtNoOfDays.Text) && !string.IsNullOrEmpty(txtReasonOfLeave.Text))
                        {
                            btnSave.IsVisible     = false;
                            _Loader.IsShowLoading = true;

                            TeacherLeaveModel teacherLeaveModel = new TeacherLeaveModel();

                            teacherLeaveModel.ReasonOfLeave = txtReasonOfLeave.Text;
                            teacherLeaveModel.Date          = Convert.ToDateTime(lblCurrentDate.Text).Date.ConvetDatetoDateCounter();
                            teacherLeaveModel.NoOfDays      = Convert.ToInt32(txtNoOfDays.Text);

                            bool isSaveAttendance = await TeacherLeaveModel.ApplyLeave(teacherLeaveModel);

                            if (isSaveAttendance)
                            {
                                await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                            }
                            else
                            {
                                await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                            }
                        }
                        else
                        {
                            await DisplayAlert(Messages.Error, "Please enter all data.", Messages.Ok);
                        }
                        _Loader.IsShowLoading = false;
                        btnSave.IsVisible     = true;
                    }
                    catch (Exception ex)
                    {
                        btnSave.IsVisible     = true;
                        _Loader.IsShowLoading = false;
                    }
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _NotAvailData, _Loader, cvBtnSave },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
        public void InterviewDetailsLayout(List <CandidateDetails> candidate, Candidate candidate2)
        {
            if (ACTContext.isLogin == true)
            {
                #region Header text
                Label lblInterviewDetailsInfo = new Label {
                    Text = "Interview Details Information", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f"), FontSize = 18, FontAttributes = FontAttributes.Bold, HeightRequest = 30
                };
                Label interviewDetailsInfo = new Label {
                    Text = "", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, HeightRequest = 40
                };
                StackLayout sInterviewDetailInfo = new StackLayout
                {
                    Children    = { lblInterviewDetailsInfo, interviewDetailsInfo },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 30, 0, 0)
                };
                #endregion

                #region candidate name
                Label lblCandidatePickerTitle = new Label {
                    Text = "Candidate Name", TextColor = Color.Gray
                };
                pkrCandidateName = new Picker {
                    IsVisible = false
                };
                pkrCandidateName.Title = "Candidate Name";
                foreach (CandidateDetails item in candidate)
                {
                    pkrCandidateName.Items.Add(item.CandidateName.ToString());
                }
                pkrCandidateName.SelectedIndexChanged += (s, e) =>
                {
                    lblCandidatePickerTitle.TextColor = Color.Black;
                    lblCandidatePickerTitle.Text      = pkrCandidateName.Items[pkrCandidateName.SelectedIndex].ToString();
                };
                Image imgPkrCandidateNameDropdown = new Image {
                    Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout sPkrCandidateName = new StackLayout {
                    Children = { lblCandidatePickerTitle, pkrCandidateName, imgPkrCandidateNameDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5)
                };
                Frame frmPkrCandidateName = new Frame {
                    Content = sPkrCandidateName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false
                };

                recognizerCandidateName.NumberOfTapsRequired = 1; // single-tap
                recognizerCandidateName.Tapped += (s, e) =>
                {
                    pkrCandidateName.Focus();
                };
                frmPkrCandidateName.GestureRecognizers.Add(recognizerCandidateName);
                Seperator candidateNameSeparator = new Seperator();

                //Button for submit candidate name and fetch particular data regarding the candidate
                Button btnSubmitCandidate = new Button {
                    Text = "Submit", HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, WidthRequest = 80, FontAttributes = FontAttributes.None, HeightRequest = 40
                };
                StackLayout sBtnSubmitCandidate = new StackLayout
                {
                    Children    = { btnSubmitCandidate },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 5, 0, 5)
                };

                #endregion

                #region candidate information

                #region first name
                //First Name
                Label lblCandidateFirstName = new Label {
                    Text = "First name : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateFirstNameText = new Label {
                    Text = "demo demo demo", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black
                };
                StackLayout slblCandidateFirstName = new StackLayout
                {
                    Children          = { lblCandidateFirstName, lblCandidateFirstNameText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorFirstName = new Seperator();
                #endregion

                #region last name
                //Last Name
                Label lblCandidateLastName = new Label {
                    Text = "Last name : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateLastNameText = new Label {
                    Text = "demo demo", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black
                };
                StackLayout slblCandidateLastName = new StackLayout
                {
                    Children          = { lblCandidateLastName, lblCandidateLastNameText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorLastName = new Seperator();
                #endregion

                #region address
                //Address
                Label lblCandidateAddress = new Label {
                    Text = "Address : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateAddressText = new Label {
                    Text = "demo address", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black
                };
                StackLayout slblCandidateAddress = new StackLayout
                {
                    Children          = { lblCandidateAddress, lblCandidateAddressText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorAddress = new Seperator();
                #endregion

                #region educational qualification
                //Educational qualification
                Label lblCandidateEducationalQualification = new Label {
                    Text = "Educational Qualification : ", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black, WidthRequest = 90
                };
                Label lblCandidateEducationalQualificationText = new Label {
                    Text = "demo qualification", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black
                };
                StackLayout slblCandidateEducationalQualification = new StackLayout
                {
                    Children          = { lblCandidateEducationalQualification, lblCandidateEducationalQualificationText },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.StartAndExpand,
                    Margin            = new Thickness(0, 10, 0, 10)
                };
                Seperator separatorEducationalQualification = new Seperator();
                #endregion

                #region listview for line items
                Label lblListViewHeader = new Label {
                    Text = "Give parameter wise rating and remark", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f"), FontSize = 14, FontAttributes = FontAttributes.Bold
                };
                StackLayout slblListViewHeader = new StackLayout
                {
                    Children = { lblListViewHeader },
                    Padding  = new Thickness(0, 10, 0, 10)
                };

                List <LineItem> lineItemObservableCollection = new List <LineItem>();
                lineItemObservableCollection = interviewsModel.LineItemList;
                ListView listView = new ListView();

                listView.SeparatorColor = Color.Gray;
                listView.HeightRequest  = 50 * interviewsModel.LineItemList.Count;
                StackLayout sListView = new StackLayout
                {
                    Children    = { listView },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 10)
                };
                #endregion

                #region overall remark
                txtRemark = new CustomEntryForGeneralPurpose {
                    Placeholder = "Overall Remark", HorizontalOptions = LayoutOptions.FillAndExpand
                };
                StackLayout sRemark = new StackLayout
                {
                    Children    = { txtRemark },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                Seperator seperatorRemark = new Seperator();
                #endregion

                #region seleted or not
                Label lblCandidateSelected = new Label {
                    Text = "Selected", HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.Black, WidthRequest = 80
                };
                Switch switchForLblCandidateSelected = new Switch {
                    MinimumWidthRequest = 50, HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.Transparent
                };
                StackLayout sSwithForCandidateSelected = new StackLayout
                {
                    Children    = { lblCandidateSelected, switchForLblCandidateSelected },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 10)
                };
                #endregion

                #region after response
                Label AfterSaveResponse = new Label {
                    Text = "", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Green
                };
                StackLayout slAfterSaveResponse = new StackLayout
                {
                    Children    = { AfterSaveResponse },
                    Orientation = StackOrientation.Horizontal,
                    Margin      = new Thickness(0, 8, 0, 0)
                };
                #endregion

                #region save button
                Button btnSaveData = new Button {
                    Text = "SAVE", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex("f7cc59"), TextColor = Color.Black, BorderRadius = 50, WidthRequest = 270, FontAttributes = FontAttributes.Bold
                };
                StackLayout sbtnSaveData = new StackLayout
                {
                    Children    = { btnSaveData },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 8)
                };
                #endregion

                #region candidate information stack layout
                slCandidateInformation = new StackLayout
                {
                    Children = { slblCandidateFirstName,                separatorFirstName,
                                 slblCandidateLastName,                 separatorLastName,
                                 slblCandidateAddress,                  separatorAddress,
                                 slblCandidateEducationalQualification, separatorEducationalQualification,
                                 slblListViewHeader,                    sListView,
                                 sRemark,                               seperatorRemark,
                                 sSwithForCandidateSelected,
                                 slAfterSaveResponse,                   sbtnSaveData }
                };
                slCandidateInformation.IsVisible = false;
                #endregion

                #region submit button click
                btnSubmitCandidate.Clicked += (object sender, EventArgs e) =>
                {
                    if (Validate())
                    {
                        slCandidateInformation.IsVisible = true;
                        int interviewId = (from c in candidate where c.CandidateName == pkrCandidateName.Items[pkrCandidateName.SelectedIndex] select c.InterviewId).SingleOrDefault();
                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            var result = await Service.GetCandidateInformation(interviewId, ACTContext.interviewerId);
                            if (result != null)
                            {
                                interviewsModel = JsonConvert.DeserializeObject <InterviewsModel>(result);
                            }
                            lblCandidateFirstNameText.Text = interviewsModel.FirstName;
                            lblCandidateLastNameText.Text  = interviewsModel.LastName;
                            lblCandidateAddressText.Text   = interviewsModel.Address1;
                            lblCandidateEducationalQualificationText.Text = interviewsModel.QualificationName;
                            lineItemObservableCollection = interviewsModel.LineItemList;

                            listView.HeightRequest = 50 * interviewsModel.LineItemList.Count;

                            listView.ItemsSource  = lineItemObservableCollection;
                            listView.ItemTemplate = new DataTemplate(() => new LineItemCell(lineItemObservableCollection));
                        });
                    }
                };
                #endregion
                #endregion

                #region stack layouts and contents
                StackLayout slUserDetailsInformation = new StackLayout
                {
                    Children = { sInterviewDetailInfo, frmPkrCandidateName, candidateNameSeparator,
                                 sBtnSubmitCandidate,
                                 slCandidateInformation },
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Padding           = new Thickness(20, 0, 20, 30),
                    BackgroundColor   = Color.White
                };

                ScrollView svUserDetails = new ScrollView {
                    Content = slUserDetailsInformation
                };

                Content = svUserDetails;

                Interview interview = new Interview();
                #endregion

                #region post data
                btnSaveData.Clicked += (object sender, EventArgs e) =>
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        int interviewId2      = (from c in candidate where c.CandidateName == pkrCandidateName.Items[pkrCandidateName.SelectedIndex] select c.InterviewId).SingleOrDefault();
                        var resultForPostData = await Service.GetCandidateInformation(interviewId2, ACTContext.interviewerId);
                        if (resultForPostData != null)
                        {
                            interviewsModel = JsonConvert.DeserializeObject <InterviewsModel>(resultForPostData);
                        }
                        interviewsModel.OvarAllRemarks = txtRemark.Text;
                        for (int i = 0; i < ACTContext.ratingDetailsListContext.Count; i++)
                        {
                            interviewsModel.RatingList.Add(ACTContext.ratingDetailsListContext[i]);
                        }

                        if (switchForLblCandidateSelected.IsToggled == true)
                        {
                            interviewsModel.IsSelected = 1;
                        }
                        if (switchForLblCandidateSelected.IsToggled == false)
                        {
                            interviewsModel.IsSelected = 0;
                        }
                        var resultAfterPostData = await Service.PostInterviewDetails(interviewsModel);
                        AfterSaveResponse.Text  = "Data saved successfully";
                        txtRemark.Text          = string.Empty;
                        interviewsModel.RatingList.Clear();
                        ACTContext.ratingDetailsListContext.Clear();

                        lineItemObservableCollection = interviewsModel.LineItemList;

                        listView.ItemsSource  = lineItemObservableCollection;
                        listView.ItemTemplate = new DataTemplate(() => new LineItemCell(lineItemObservableCollection));
                    });
                };
                #endregion
            }
            else
            {
                Navigation.PushModalAsync(new Login());
            }
        }
Example #20
0
        public void EducationDetailsLayout(List<College> college, List<UniversityModel> university, List<Qualification> qualifications, List<Degree> degrees, List<Education> educationList, List<Streams> streamList)
        {
            if (ACTContext.isLogin == true)
            {
                #region add education detail button
                Button btnAddNewWorkExp = new Button { Text = "Add education detail", HorizontalOptions = LayoutOptions.EndAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, HeightRequest = 35, FontSize = 10, FontAttributes = FontAttributes.Bold };
                StackLayout sBtnAddNewWorkExp = new StackLayout
                {
                    Children = { btnAddNewWorkExp },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(2, 5, 2, 5)
                };
                #endregion

                #region university, college, pkrQualification, pkrDegree pickers
                Label lblEducationDetailsInfo = new Label { Text = "Education Details Information", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f"), FontSize = 18, FontAttributes = FontAttributes.Bold, HeightRequest = 30 };
                StackLayout sEducationDetailInfo = new StackLayout
                {
                    Children = { lblEducationDetailsInfo },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 50, 0, 10)
                };
                Seperator sListViewHeader = new Seperator();
                #region university name
                Label lblUniversityPickerTitle = new Label { Text = "University Name", TextColor = Color.Gray };
                pkrUniversityName = new Picker { IsVisible = false };
                pkrUniversityName.Title = "University Name";
                foreach (UniversityModel item in university)
                {
                    pkrUniversityName.Items.Add(item.UniversityName);
                }
                pkrUniversityName.SelectedIndexChanged += (s, e) =>
                {
                    lblUniversityPickerTitle.TextColor = Color.Black;
                    lblUniversityPickerTitle.Text = pkrUniversityName.Items[pkrUniversityName.SelectedIndex].ToString();
                };
                Image imgpkrUniversityNameDropdown = new Image { Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand };

                StackLayout spkrUniversityName = new StackLayout { Children = { lblUniversityPickerTitle, pkrUniversityName, imgpkrUniversityNameDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) };
                Frame frmpkrUniversityName = new Frame { Content = spkrUniversityName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false };

                recognizerUniversityName.NumberOfTapsRequired = 1; // single-tap
                recognizerUniversityName.Tapped += (s, e) =>
                {
                    pkrUniversityName.Focus();
                };
                frmpkrUniversityName.GestureRecognizers.Add(recognizerUniversityName);
                Seperator universityNameSeparator = new Seperator();
                #endregion

                #region college name
                Label lblCollegePickerTitle = new Label { Text = "College Name", TextColor = Color.Gray };
                pkrCollegeName = new Picker { IsVisible = false };
                pkrCollegeName.Title = "College Name";
                foreach (College item in college)
                {
                    pkrCollegeName.Items.Add(item.CollegeName);
                }
                pkrCollegeName.SelectedIndexChanged += (s, e) =>
                {
                    lblCollegePickerTitle.TextColor = Color.Black;
                    lblCollegePickerTitle.Text = pkrCollegeName.Items[pkrCollegeName.SelectedIndex].ToString();
                };
                Image imgCollegeNameDropdown = new Image { Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand };

                StackLayout sCollegeName = new StackLayout { Children = { lblCollegePickerTitle, pkrCollegeName, imgCollegeNameDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) };
                Frame frmCollegeName = new Frame { Content = sCollegeName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false };

                recognizerCollegeName.NumberOfTapsRequired = 1; // single-tap
                recognizerCollegeName.Tapped += (s, e) =>
                {
                    pkrCollegeName.Focus();
                };
                frmCollegeName.GestureRecognizers.Add(recognizerCollegeName);
                Seperator collegeNameSeparator = new Seperator();
                #endregion

                #region qualification
                Label lblQualificationPickerTitle = new Label { Text = "Qualification", TextColor = Color.Gray, FontSize = Device.OnPlatform(11, 14, 14) };
                pkrQualification = new Picker { IsVisible = false };
                pkrQualification.Title = "Qualification";
                foreach (Qualification item in qualifications)
                {
                    pkrQualification.Items.Add(item.QualificationName);
                }
                pkrQualification.SelectedIndexChanged += (s, e) =>
                {
                    lblQualificationPickerTitle.TextColor = Color.Black;
                    lblQualificationPickerTitle.Text = pkrQualification.Items[pkrQualification.SelectedIndex].ToString();
                };
                Image imgQualificationDropdown = new Image { Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand };

                StackLayout sQualificationName = new StackLayout { Children = { lblQualificationPickerTitle, pkrQualification, imgQualificationDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) };
                Frame frmQualification = new Frame { Content = sQualificationName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false };

                recognizerQualification.NumberOfTapsRequired = 1; // single-tap
                recognizerQualification.Tapped += (s, e) =>
                {
                    pkrQualification.Focus();
                };
                frmQualification.GestureRecognizers.Add(recognizerQualification);
                Seperator qualificationSeparator = new Seperator();
                #endregion

                #region degree
                Label lblDegreePickerTitle = new Label { Text = "Degree", TextColor = Color.Gray };
                pkrDegree = new Picker { IsVisible = false };
                pkrDegree.Title = "Degree";
                foreach (Degree item in degrees)
                {
                    pkrDegree.Items.Add(item.DegreeName);
                }
                pkrDegree.SelectedIndexChanged += (s, e) =>
                {
                    lblDegreePickerTitle.TextColor = Color.Black;
                    lblDegreePickerTitle.Text = pkrDegree.Items[pkrDegree.SelectedIndex].ToString();
                };
                Image imgDegreeDropdown = new Image { Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand };

                StackLayout sDegreeName = new StackLayout { Children = { lblDegreePickerTitle, pkrDegree, imgDegreeDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) };
                Frame frmDegree = new Frame { Content = sDegreeName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false };

                recognizerDegree.NumberOfTapsRequired = 1; // single-tap
                recognizerDegree.Tapped += (s, e) =>
                {
                    pkrDegree.Focus();
                };
                frmDegree.GestureRecognizers.Add(recognizerDegree);
                Seperator degreeSeparator = new Seperator();
                #endregion

                #endregion

                #region branch
                Label lblBranchPickerTitle = new Label { Text = "Branch", TextColor = Color.Gray };
                pkrBranch = new Picker { IsVisible = false };
                pkrBranch.Title = "Branch";
                foreach (Streams item in streamList)
                {
                    pkrBranch.Items.Add(item.StreamName);
                }
                pkrBranch.SelectedIndexChanged += (s, e) =>
                {
                    lblBranchPickerTitle.TextColor = Color.Black;
                    lblBranchPickerTitle.Text = pkrBranch.Items[pkrBranch.SelectedIndex].ToString();
                };
                Image imgBranchDropdown = new Image { Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand };

                StackLayout sBranchName = new StackLayout { Children = { lblBranchPickerTitle, pkrBranch, imgBranchDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) };
                Frame frmBranch = new Frame { Content = sBranchName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false };

                recognizerBranch.NumberOfTapsRequired = 1;
                recognizerBranch.Tapped += (s, e) =>
                {
                    pkrBranch.Focus();
                };
                frmBranch.GestureRecognizers.Add(recognizerBranch);

                //txtBranch = new CustomEntryForGeneralPurpose { Placeholder = "Branch", HorizontalOptions = LayoutOptions.FillAndExpand };

                //StackLayout sBranch = new StackLayout
                //{
                //    Children = { txtBranch },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};
                Seperator seperatorBranch = new Seperator();
                #endregion

                #region duration
                Label lblDuration = new Label { Text = "Duration", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Gray, WidthRequest = 80, HeightRequest = 30 };
                StackLayout slblDuration = new StackLayout
                {
                    Children = { lblDuration },
                    Orientation = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.End,
                    Margin = new Thickness(3, 8, 0, 0)
                };

                lblFromDateText = new Label { Text = "From", HorizontalOptions = LayoutOptions.Center, TextColor = Color.Gray };

                StackLayout sLblFromDateText = new StackLayout
                {
                    Children = { lblFromDateText },
                    Orientation = StackOrientation.Horizontal,
                    Margin = new Thickness(0, 8, 0, 0)
                };

                Image imgFromDateArrow = new Image { Source = "calendar.png", HorizontalOptions = LayoutOptions.End };

                StackLayout slFromDateTap = new StackLayout { Children = { sLblFromDateText, imgFromDateArrow }, Orientation = StackOrientation.Horizontal };

                DatePicker dtFromDate = new DatePicker { IsVisible = false, BackgroundColor = Color.White };
                var fromDateTapGestureRecognizer = new TapGestureRecognizer();

                fromDateTapGestureRecognizer.NumberOfTapsRequired = 1; // single-tap
                fromDateTapGestureRecognizer.Tapped += (s, e) =>
                {
                    dtFromDate.Focus();
                };

                slFromDateTap.GestureRecognizers.Add(fromDateTapGestureRecognizer);

                dtFromDate.DateSelected += (object sender, DateChangedEventArgs e) =>
                {
                    //lblFromDateText.Text = e.NewDate.ToString("dd-MM-yyyy");
                    lblFromDateText.Text = e.NewDate.ToString("yyyy-MM-dd");
                };

                //To date
                lblToDateText = new Label { Text = "To", HorizontalOptions = LayoutOptions.Center, TextColor = Color.Gray };

                StackLayout sLblToDateText = new StackLayout
                {
                    Children = { lblToDateText },
                    Orientation = StackOrientation.Horizontal,
                    Margin = new Thickness(0, 8, 0, 0)
                };

                Image imgToDateArrow = new Image { Source = "calendar.png", HorizontalOptions = LayoutOptions.End };

                StackLayout slToDateTap = new StackLayout { Children = { sLblToDateText, imgToDateArrow }, Orientation = StackOrientation.Horizontal };

                DatePicker dtToDate = new DatePicker { IsVisible = false, BackgroundColor = Color.White };
                var toDateTapGestureRecognizer = new TapGestureRecognizer();

                toDateTapGestureRecognizer.NumberOfTapsRequired = 1; // single-tap
                toDateTapGestureRecognizer.Tapped += (s, e) =>
                {
                    dtToDate.Focus();
                };

                slToDateTap.GestureRecognizers.Add(toDateTapGestureRecognizer);

                dtToDate.DateSelected += (object sender, DateChangedEventArgs e) =>
                {
                    //lblToDateText.Text = e.NewDate.ToString("dd-MM-yyyy");
                    lblToDateText.Text = e.NewDate.ToString("yyyy-MM-dd");
                };

                Label lblFromToTo = new Label { Text = "-", HorizontalOptions = LayoutOptions.Center, TextColor = Color.Gray };

                StackLayout sLblFromToTo = new StackLayout
                {
                    Children = { lblFromToTo },
                    Orientation = StackOrientation.Horizontal,
                    Margin = new Thickness(0, 8, 0, 0)
                };

                StackLayout sWorkDuration = new StackLayout
                {
                    Children = { slblDuration, slFromDateTap, dtFromDate, sLblFromToTo, slToDateTap, dtToDate },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 0, 0, 0)
                };
                Seperator sDuration = new Seperator();
                #endregion

                #region percentage, project info, aftersave response, button
                txtPercentage = new CustomEntryForGeneralPurpose { Placeholder = "Percentage", HorizontalOptions = LayoutOptions.FillAndExpand, Keyboard = Keyboard.Numeric };
                txtPercentage.Behaviors.Add(new DecimalNumberValidationBehaviour());
                StackLayout sPercentage = new StackLayout
                {
                    Children = { txtPercentage },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 0, 0, 0)
                };
                Seperator sPercentageText = new Seperator();
                txtProjectInformation = new CustomEntryForGeneralPurpose { Placeholder = "Project Information", HorizontalOptions = LayoutOptions.FillAndExpand };
                StackLayout sProjectInformation = new StackLayout
                {
                    Children = { txtProjectInformation },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 0, 0, 0)
                };
                Seperator sProjectInfo = new Seperator();
                Label AfterSaveResponse = new Label { Text = "", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Green };
                StackLayout slAfterSaveResponse = new StackLayout
                {
                    Children = { AfterSaveResponse },
                    Orientation = StackOrientation.Horizontal,
                    Margin = new Thickness(0, 8, 0, 0)
                };

                Button btnSaveData = new Button { Text = "SAVE", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex("f7cc59"), TextColor = Color.Black, BorderRadius = 50, WidthRequest = 270, FontAttributes = FontAttributes.Bold };
                StackLayout sbtnSaveData = new StackLayout
                {
                    Children = { btnSaveData },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 10, 0, 8)
                };
                #endregion

                #region listView

                Label lblAddNewEducationDetail = new Label { Text = "Add new education detail information here", HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f"), FontSize = 14, FontAttributes = FontAttributes.Bold };
                StackLayout slblAddNewEducationDetail = new StackLayout
                {
                    Children = { lblAddNewEducationDetail },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 20, 0, 0)
                };

                StackLayout slHeaderText = new StackLayout();
                Label lblColege = new Label { Text = "College", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f") };
                Label lblpkrDegree = new Label { Text = "Degree", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f") };
                Label lblPercentage = new Label { Text = "Percentage", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f") };
                Label lblEmpty = new Label { Text = "", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black };
                slHeaderText = new StackLayout
                {
                    Children = { lblColege, lblpkrDegree, lblPercentage, lblEmpty },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 0, 0, 0)
                };
                if(educationList.Count == 0)
                {
                    slHeaderText.IsVisible = false;
                    sListViewHeader.IsVisible = false;
                }


                educationObservableCollection = educationList;

                listView.ItemsSource = educationObservableCollection;
                listView.ItemTemplate = new DataTemplate(() => new EducationCell(educationObservableCollection, college, qualifications));
                listView.HeightRequest = 50 * educationList.Count;
                StackLayout sListView = new StackLayout
                {
                    Children = { listView },
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 0, 0, 0)
                };

                #endregion

                #region stack layout, scroll view and content

                slEducationAllInformationAdd = new StackLayout
                {
                    Children = {slblAddNewEducationDetail,
                    frmpkrUniversityName, universityNameSeparator, frmCollegeName, collegeNameSeparator,
                    frmQualification, qualificationSeparator,
                    frmDegree, degreeSeparator, frmBranch, seperatorBranch,
                    sWorkDuration, sDuration, sPercentage, sPercentageText,
                        sProjectInformation, sProjectInfo, slAfterSaveResponse, sbtnSaveData }
                };
                slEducationAllInformationAdd.IsVisible = false;
                btnAddNewWorkExp.Clicked += (object sender, EventArgs e) =>
                {
                    slEducationAllInformationAdd.IsVisible = true;
                };

                StackLayout slEducationDetailsInformation = new StackLayout
                {
                    Children = { sBtnAddNewWorkExp, sEducationDetailInfo, slHeaderText, sListViewHeader, sListView, slEducationAllInformationAdd },
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Padding = new Thickness(20, 0, 20, 30),
                    BackgroundColor = Color.White
                };

                ScrollView svEducationDetails = new ScrollView { Content = slEducationDetailsInformation };

                Content = svEducationDetails;
                #endregion

                #region posting data
                Education education = new Education();

                btnSaveData.Clicked += (object sender, EventArgs e) =>
                {
                    if (Validate())
                    {
                        if (DateTime.Parse(lblFromDateText.Text) > DateTime.Parse(lblToDateText.Text))
                        {
                            DisplayAlert("Error", "Start date can not be greater than end date.", "OK");
                        }
                        else
                        {
                            education.UserId = ACTContext.userId;
                            education.CollegeId = (from c in college where c.CollegeName == pkrCollegeName.Items[pkrCollegeName.SelectedIndex] select c.Id).SingleOrDefault();
                            education.BranchId = (from d in streamList where d.StreamName == pkrBranch.Items[pkrBranch.SelectedIndex] select d.StreamID).SingleOrDefault();
                            education.DegreeId = (from d in degrees where d.DegreeName == pkrDegree.Items[pkrDegree.SelectedIndex] select d.Id).SingleOrDefault();
                            education.QualificationId = (from q in qualifications where q.QualificationName == pkrQualification.Items[pkrQualification.SelectedIndex] select q.Id).SingleOrDefault();
                            education.FromDate = DateTime.Parse(lblFromDateText.Text);
                            education.ToDate = DateTime.Parse(lblToDateText.Text);
                            education.Percentage = decimal.Parse(txtPercentage.Text);
                            education.ProjectInfo = txtProjectInformation.Text;

                            slHeaderText.IsVisible = true;
                            sListViewHeader.IsVisible = true;

                            Device.BeginInvokeOnMainThread(async () =>
                            {
                                var result = await Service.PostEducationDetail(education);
                                AfterSaveResponse.Text = "Data saved";
                                txtPercentage.Text = string.Empty;
                                txtProjectInformation.Text = string.Empty;

                                lblUniversityPickerTitle.Text = "University";
                                lblUniversityPickerTitle.TextColor = Color.Gray;
                                pkrUniversityName.IsVisible = false;

                                lblCollegePickerTitle.Text = "College";
                                lblCollegePickerTitle.TextColor = Color.Gray;
                                pkrCollegeName.IsVisible = false;

                                lblQualificationPickerTitle.Text = "Qualification";
                                lblQualificationPickerTitle.TextColor = Color.Gray;
                                pkrQualification.IsVisible = false;

                                lblDegreePickerTitle.Text = "Degree";
                                lblDegreePickerTitle.TextColor = Color.Gray;
                                pkrDegree.IsVisible = false;

                                lblBranchPickerTitle.Text = "Branch";
                                lblBranchPickerTitle.TextColor = Color.Gray;
                                pkrBranch.IsVisible = false;

                                var resultUpdated = await Service.GetEducationDetails(ACTContext.userId);
                                if (resultUpdated != null)
                                {
                                    educationList = (List<Education>)JsonConvert.DeserializeObject<List<Education>>(resultUpdated);
                                }
                                educationObservableCollection = educationList;
                                listView.ItemsSource = educationObservableCollection;
                                listView.HeightRequest = 50 * educationList.Count;
                                listView.ItemTemplate = new DataTemplate(() => new EducationCell(educationObservableCollection, college, qualifications));
                            });
                        }
                        
                    };

                };
                #endregion

            }
            else
            {
                Navigation.PushModalAsync(new Login());
            }
        }
Example #21
0
        /// <summary>
        /// View Attendance Layout.
        /// </summary>
        public void ViewAttendanceLayout()
        {
            TitleBar    lblPageName = new TitleBar("View Attendance");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Label lblIsAbsent = new Label
            {
                TextColor = Color.Black
            };

            Image imgLeftarrow = new Image
            {
                Source = Constants.ImagePath.ArrowLeft
            };


            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black
            };

            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");//Convert.ToDateTime("07-01-2015").ToString("dd-MM-yy");
            DatePicker dtStartDate = new DatePicker {
                IsVisible = false, Date = DateTime.Today
            };

            StackLayout slStartDateDisplay = new StackLayout {
                Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmStartDate = new Frame
            {
                Content           = slStartDateDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var currentDateTap = new TapGestureRecognizer();

            currentDateTap.NumberOfTapsRequired = 1; // single-tap
            currentDateTap.Tapped += (s, e) =>
            {
                dtStartDate.Focus();
            };
            frmStartDate.GestureRecognizers.Add(currentDateTap);
            slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmStartDate }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgRightarrow = new Image
            {
                Source = Constants.ImagePath.ArrowRight
            };

            StackLayout slLeftArrow = new StackLayout
            {
                Children        = { imgLeftarrow },
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            StackLayout slRightArrow = new StackLayout
            {
                Children        = { imgRightarrow },
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { imgLeftarrow, slStartDateLayout, imgRightarrow }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //List view
            StudentAttendanceListView = new ListView
            {
                RowHeight      = 50,
                SeparatorColor = Color.Gray
            };

            StudentAttendanceListView.ItemsSource  = Items;
            StudentAttendanceListView.ItemTemplate = new DataTemplate(() => new ViewAttendanceCell());

            //Grid Header Layout
            Label lblStudent = new Label
            {
                Text      = "Student",
                TextColor = Color.Black
            };

            StackLayout slStudentName = new StackLayout
            {
                Children          = { lblStudent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Label lblIsPresent = new Label
            {
                Text      = "A/P",
                TextColor = Color.Black
            };

            StackLayout slIsPresent = new StackLayout
            {
                Children          = { lblIsPresent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            grid = new StackLayout
            {
                Children    = { slStudentName, slIsPresent },
                Orientation = StackOrientation.Horizontal,
                IsVisible   = false
            };

            spDisplayHeader = new Seperator {
                IsVisible = false
            };

            dtStartDate.DateSelected += (s, e) =>
            {
                lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yy");

                _DateCounter = (dtStartDate).Date.ConvetDatetoDateCounter();

                startDateCounter = _DateCounter;
                endDateCounter   = _DateCounter + 30;

                LoadData(startDateCounter, endDateCounter);
            };

            //Left button click

            var leftArrowTap = new TapGestureRecognizer();

            leftArrowTap.NumberOfTapsRequired = 1; // single-tap
            leftArrowTap.Tapped += (s, e) =>
            {
                _DateCounter        = _DateCounter - 1;
                lblCurrentDate.Text = _DateCounter.GetDateFromDateCount().ToString("dd-MM-yy");
                dtStartDate.Date    = _DateCounter.GetDateFromDateCount();

                startDateCounter = _DateCounter;
                endDateCounter   = _DateCounter + 30;

                LoadData(startDateCounter, endDateCounter);
            };
            imgLeftarrow.GestureRecognizers.Add(leftArrowTap);

            //Right button click

            var rightArrowTap = new TapGestureRecognizer();

            rightArrowTap.NumberOfTapsRequired = 1; // single-tap
            rightArrowTap.Tapped += (s, e) =>
            {
                _DateCounter        = _DateCounter + 1;
                lblCurrentDate.Text = _DateCounter.GetDateFromDateCount().ToString("dd-MM-yy");
                dtStartDate.Date    = _DateCounter.GetDateFromDateCount();

                startDateCounter = _DateCounter;
                endDateCounter   = _DateCounter + 30;

                LoadData(startDateCounter, endDateCounter);
            };
            imgRightarrow.GestureRecognizers.Add(rightArrowTap);

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData, grid, spDisplayHeader.LineSeperatorView, StudentAttendanceListView },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
Example #22
0
        /// <summary>
        /// Teacher Leave
        /// </summary>
        public void TeacherLeaveLayout()
        {
            try
            {
                Children.Clear();
                TitleBar    lblPageName = new TitleBar("Teacher Leave");
                StackLayout slTitle     = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    Padding         = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children        = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                Image imgTeacherDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblTeacher = new Label {
                    TextColor = Color.Black, Text = "Teacher"
                };
                Picker pcrTeacher = new Picker {
                    IsVisible = false, Title = "Teacher"
                };

                foreach (TeacherModel item in _TeacherList)
                {
                    pcrTeacher.Items.Add(item.Name);
                }

                StackLayout slTeacherDisplay = new StackLayout {
                    Children = { lblTeacher, pcrTeacher, imgTeacherDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
                };

                Frame frmTeacher = new Frame
                {
                    Content           = slTeacherDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var teacherTap = new TapGestureRecognizer();

                teacherTap.NumberOfTapsRequired = 1; // single-tap
                teacherTap.Tapped += (s, e) =>
                {
                    pcrTeacher.Focus();
                };
                frmTeacher.GestureRecognizers.Add(teacherTap);
                slTeacherDisplay.GestureRecognizers.Add(teacherTap);

                StackLayout slTeacherFrameLayout = new StackLayout
                {
                    Children = { frmTeacher }
                };

                StackLayout slTeacherLayout = new StackLayout
                {
                    Children          = { slTeacherFrameLayout },
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                _Loader = new LoadingIndicator();

                _NotAvailData = new Label {
                    Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
                };

                //Frame layout for start date
                Image imgStartDateDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblCurrentDate = new Label {
                    TextColor = Color.Black
                };
                lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
                DatePicker dtStartDate = new DatePicker {
                    IsVisible = false
                };

                StackLayout slStartDateDisplay = new StackLayout {
                    Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
                };

                Frame frmStartDate = new Frame
                {
                    Content           = slStartDateDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var currentDateTap = new TapGestureRecognizer();

                currentDateTap.NumberOfTapsRequired = 1; // single-tap
                currentDateTap.Tapped += (s, e) =>
                {
                    dtStartDate.Focus();
                };
                frmStartDate.GestureRecognizers.Add(currentDateTap);
                slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

                StackLayout slStartDateFrmaeLayout = new StackLayout
                {
                    Children = { frmStartDate }
                };

                StackLayout slStartDateLayout = new StackLayout
                {
                    Children          = { slStartDateFrmaeLayout },
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };



                Image imgEndDateDropDown = new Image {
                    Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
                };
                Label lblEndtDate = new Label {
                    TextColor = Color.Black
                };
                lblEndtDate.Text = DateTime.Now.AddMonths(1).ToString("dd-MM-yy");
                DatePicker dtEndDate = new DatePicker {
                    IsVisible = false
                };

                StackLayout slEndDateDisplay = new StackLayout {
                    Children = { lblEndtDate, dtEndDate, imgEndDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
                };

                Frame frmEndDate = new Frame
                {
                    Content           = slEndDateDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor      = Color.Black,
                    Padding           = new Thickness(10)
                };

                var endDateTap = new TapGestureRecognizer();

                endDateTap.NumberOfTapsRequired = 1; // single-tap
                endDateTap.Tapped += (s, e) =>
                {
                    dtEndDate.Focus();
                };
                frmEndDate.GestureRecognizers.Add(endDateTap);
                slEndDateDisplay.GestureRecognizers.Add(endDateTap);

                StackLayout slEndDateFrmaeLayout = new StackLayout
                {
                    Children = { frmEndDate }
                };

                StackLayout slEndDateLayout = new StackLayout
                {
                    Children          = { slEndDateFrmaeLayout },
                    Orientation       = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                StackLayout slStartDateEndDate = new StackLayout
                {
                    Children          = { slStartDateLayout, slEndDateLayout },
                    Orientation       = StackOrientation.Horizontal,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible         = false
                };

                pcrTeacher.SelectedIndexChanged += async(sender, e) =>
                {
                    //using (UserDialogs.Instance.Loading())
                    //{
                    string teacherName = lblTeacher.Text = pcrTeacher.Items[pcrTeacher.SelectedIndex];

                    _SelectedTeacherID = _TeacherList.FirstOrDefault(x => x.Name == teacherName).ID;

                    slStartDateEndDate.IsVisible = true;

                    _StartDateCounter = Convert.ToDateTime(lblCurrentDate.Text).ConvetDatetoDateCounter();

                    _EndDateCounter = Convert.ToDateTime(lblEndtDate.Text).ConvetDatetoDateCounter();

                    GetData(_SelectedTeacherID, _StartDateCounter, _EndDateCounter);
                    //Get time table list
                    //_TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedTeacherID);

                    //if (_TimeTableList != null && _TimeTableList.Count > 0)
                    //{
                    //    grid.IsVisible = true;
                    //    spDisplayHeader.IsVisible = true;
                    //    Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                    //    TimeTableListView.ItemsSource = Items;
                    //}
                    //else
                    //{
                    //    grid.IsVisible = false;
                    //    spDisplayHeader.IsVisible = false;
                    //    _NotAvailData.Text = "There is no data for selected standard and class.";
                    //    _NotAvailData.IsVisible = true;
                    //}
                    //_Loader.IsShowLoading = false;
                    //}
                };

                dtStartDate.DateSelected += (s, e) =>
                {
                    lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yy");
                    _StartDateCounter   = (dtStartDate).Date.ConvetDatetoDateCounter();

                    _EndDateCounter = Convert.ToDateTime(lblEndtDate.Text).ConvetDatetoDateCounter();

                    GetData(_SelectedTeacherID, _StartDateCounter, _EndDateCounter);
                };

                dtEndDate.DateSelected += (s, e) =>
                {
                    _StartDateCounter = Convert.ToDateTime(lblCurrentDate.Text).ConvetDatetoDateCounter();

                    lblEndtDate.Text = (dtEndDate).Date.ToString("dd-MM-yy");
                    _EndDateCounter  = (dtEndDate).Date.ConvetDatetoDateCounter();

                    GetData(_SelectedTeacherID, _StartDateCounter, _EndDateCounter);
                };

                ContentPage searchContent = new ContentPage
                {
                    Content = new StackLayout
                    {
                        Children        = { slTitle, spTitle.LineSeperatorView, slTeacherLayout, slStartDateEndDate },
                        Orientation     = StackOrientation.Vertical,
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        BackgroundColor = LayoutHelper.PageBackgroundColor
                    },
                };

                Children.Add(searchContent);
            }
            catch (Exception ex)
            {
            }
        }
        public void IVQuestionsLayout(List <Department> deps, List <Designation> desig, List <Stream> streams)
        {
            if (ACTContext.isLogin == true)
            {
                //#region add education detail button
                //Button btnAddNewWorkExp = new Button { Text = "Add education detail", HorizontalOptions = LayoutOptions.EndAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, HeightRequest = 35, FontSize = 10, FontAttributes = FontAttributes.Bold };
                //StackLayout sBtnAddNewWorkExp = new StackLayout
                //{
                //    Children = { btnAddNewWorkExp },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(2, 5, 2, 5)
                //};
                //#endregion

                #region university, college, pkrQualification, pkrDegree pickers
                Label lblEducationDetailsInfo = new Label {
                    Text = "View Interview Questions", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("5e247f"), FontSize = 18, FontAttributes = FontAttributes.Bold, HeightRequest = 30
                };
                StackLayout sEducationDetailInfo = new StackLayout
                {
                    Children    = { lblEducationDetailsInfo },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 50, 0, 10)
                };
                Seperator sListViewHeader = new Seperator();
                //pkrUniversityName = new Picker { Title="University Name", HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Gray };
                //foreach (UniversityModel item in university)
                //{
                //    pkrUniversityName.Items.Add(item.pkrUniversityName);
                //}
                //StackLayout spkrUniversityName = new StackLayout
                //{
                //    Children = { pkrUniversityName },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};

                #region dept
                Label lblUniversityPickerTitle = new Label {
                    Text = "Interview Questions", TextColor = Color.Gray
                };
                pkrdeps = new Picker {
                    IsVisible = false
                };
                pkrdeps.Title = "Interview Questions";
                foreach (Department item in deps)
                {
                    pkrdeps.Items.Add(item.DepartmentName);
                }
                pkrdeps.SelectedIndexChanged += (s, e) =>
                {
                    lblUniversityPickerTitle.TextColor = Color.Black;
                    lblUniversityPickerTitle.Text      = pkrdeps.Items[pkrdeps.SelectedIndex].ToString();
                };
                Image imgpkrUniversityNameDropdown = new Image {
                    Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout spkrUniversityName = new StackLayout {
                    Children = { lblUniversityPickerTitle, pkrdeps, imgpkrUniversityNameDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5)
                };
                Frame frmpkrUniversityName = new Frame {
                    Content = spkrUniversityName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false
                };

                recognizerdeps.NumberOfTapsRequired = 1; // single-tap
                recognizerdeps.Tapped += (s, e) =>
                {
                    pkrdeps.Focus();
                };
                frmpkrUniversityName.GestureRecognizers.Add(recognizerdeps);
                Seperator universityNameSeparator = new Seperator();
                #endregion

                #region college name
                Label lblCollegePickerTitle = new Label {
                    Text = "Designation", TextColor = Color.Gray
                };
                pkrdesig = new Picker {
                    IsVisible = false
                };
                pkrdesig.Title = "Designation Name";
                foreach (Designation item in desig)
                {
                    pkrdesig.Items.Add(item.DesignationName);
                }
                pkrdesig.SelectedIndexChanged += (s, e) =>
                {
                    lblCollegePickerTitle.TextColor = Color.Black;
                    lblCollegePickerTitle.Text      = pkrdesig.Items[pkrdesig.SelectedIndex].ToString();
                };
                Image imgCollegeNameDropdown = new Image {
                    Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout sCollegeName = new StackLayout {
                    Children = { lblCollegePickerTitle, pkrdesig, imgCollegeNameDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5)
                };
                Frame frmCollegeName = new Frame {
                    Content = sCollegeName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false
                };

                recognizerdesig.NumberOfTapsRequired = 1; // single-tap
                recognizerdesig.Tapped += (s, e) =>
                {
                    pkrdesig.Focus();
                };
                frmCollegeName.GestureRecognizers.Add(recognizerdesig);
                Seperator collegeNameSeparator = new Seperator();
                #endregion

                #region stream
                Label lblQualificationPickerTitle = new Label {
                    Text = "Stream", TextColor = Color.Gray, FontSize = Device.OnPlatform(11, 14, 14)
                };
                pkrstream = new Picker {
                    IsVisible = false
                };
                pkrstream.Title = "Stream";
                foreach (Stream item in streams)
                {
                    pkrstream.Items.Add(item.StreamName);
                }
                pkrstream.SelectedIndexChanged += (s, e) =>
                {
                    lblQualificationPickerTitle.TextColor = Color.Black;
                    lblQualificationPickerTitle.Text      = pkrstream.Items[pkrstream.SelectedIndex].ToString();
                };
                Image imgQualificationDropdown = new Image {
                    Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout sQualificationName = new StackLayout {
                    Children = { lblQualificationPickerTitle, pkrstream, imgQualificationDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5)
                };
                Frame frmQualification = new Frame {
                    Content = sQualificationName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false
                };

                recognizerstream.NumberOfTapsRequired = 1; // single-tap
                recognizerstream.Tapped += (s, e) =>
                {
                    pkrstream.Focus();
                };
                frmQualification.GestureRecognizers.Add(recognizerstream);
                Seperator qualificationSeparator = new Seperator();
                #endregion

                //#region degree
                //Label lblDegreePickerTitle = new Label { Text = "Degree", TextColor = Color.Gray };
                //pkrDegree = new Picker { IsVisible = false };
                //pkrDegree.Title = "Degree";
                //foreach (Degree item in degrees)
                //{
                //    pkrDegree.Items.Add(item.DegreeName);
                //}
                //pkrDegree.SelectedIndexChanged += (s, e) =>
                //{
                //    lblDegreePickerTitle.TextColor = Color.Black;
                //    lblDegreePickerTitle.Text = pkrDegree.Items[pkrDegree.SelectedIndex].ToString();
                //};
                //Image imgDegreeDropdown = new Image { Source = "dropdownPicker.png", HorizontalOptions = LayoutOptions.EndAndExpand };

                //StackLayout sDegreeName = new StackLayout { Children = { lblDegreePickerTitle, pkrDegree, imgDegreeDropdown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) };
                //Frame frmDegree = new Frame { Content = sDegreeName, BackgroundColor = Color.White, Padding = new Thickness(Device.OnPlatform(8, 5, 0)), HasShadow = false };

                //recognizerDegree.NumberOfTapsRequired = 1; // single-tap
                //recognizerDegree.Tapped += (s, e) =>
                //{
                //    pkrDegree.Focus();
                //};
                //frmDegree.GestureRecognizers.Add(recognizerDegree);
                //Seperator degreeSeparator = new Seperator();
                //#endregion

                //#endregion

                //#region branch
                //txtBranch = new CustomEntryForGeneralPurpose { Placeholder = "Branch", HorizontalOptions = LayoutOptions.FillAndExpand };
                //StackLayout sBranch = new StackLayout
                //{
                //    Children = { txtBranch },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};
                //Seperator seperatorBranch = new Seperator();
                //#endregion

                //#region duration
                //Label lblDuration = new Label { Text = "Duration", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Gray, WidthRequest = 80, HeightRequest = 30 };
                //StackLayout slblDuration = new StackLayout
                //{
                //    Children = { lblDuration },
                //    Orientation = StackOrientation.Horizontal,
                //    HorizontalOptions = LayoutOptions.End,
                //    Margin = new Thickness(3, 8, 0, 0)
                //};

                //lblFromDateText = new Label { Text = "From", HorizontalOptions = LayoutOptions.Center, TextColor = Color.Gray };

                //StackLayout sLblFromDateText = new StackLayout
                //{
                //    Children = { lblFromDateText },
                //    Orientation = StackOrientation.Horizontal,
                //    Margin = new Thickness(0, 8, 0, 0)
                //};

                //Image imgFromDateArrow = new Image { Source = "calendar.png", HorizontalOptions = LayoutOptions.End };

                //StackLayout slFromDateTap = new StackLayout { Children = { sLblFromDateText, imgFromDateArrow }, Orientation = StackOrientation.Horizontal };

                //DatePicker dtFromDate = new DatePicker { IsVisible = false, BackgroundColor = Color.White };
                //var fromDateTapGestureRecognizer = new TapGestureRecognizer();

                //fromDateTapGestureRecognizer.NumberOfTapsRequired = 1; // single-tap
                //fromDateTapGestureRecognizer.Tapped += (s, e) =>
                //{
                //    dtFromDate.Focus();
                //};

                //slFromDateTap.GestureRecognizers.Add(fromDateTapGestureRecognizer);

                //dtFromDate.DateSelected += (object sender, DateChangedEventArgs e) =>
                //{
                //    //lblFromDateText.Text = e.NewDate.ToString("dd-MM-yyyy");
                //    lblFromDateText.Text = e.NewDate.ToString("yyyy-MM-dd");
                //};

                ////To date
                //lblToDateText = new Label { Text = "To", HorizontalOptions = LayoutOptions.Center, TextColor = Color.Gray };

                //StackLayout sLblToDateText = new StackLayout
                //{
                //    Children = { lblToDateText },
                //    Orientation = StackOrientation.Horizontal,
                //    Margin = new Thickness(0, 8, 0, 0)
                //};

                //Image imgToDateArrow = new Image { Source = "calendar.png", HorizontalOptions = LayoutOptions.End };

                //StackLayout slToDateTap = new StackLayout { Children = { sLblToDateText, imgToDateArrow }, Orientation = StackOrientation.Horizontal };

                //DatePicker dtToDate = new DatePicker { IsVisible = false, BackgroundColor = Color.White };
                //var toDateTapGestureRecognizer = new TapGestureRecognizer();

                //toDateTapGestureRecognizer.NumberOfTapsRequired = 1; // single-tap
                //toDateTapGestureRecognizer.Tapped += (s, e) =>
                //{
                //    dtToDate.Focus();
                //};

                //slToDateTap.GestureRecognizers.Add(toDateTapGestureRecognizer);

                //dtToDate.DateSelected += (object sender, DateChangedEventArgs e) =>
                //{
                //    //lblToDateText.Text = e.NewDate.ToString("dd-MM-yyyy");
                //    lblToDateText.Text = e.NewDate.ToString("yyyy-MM-dd");
                //};

                //Label lblFromToTo = new Label { Text = "-", HorizontalOptions = LayoutOptions.Center, TextColor = Color.Gray };

                //StackLayout sLblFromToTo = new StackLayout
                //{
                //    Children = { lblFromToTo },
                //    Orientation = StackOrientation.Horizontal,
                //    Margin = new Thickness(0, 8, 0, 0)
                //};

                //StackLayout sWorkDuration = new StackLayout
                //{
                //    Children = { slblDuration, slFromDateTap, dtFromDate, sLblFromToTo, slToDateTap, dtToDate },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};
                //Seperator sDuration = new Seperator();
                //#endregion

                //#region percentage, project info, aftersave response, button
                //txtPercentage = new CustomEntryForGeneralPurpose { Placeholder = "Percentage", HorizontalOptions = LayoutOptions.FillAndExpand, Keyboard = Keyboard.Numeric };
                //txtPercentage.Behaviors.Add(new DecimalNumberValidationBehaviour());
                //StackLayout sPercentage = new StackLayout
                //{
                //    Children = { txtPercentage },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};
                //Seperator sPercentageText = new Seperator();
                //txtProjectInformation = new CustomEntryForGeneralPurpose { Placeholder = "Project Information", HorizontalOptions = LayoutOptions.FillAndExpand };
                //StackLayout sProjectInformation = new StackLayout
                //{
                //    Children = { txtProjectInformation },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};
                //Seperator sProjectInfo = new Seperator();
                //Label AfterSaveResponse = new Label { Text = "", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Green };
                //StackLayout slAfterSaveResponse = new StackLayout
                //{
                //    Children = { AfterSaveResponse },
                //    Orientation = StackOrientation.Horizontal,
                //    Margin = new Thickness(0, 8, 0, 0)
                //};

                Button btnSaveData = new Button {
                    Text = "View Questions", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex("f7cc59"), TextColor = Color.Black, BorderRadius = 50, WidthRequest = 270, FontAttributes = FontAttributes.Bold
                };
                StackLayout sbtnSaveData = new StackLayout
                {
                    Children    = { btnSaveData },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 10, 0, 8)
                };
                //#endregion

                //#region listView

                //Label lblAddNewEducationDetail = new Label { Text = "Add new education detail information here", HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f"), FontSize = 14, FontAttributes = FontAttributes.Bold };
                //StackLayout slblAddNewEducationDetail = new StackLayout
                //{
                //    Children = { lblAddNewEducationDetail },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 20, 0, 0)
                //};

                //StackLayout slHeaderText = new StackLayout();
                //Label lblColege = new Label { Text = "College", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f") };
                //Label lblpkrDegree = new Label { Text = "Degree", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f") };
                //Label lblPercentage = new Label { Text = "Percentage", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f") };
                //Label lblEmpty = new Label { Text = "", HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black };
                //slHeaderText = new StackLayout
                //{
                //    Children = { lblColege, lblpkrDegree, lblPercentage, lblEmpty },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};
                //if(educationList.Count == 0)
                //{
                //    slHeaderText.IsVisible = false;
                //    sListViewHeader.IsVisible = false;
                //}


                //educationObservableCollection = educationList;

                //listView.ItemsSource = educationObservableCollection;
                //listView.ItemTemplate = new DataTemplate(() => new EducationCell(educationObservableCollection, college, qualifications));
                //listView.HeightRequest = 50 * educationList.Count;
                //StackLayout sListView = new StackLayout
                //{
                //    Children = { listView },
                //    Orientation = StackOrientation.Horizontal,
                //    Padding = new Thickness(0, 0, 0, 0)
                //};

                //#endregion

                //#region stack layout, scroll view and content

                slEducationAllInformationAdd = new StackLayout
                {
                    Children =   //slblAddNewEducationDetail,
                    {
                        frmpkrUniversityName, universityNameSeparator, frmCollegeName, collegeNameSeparator,
                        frmQualification,     qualificationSeparator,
                        //frmDegree, degreeSeparator, sBranch, seperatorBranch,
                        //sWorkDuration, sDuration, sPercentage, sPercentageText,
                        //sProjectInformation, sProjectInfo, slAfterSaveResponse,
                        sbtnSaveData
                    }
                };
                slEducationAllInformationAdd.IsVisible = true;
                //btnAddNewWorkExp.Clicked += (object sender, EventArgs e) =>
                //{
                //    slEducationAllInformationAdd.IsVisible = true;
                //};
                #endregion

                #region posting data
                InterviewQuestions interrviewQues = new InterviewQuestions();


                StackLayout slHeaderText = new StackLayout();
                StackLayout slEducationDetailsInformation = new StackLayout();
                StackLayout sListView = new StackLayout();

                btnSaveData.Clicked += (object sender, EventArgs e) =>
                {
                    sListView.IsVisible = true;
                    if (Validate())
                    {
                        //interrviewQues.deptId = ACTContext.userId;
                        interrviewQues.deptId   = (from c in deps where c.DepartmentName == pkrdeps.Items[pkrdeps.SelectedIndex] select c.DepartmentId).SingleOrDefault();
                        interrviewQues.desigId  = (from d in desig where d.DesignationName == pkrdesig.Items[pkrdesig.SelectedIndex] select d.DesignationId).SingleOrDefault();
                        interrviewQues.streamId = (from c in streams where c.StreamName == pkrstream.Items[pkrstream.SelectedIndex] select c.StreamID).SingleOrDefault();

                        //slHeaderText.IsVisible = true;
                        sListViewHeader.IsVisible = true;

                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            var resInS = await Service.GetIvQuestionsDetails(interrviewQues);
                            if (resInS != null)
                            {
                                intss = (List <InterviewSet>)JsonConvert.DeserializeObject <List <InterviewSet> >(resInS);
                            }
                            List <InterviewSet> interviewSetObservableCollection = new List <InterviewSet>();
                            interviewSetObservableCollection = intss;

                            Label lblQ = new Label {
                                Text = "Question", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f")
                            };
                            Label lblA = new Label {
                                Text = "Answer", FontAttributes = FontAttributes.Bold, WidthRequest = 130, HorizontalOptions = LayoutOptions.Start, TextColor = Color.FromHex("5e247f")
                            };
                            slHeaderText = new StackLayout
                            {
                                Children    = { lblQ, lblA },
                                Orientation = StackOrientation.Horizontal,
                                Padding     = new Thickness(0, 0, 0, 0)
                            };
                            if (intss.Count == 0)
                            {
                                slHeaderText.IsVisible    = false;
                                sListViewHeader.IsVisible = false;
                            }
                            listView.ItemsSource = intss;
                            //listView.ItemTemplate = new DataTemplate(() => new InterviewQuestionsCell(intss));
                            listView.ItemTemplate  = new DataTemplate(() => new InterviewQuestionsCell(interviewSetObservableCollection));
                            listView.HeightRequest = 50 * intss.Count;
                        });
                    }
                    ;
                };

                //StackLayout slHeaderText = new StackLayout();


                #endregion

                #region listview
                sListView = new StackLayout
                {
                    Children    = { listView },
                    Orientation = StackOrientation.Horizontal,
                    Padding     = new Thickness(0, 0, 0, 0)
                };
                sListView.IsVisible = false;
                #endregion

                slEducationDetailsInformation = new StackLayout
                {
                    Children          = { /*sBtnAddNewWorkExp,*/ sEducationDetailInfo, slHeaderText, sListViewHeader, sListView, slEducationAllInformationAdd },
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Padding           = new Thickness(20, 0, 20, 30),
                    BackgroundColor   = Color.White
                };

                ScrollView svEducationDetails = new ScrollView {
                    Content = slEducationDetailsInformation
                };

                Content = svEducationDetails;
            }
            else
            {
                Navigation.PushModalAsync(new Login());
            }
        }
Example #24
0
        /// <summary>
        ///Exam Timetable
        /// </summary>
        public void NotificationkLayout()
        {
            try
            {
                TitleBar    lblPageName = new TitleBar("View Notifications");
                StackLayout slTitle     = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    Padding         = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children        = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                _NotAvailData = new Label {
                    Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
                };

                _Loader = new LoadingIndicator();

                ListView ViewNotificationListView = new ListView
                {
                    RowHeight      = 50,
                    SeparatorColor = Color.Gray
                };

                ViewNotificationListView.ItemsSource  = Items;
                ViewNotificationListView.ItemTemplate = new DataTemplate(() => new ViewNotificationCell());

                if (Items != null && Items.Count > 0)
                {
                    _NotAvailData.IsVisible = true;
                }
                else
                {
                    _NotAvailData.IsVisible = false;
                }

                //Grid Header Layout
                Label lblComment = new Label
                {
                    Text      = "Comment",
                    TextColor = Color.Black
                };

                StackLayout slComment = new StackLayout
                {
                    Children          = { lblComment },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

                Label lblScheduledDate = new Label
                {
                    Text      = "Schedule Date",
                    TextColor = Color.Black
                };

                StackLayout slScheduleDate = new StackLayout
                {
                    Children          = { lblScheduledDate },
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                StackLayout grid = new StackLayout
                {
                    Children    = { slComment, slScheduleDate },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible   = false
                };

                Seperator spDisplayHeader = new Seperator();

                StackLayout slViewNotifications = new StackLayout
                {
                    Children =
                    {
                        new StackLayout {
                            Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                            Children        = { slTitle, spTitle.LineSeperatorView, grid, spDisplayHeader.LineSeperatorView, _Loader, _NotAvailData, ViewNotificationListView },
                            VerticalOptions = LayoutOptions.FillAndExpand,
                        },
                    },
                    BackgroundColor = LayoutHelper.PageBackgroundColor
                };

                Content = new ScrollView
                {
                    Content = slViewNotifications,
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #25
0
        /// <summary>
        /// Upload Sample Paper Layout.
        /// </summary>
        public void UploadSamplePaperLayout()
        {
            TitleBar    lblPageName = new TitleBar("Upload Sample Paper");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgSubjectDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblSubject = new Label {
                TextColor = Color.Black, Text = "Subject"
            };
            Picker pcrSubject = new Picker {
                IsVisible = false, Title = "Subject"
            };

            StackLayout slSubjectDisplay = new StackLayout {
                Children = { lblSubject, pcrSubject, imgSubjectDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmSubject = new Frame
            {
                Content           = slSubjectDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var subjectTap = new TapGestureRecognizer();

            subjectTap.NumberOfTapsRequired = 1; // single-tap
            subjectTap.Tapped += (s, e) =>
            {
                pcrSubject.Focus();
            };
            frmSubject.GestureRecognizers.Add(subjectTap);
            slSubjectDisplay.GestureRecognizers.Add(subjectTap);

            StackLayout slSubjectFrmaeLayout = new StackLayout
            {
                Children = { frmSubject }
            };

            StackLayout slSubjectLayout = new StackLayout
            {
                Children          = { slSubjectFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            ExtendedEntry txtName = new ExtendedEntry
            {
                TextColor   = Color.Black,
                Placeholder = "Name",
                Text        = "Name"
            };

            StackLayout slNameLayout = new StackLayout
            {
                Children          = { txtName },
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Label lblUploadPaper = new Label
            {
                Text      = "Upload Paper",
                TextColor = Color.Black
            };

            StackLayout slUploadPaper = new StackLayout
            {
                Children          = { lblUploadPaper },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.White
            };

            var uploadTapGesture = new TapGestureRecognizer();

            uploadTapGesture.NumberOfTapsRequired = 1; // single-tap
            uploadTapGesture.Tapped += async(s, e) =>
            {
                var action = await DisplayActionSheet("Choose any one?", "Cancel", null, "Camera", "Gallery");

                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (action == "Camera")
                    {
                        if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                        {
                            await DisplayAlert("No Camera", ":( No camera available.", "OK");
                            return;
                        }

                        var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
                        {
                            Directory = "Sample",
                            Name      = txtName.Text + ".jpg"// "test.jpg"
                        });

                        if (file == null)
                        {
                            return;
                        }

                        //await ACT.Core.Providers.Parse.User.ImageSave(file.GetStream());
                    }
                    else if (action == "Gallery")
                    {
                        if (!CrossMedia.Current.IsPickPhotoSupported)
                        {
                            await DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");
                            return;
                        }
                        var file = await CrossMedia.Current.PickPhotoAsync();

                        if (file == null)
                        {
                            return;
                        }

                        //Save image to parse database
                        //await ACT.Core.Providers.Parse.User.ImageSave(file.GetStream());
                    }
                });
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStandardLayout, slSubjectLayout, slNameLayout, lblUploadPaper }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    //_SubjectList = await StudentModel.();

                    if (_SubjectList.Count > 0 && _SubjectList != null)
                    {
                        slSubjectFrmaeLayout.IsVisible = true;
                        _NotAvailData.IsVisible        = false;
                    }
                    else
                    {
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (SubjectModel item in _SubjectList)
                    {
                        pcrSubject.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    bool isSaveAttendance = true;//await FillUpAttendanceModel.SaveStudentAttendance(Items);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slUplodSamplePaper = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData, cvBtnSave },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slUplodSamplePaper,
            };
        }
Example #26
0
        /// <summary>
        /// Enter Student Mark Layout.
        /// </summary>
        public void EnterStudentMarkLayout()
        {
            TitleBar    lblPageName = new TitleBar("Enter Student Mark");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Image imgExamTypeDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblExamType = new Label {
                TextColor = Color.Black, Text = "Exam Type"
            };
            Picker pcrExamType = new Picker {
                IsVisible = false, Title = "Exam Type"
            };

            StackLayout slExamTypeDisplay = new StackLayout {
                Children = { lblExamType, pcrExamType, imgExamTypeDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmExamType = new Frame
            {
                Content           = slExamTypeDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var examTypeTap = new TapGestureRecognizer();

            examTypeTap.NumberOfTapsRequired = 1; // single-tap
            examTypeTap.Tapped += (s, e) =>
            {
                pcrExamType.Focus();
            };
            frmExamType.GestureRecognizers.Add(examTypeTap);
            slExamTypeDisplay.GestureRecognizers.Add(examTypeTap);

            StackLayout slExamTypeFrmaeLayout = new StackLayout
            {
                Children = { frmExamType }
            };

            StackLayout slExamTypeLayout = new StackLayout
            {
                Children          = { slExamTypeFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgExamDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblExam = new Label {
                TextColor = Color.Black, Text = "Exam"
            };
            Picker pcrExam = new Picker {
                IsVisible = false, Title = "Exam"
            };

            StackLayout slExamDisplay = new StackLayout {
                Children = { lblExam, pcrExam, imgExamDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmExam = new Frame
            {
                Content           = slExamDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var examTap = new TapGestureRecognizer();

            examTap.NumberOfTapsRequired = 1; // single-tap
            examTap.Tapped += (s, e) =>
            {
                pcrExam.Focus();
            };
            frmExam.GestureRecognizers.Add(examTap);
            slExamDisplay.GestureRecognizers.Add(examTap);

            StackLayout slExamFrmaeLayout = new StackLayout
            {
                Children = { frmExam }
            };

            StackLayout slExamLayout = new StackLayout
            {
                Children          = { slExamFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStandardLayout, slExamTypeLayout, slExamLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    pcrExam.Items.Clear();
                    pcrExamType.Items.Clear();
                    Items.Clear();

                    string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                    _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                    _ExamTypeList = await ExamTypeModel.GetExamType();

                    if (_ExamTypeList.Count > 0 && _ExamTypeList != null)
                    {
                        slExamLayout.IsVisible  = true;
                        _NotAvailData.IsVisible = false;
                    }
                    else
                    {
                        slExamLayout.IsVisible  = false;
                        _NotAvailData.IsVisible = true;
                    }

                    foreach (ExamTypeModel item in _ExamTypeList)
                    {
                        pcrExam.Items.Add(item.Name);
                    }

                    _Loader.IsShowLoading = false;
                });
            };

            pcrExam.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    Items.Clear();

                    string ExamName = lblExam.Text = pcrExam.Items[pcrExam.SelectedIndex];
                    _SelectedExamID = _ExamTypeList.FirstOrDefault(x => x.Name == ExamName).Id;
                });
            };

            //List view
            ListView StudentListView = new ListView
            {
                RowHeight      = 50,
                SeparatorColor = Color.Gray
            };

            StudentListView.ItemsSource  = Items;
            StudentListView.ItemTemplate = new DataTemplate(() => new StudentExamMarksCell());

            //Grid Header Layout
            Label lblAttendance = new Label
            {
                Text      = "Attendance",
                TextColor = Color.Black
            };

            StackLayout slAttendance = new StackLayout
            {
                Children          = { lblAttendance },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Label lblStudent = new Label
            {
                Text      = "Student",
                TextColor = Color.Black
            };

            StackLayout slStudentName = new StackLayout
            {
                Children          = { lblStudent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Label lblIsPresent = new Label
            {
                Text      = "A/P",
                TextColor = Color.Black
            };

            StackLayout slExamMarks = new StackLayout
            {
                Children          = { lblIsPresent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            StackLayout grid = new StackLayout
            {
                Children    = { slAttendance, slStudentName, slExamMarks },
                Orientation = StackOrientation.Horizontal,
                IsVisible   = false
            };

            Seperator spDisplayHeader = new Seperator();

            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    SaveStudentMarksMaster saveStudentMarksMaster = new SaveStudentMarksMaster();

                    //fillupAttendanceModel.StandardId = _SelectedStandardID;
                    //fillupAttendanceModel.ClassTypeId = _SelectedClassTypeID;
                    //fillupAttendanceModel.Date = Convert.ToDateTime(lblCurrentDate.Text).ToString("dd/MM/yyyy");
                    //fillupAttendanceModel.Students = Items.ToList();

                    bool isSaveAttendance = await SaveStudentMarksMaster.SaveStudentMarks(saveStudentMarksMaster);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slExamType = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _Loader, _NotAvailData },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slExamType,
            };
        }
Example #27
0
        /// <summary>
        /// Logbook FillUp Layout.
        /// </summary>
        public void LogbookFillUpLayout()
        {
            TitleBar    lblPageName = new TitleBar("Logbook FillUp");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black
            };

            lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            DatePicker dtStartDate = new DatePicker {
                IsVisible = false
            };

            StackLayout slStartDateDisplay = new StackLayout {
                Children = { lblCurrentDate, dtStartDate, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            //Frame layout for start date
            Frame frmStartDate = new Frame
            {
                Content           = slStartDateDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var currentDateTap = new TapGestureRecognizer();

            currentDateTap.NumberOfTapsRequired = 1; // single-tap
            currentDateTap.Tapped += (s, e) =>
            {
                dtStartDate.Focus();
            };
            frmStartDate.GestureRecognizers.Add(currentDateTap);
            slStartDateDisplay.GestureRecognizers.Add(currentDateTap);

            dtStartDate.DateSelected += (s, e) =>
            {
                lblCurrentDate.Text = (dtStartDate).Date.ToString("dd-MM-yyyy");
            };

            //dtStartDate.Unfocused += (sender, e) =>
            //{
            //    if (lblCurrentDate.Text == "Date")
            //    {
            //        lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yyyy");
            //    }
            //};


            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmStartDate }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //ExtendedEntry txtTeachingAids = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Teaching Aids"
            //};

            Label lblTeachingAids = new Label
            {
                Text      = "Teaching Aids",
                TextColor = Color.Black
            };

            Editor txtTeachingAids = new Editor
            {
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            StackLayout slLabelTeachingAids = new StackLayout
            {
                Children = { lblTeachingAids },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slTextTeachingAids = new StackLayout
            {
                Children = { txtTeachingAids },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtTeachingAids.Focused += (sender, e) =>
            //    {
            //        if (txtTeachingAids.Text == "Teaching Aids")
            //        {
            //            txtTeachingAids.Text = string.Empty;
            //            //txtTeachingAids.TextColor = Color.Black;
            //        }
            //    };


            StackLayout slTeachingAidsLayout = new StackLayout
            {
                Children          = { slLabelTeachingAids, slTextTeachingAids },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            //ExtendedEntry txtComment = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Comment"
            //};

            Label lblComment = new Label
            {
                Text      = "Comment",
                TextColor = Color.Black
            };

            Editor txtComment = new Editor
            {
                //TextColor = Color.Gray,
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            StackLayout slLabelComment = new StackLayout
            {
                Children = { lblComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slTextComment = new StackLayout
            {
                Children = { txtComment },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtComment.Focused += (sender, e) =>
            //    {
            //        if (txtComment.Text == "Comment")
            //        {
            //            txtComment.Text = string.Empty;
            //            //txtComment.TextColor = Color.Black;
            //        }
            //    };

            StackLayout slEditorLayout = new StackLayout
            {
                Children          = { slLabelTeachingAids, slTextTeachingAids },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            //ExtendedEntry txtLessonPlan = new ExtendedEntry
            //{
            //    TextColor = Color.Black,
            //    Placeholder = "Lesson Plan"
            //};

            Label lblLessonPlan = new Label
            {
                Text      = "Lesson Plan",
                TextColor = Color.Black
            };

            Editor txtLessonPlan = new Editor
            {
                //TextColor = Color.Gray,
                HeightRequest   = 80,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            StackLayout slLabelLessonPlan = new StackLayout
            {
                Children = { lblLessonPlan },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            StackLayout slTextLessonPlan = new StackLayout
            {
                Children = { txtLessonPlan },
                Padding  = new Thickness(0, 0, 0, 10)
            };

            //txtLessonPlan.Focused += (sender, e) =>
            //    {
            //        if (txtLessonPlan.Text == "Lesson Plan")
            //        {
            //            txtLessonPlan.Text = string.Empty;
            //            //txtLessonPlan.TextColor = Color.Black;
            //        }
            //    };

            StackLayout slLessonPlanLayout = new StackLayout
            {
                Children          = { slLabelLessonPlan, slTextLessonPlan },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation       = StackOrientation.Vertical
            };

            Image imgLectureDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblLecture = new Label {
                TextColor = Color.Black, Text = "Lecture"
            };
            Picker pcrLecture = new Picker {
                IsVisible = false, Title = "Lecture"
            };

            foreach (LectureModel item in _LectureList)
            {
                pcrLecture.Items.Add(item.LectureName);
            }

            StackLayout slLectureDisplay = new StackLayout {
                Children = { lblLecture, pcrLecture, imgLectureDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmLecture = new Frame
            {
                Content           = slLectureDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var lectureTap = new TapGestureRecognizer();

            lectureTap.NumberOfTapsRequired = 1; // single-tap
            lectureTap.Tapped += (s, e) =>
            {
                pcrLecture.Focus();
            };
            frmLecture.GestureRecognizers.Add(lectureTap);
            slLectureDisplay.GestureRecognizers.Add(lectureTap);

            StackLayout slLectureFrameLayout = new StackLayout
            {
                Children = { frmLecture }
            };

            StackLayout slLectureLayout = new StackLayout
            {
                Children          = { slLectureFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Padding     = new Thickness(0, 0, 0, 10),
                Children    = { slStartDateLayout, slLectureLayout, slTeachingAidsLayout, slLessonPlanLayout, slEditorLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            pcrLecture.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    string lectureName = lblLecture.Text = pcrLecture.Items[pcrLecture.SelectedIndex];

                    _SelectedLectureID = _LectureList.FirstOrDefault(x => x.LectureName == lectureName).Id;

                    //Exam list call
                    slStartDateLayout.IsVisible = true;
                });
            };


            Button btnSave = new Button();

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;

                    TeacherLogBookModel teacherLogBook = new TeacherLogBookModel();
                    teacherLogBook.Date         = Convert.ToDateTime(lblCurrentDate.Text).Date.ConvetDatetoDateCounter();
                    teacherLogBook.LessonPlan   = txtLessonPlan.Text;
                    teacherLogBook.TeachingAids = txtTeachingAids.Text;
                    teacherLogBook.Comment      = txtComment.Text;
                    teacherLogBook.LectureId    = _SelectedLectureID; //Convert.ToInt32(txtLectureNo.Text);

                    bool isSaveAttendance = await TeacherLogBookModel.SaveLogBook(teacherLogBook);

                    if (isSaveAttendance)
                    {
                        await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);
                    }
                    else
                    {
                        await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                    }
                    _Loader.IsShowLoading = false;
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchLayout, _NotAvailData, _Loader, cvBtnSave },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
        /// <summary>
        /// Fill Up Attendance Layout.
        /// </summary>
        public void FillUpAttendanceLayout()
        {
            TitleBar    lblPageName = new TitleBar("FillUp Attendance");
            StackLayout slTitle     = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(0, 5, 0, 0),
                BackgroundColor = Color.White,
                Children        = { lblPageName }
            };

            Seperator spTitle = new Seperator();

            Image imgStandardDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblStandard = new Label {
                TextColor = Color.Black, Text = "Standard"
            };
            Picker pcrStandard = new Picker {
                IsVisible = false, Title = "Standard"
            };

            foreach (StandardModel item in _StandardList)
            {
                pcrStandard.Items.Add(item.Name);
            }

            StackLayout slStandardDisplay = new StackLayout {
                Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmStandard = new Frame
            {
                Content           = slStandardDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var standardTap = new TapGestureRecognizer();

            standardTap.NumberOfTapsRequired = 1; // single-tap
            standardTap.Tapped += (s, e) =>
            {
                pcrStandard.Focus();
            };
            frmStandard.GestureRecognizers.Add(standardTap);
            slStandardDisplay.GestureRecognizers.Add(standardTap);

            StackLayout slStandardFrameLayout = new StackLayout
            {
                Children = { frmStandard }
            };

            StackLayout slStandardLayout = new StackLayout
            {
                Children          = { slStandardFrameLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Seperator spStandard = new Seperator();

            Image imgClassDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblClass = new Label {
                TextColor = Color.Black, Text = "Class"
            };
            Picker pcrClass = new Picker {
                IsVisible = false, Title = "Class"
            };

            StackLayout slClassDisplay = new StackLayout {
                Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmClass = new Frame
            {
                Content           = slClassDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var classTap = new TapGestureRecognizer();

            classTap.NumberOfTapsRequired = 1; // single-tap
            classTap.Tapped += (s, e) =>
            {
                pcrClass.Focus();
            };
            frmClass.GestureRecognizers.Add(classTap);
            slClassDisplay.GestureRecognizers.Add(classTap);

            StackLayout slClassFrmaeLayout = new StackLayout
            {
                Children = { frmClass }
            };

            StackLayout slClassLayout = new StackLayout
            {
                Children          = { slClassFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            Image imgStartDateDropDown = new Image {
                Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand
            };
            Label lblCurrentDate = new Label {
                TextColor = Color.Black, Text = DateTime.Now.ToString("dd-MM-yy")
            };
            DatePicker dtTimePicker = new DatePicker {
                IsVisible = false
            };

            StackLayout slSelectMonthDisplay = new StackLayout {
                Children = { lblCurrentDate, dtTimePicker, imgStartDateDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0))
            };

            Frame frmSelectMonth = new Frame
            {
                Content           = slSelectMonthDisplay,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                Padding           = new Thickness(10)
            };

            var dateTimePickerTap = new TapGestureRecognizer();

            dateTimePickerTap.NumberOfTapsRequired = 1; // single-tap
            dateTimePickerTap.Tapped += (s, e) =>
            {
                dtTimePicker.Focus();
            };
            frmSelectMonth.GestureRecognizers.Add(dateTimePickerTap);
            slSelectMonthDisplay.GestureRecognizers.Add(dateTimePickerTap);

            StackLayout slStartDateFrmaeLayout = new StackLayout
            {
                Children = { frmSelectMonth }
            };

            StackLayout slStartDateLayout = new StackLayout
            {
                Children          = { slStartDateFrmaeLayout },
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                IsVisible         = false
            };

            StackLayout slSearchinOneCol = new StackLayout
            {
                Children    = { slStandardLayout, slClassLayout },
                Orientation = StackOrientation.Horizontal
            };

            StackLayout slSearchLayout = new StackLayout
            {
                Padding  = new Thickness(0, 0, 0, 10),
                Children = { slStartDateLayout }
            };

            _NotAvailData = new Label {
                Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false
            };

            _Loader = new LoadingIndicator();

            //List view
            ListView FillUpAttendanceListView = new ListView
            {
                RowHeight      = 50,
                SeparatorColor = Color.Gray
            };

            FillUpAttendanceListView.ItemsSource  = Items;
            FillUpAttendanceListView.ItemTemplate = new DataTemplate(() => new FillUpAttendanceCell());

            //Grid Header Layout
            Label lblAttendance = new Label
            {
                Text      = "Attendance",
                TextColor = Color.Black
            };

            StackLayout slAttendance = new StackLayout
            {
                Children          = { lblAttendance },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Label lblStudent = new Label
            {
                Text      = "Student",
                TextColor = Color.Black
            };

            StackLayout slStudentName = new StackLayout
            {
                Children          = { lblStudent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand
            };

            Label lblIsPresent = new Label
            {
                Text      = "A/P",
                TextColor = Color.Black
            };

            StackLayout slExamMarks = new StackLayout
            {
                Children          = { lblIsPresent },
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            StackLayout grid = new StackLayout
            {
                Children    = { slStudentName, slAttendance, slExamMarks },
                Orientation = StackOrientation.Horizontal,
                IsVisible   = false
            };

            Seperator spDisplayHeader = new Seperator {
                IsVisible = false
            };

            Button btnSave = new Button {
                IsVisible = false
            };

            btnSave.Text            = "Save";
            btnSave.TextColor       = Color.White;
            btnSave.BackgroundColor = LayoutHelper.ButtonColor;

            //Stanndard Picker Selected
            pcrStandard.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    try
                    {
                        _Loader.IsShowLoading = true;
                        btnSave.IsVisible     = false;
                        pcrClass.Items.Clear();
                        lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");

                        string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                        _SelectedStandardID = _StandardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                        _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                        if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                        {
                            slClassLayout.IsVisible = true;
                            _NotAvailData.IsVisible = false;
                        }
                        else
                        {
                            slClassLayout.IsVisible = false;
                            _NotAvailData.IsVisible = true;
                        }

                        foreach (ClassTypeModel item in _ClassTypeList)
                        {
                            pcrClass.Items.Add(item.Name);
                        }

                        _Loader.IsShowLoading = false;
                    }
                    catch (Exception ex)
                    {
                    }
                });
            };

            //Class Picker Selected

            pcrClass.SelectedIndexChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    _Loader.IsShowLoading = true;
                    btnSave.IsVisible     = false;
                    Items.Clear();
                    lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");

                    string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                    _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                    slStartDateLayout.IsVisible = true;
                    _Loader.IsShowLoading       = false;
                });
            };

            //dtTimePicker.Unfocused += (sender, e) =>
            //{
            //    if (lblCurrentDate.Text == "Date")
            //    {
            //        lblCurrentDate.Text = DateTime.Now.ToString("dd-MM-yy");
            //    }
            //};

            dtTimePicker.DateSelected += (sender, e) =>
            {
                try
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        _Loader.IsShowLoading = true;
                        btnSave.IsVisible     = false;
                        lblCurrentDate.Text   = dtTimePicker.Date.ToString("dd-MM-yy");

                        int dateCounter = dtTimePicker.Date.ConvetDatetoDateCounter();

                        //get student list
                        _FillUpAttendanceModel = await FillUpAttendanceModel.GetFillUpAttendance(_SelectedStandardID, _SelectedClassTypeID, dateCounter);

                        if (_FillUpAttendanceModel.Students != null)
                        {
                            Items = new ObservableCollection <Student>(_FillUpAttendanceModel.Students);

                            if (Items.Count > 0 && Items != null)
                            {
                                FillUpAttendanceListView.ItemsSource = Items;
                                grid.IsVisible            = true;
                                btnSave.IsVisible         = true;
                                spDisplayHeader.IsVisible = true;
                                _NotAvailData.IsVisible   = false;
                            }
                            else
                            {
                                grid.IsVisible            = false;
                                spDisplayHeader.IsVisible = false;
                                btnSave.IsVisible         = false;
                                _NotAvailData.IsVisible   = true;
                            }
                        }
                        else
                        {
                            grid.IsVisible            = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.IsVisible   = true;
                            btnSave.IsVisible         = false;
                        }
                        _Loader.IsShowLoading = false;
                    });
                }
                catch (Exception ex)
                {
                    grid.IsVisible            = false;
                    spDisplayHeader.IsVisible = false;
                    _NotAvailData.IsVisible   = true;
                    btnSave.IsVisible         = false;
                    _Loader.IsShowLoading     = false;
                }
            };

            btnSave.Clicked += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    try
                    {
                        btnSave.IsVisible     = false;
                        _Loader.IsShowLoading = true;

                        FillUpAttendanceModel fillupAttendanceModel = new FillUpAttendanceModel();

                        fillupAttendanceModel.StandardId  = _SelectedStandardID;
                        fillupAttendanceModel.ClassTypeId = _SelectedClassTypeID;
                        fillupAttendanceModel.Date        = Convert.ToDateTime(lblCurrentDate.Text).ToString("dd/MM/yyyy");
                        fillupAttendanceModel.Students    = Items.ToList();

                        bool isSaveAttendance = await FillUpAttendanceModel.SaveStudentAttendance(fillupAttendanceModel);

                        if (isSaveAttendance)
                        {
                            await DisplayAlert(string.Empty, "Save Successfully.", Messages.Ok);

                            //_StudentAttendanceList = await StudentAttendanceModel.GetStudentAttendance(_SelectedBatchID, 9);

                            //if (_StudentAttendanceList.Count > 0)
                            //{
                            //    _NotAvailData.IsVisible = false;
                            //    Items = new ObservableCollection<StudentAttendanceModel>(_StudentAttendanceList);

                            //    if (Items.Count > 0)
                            //    {
                            //        int noCount = 1;

                            //        for (int i = 0; i < Items.Count; i++)
                            //        {
                            //            Items[i].IndexNo = noCount;
                            //            noCount++;
                            //        }

                            //        grid.IsVisible = true;
                            //        _Loader.IsShowLoading = false;
                            //        _NotAvailLecture.IsVisible = false;

                            //        studentAttendanceListView.ItemsSource = Items;
                            //    }
                            //    else
                            //    {
                            //        grid.IsVisible = false;
                            //        _Loader.IsShowLoading = false;
                            //        _NotAvailLecture.IsVisible = true;
                            //    }
                            //}
                        }
                        else
                        {
                            await DisplayAlert(Messages.Error, "Some problem ocuured when saving data.", Messages.Ok);
                        }
                        _Loader.IsShowLoading = false;
                    }
                    catch (Exception ex)
                    {
                        btnSave.IsVisible     = true;
                        _Loader.IsShowLoading = false;
                    }
                });
            };

            var cvBtnSave = new ContentView
            {
                Padding = new Thickness(10, 5, 10, 10),
                Content = btnSave
            };

            StackLayout slViewAttendance = new StackLayout
            {
                Children =
                {
                    new StackLayout {
                        Padding         = new Thickness(20, Device.OnPlatform(40, 20, 0), 20, 20),
                        Children        = { slTitle, spTitle.LineSeperatorView, slSearchinOneCol, slSearchLayout, grid, spDisplayHeader.LineSeperatorView, _Loader, _NotAvailData, FillUpAttendanceListView, cvBtnSave },
                        VerticalOptions = LayoutOptions.FillAndExpand,
                    },
                },
                BackgroundColor = LayoutHelper.PageBackgroundColor
            };

            Content = new ScrollView
            {
                Content = slViewAttendance,
            };
        }
        /// <summary>
        /// Todays Timetable
        /// </summary>
        public void TodaysTimetableLayout()
        {
            try
            {
                TitleBar lblPageName = new TitleBar("Today's TimeTable");
                StackLayout slTitle = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Padding = new Thickness(0, 5, 0, 0),
                    BackgroundColor = Color.White,
                    Children = { lblPageName }
                };

                Seperator spTitle = new Seperator();

                BindableRadioGroup radByTeacherOrClass = new BindableRadioGroup();

                radByTeacherOrClass.ItemsSource = new[] { "By Teacher", "By Class" };
                radByTeacherOrClass.HorizontalOptions = LayoutOptions.FillAndExpand;
                radByTeacherOrClass.Orientation = StackOrientation.Horizontal;
                radByTeacherOrClass.TextColor = Color.Black;

                StackLayout slRadio = new StackLayout
                {
                    Children = { radByTeacherOrClass },
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };

                #region By Teacher

                Image imgTeacherDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblTeacher = new Label { TextColor = Color.Black, Text = "Teacher" };
                Picker pcrTeacher = new Picker { IsVisible = false, Title = "Teacher" };

                StackLayout slTeacherDisplay = new StackLayout { Children = { lblTeacher, pcrTeacher, imgTeacherDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmTeacher = new Frame
                {
                    Content = slTeacherDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var teacherTap = new TapGestureRecognizer();

                teacherTap.NumberOfTapsRequired = 1; // single-tap
                teacherTap.Tapped += (s, e) =>
                {
                    pcrTeacher.Focus();
                };
                frmTeacher.GestureRecognizers.Add(teacherTap);
                slTeacherDisplay.GestureRecognizers.Add(teacherTap);

                StackLayout slTeacherFrameLayout = new StackLayout
                {
                    Children = { frmTeacher }
                };

                StackLayout slTeacherLayout = new StackLayout
                {
                    Children = { slTeacherFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                Label lblStandardName = new Label
                {
                    Text = "Standard Name",
                    TextColor = Color.Black
                };

                StackLayout slStandardName = new StackLayout
                {
                    Children = { lblStandardName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                };

                Label lblClassTypeName = new Label
                {
                    Text = "Class Type Name",
                    TextColor = Color.Black
                };

                StackLayout slClassTypeName = new StackLayout
                {
                    Children = { lblClassTypeName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblStubjectName = new Label
                {
                    Text = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubjectName = new StackLayout
                {
                    Children = { lblStubjectName },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };
                #endregion

                #region By Class

                Image imgStandardDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblStandard = new Label { TextColor = Color.Black, Text = "Standard" };
                Picker pcrStandard = new Picker { IsVisible = false, Title = "Standard" };

                StackLayout slStandardDisplay = new StackLayout { Children = { lblStandard, pcrStandard, imgStandardDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmStandard = new Frame
                {
                    Content = slStandardDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var standardTap = new TapGestureRecognizer();

                standardTap.NumberOfTapsRequired = 1; // single-tap
                standardTap.Tapped += (s, e) =>
                {
                    pcrStandard.Focus();
                };
                frmStandard.GestureRecognizers.Add(standardTap);
                slStandardDisplay.GestureRecognizers.Add(standardTap);

                StackLayout slStandardFrameLayout = new StackLayout
                {
                    Children = { frmStandard }
                };

                StackLayout slStandardLayout = new StackLayout
                {
                    Children = { slStandardFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                Image imgClassDropDown = new Image { Source = Constants.ImagePath.DropDownArrow, HorizontalOptions = LayoutOptions.EndAndExpand };
                Label lblClass = new Label { TextColor = Color.Black, Text = "Class" };
                Picker pcrClass = new Picker { IsVisible = false, Title = "Class" };

                StackLayout slClassDisplay = new StackLayout { Children = { lblClass, pcrClass, imgClassDropDown }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 5, 0), Device.OnPlatform(0, 10, 0), Device.OnPlatform(0, 5, 0)) };

                Frame frmClass = new Frame
                {
                    Content = slClassDisplay,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    OutlineColor = Color.Black,
                    Padding = new Thickness(10)
                };

                var classTap = new TapGestureRecognizer();

                classTap.NumberOfTapsRequired = 1; // single-tap
                classTap.Tapped += (s, e) =>
                {
                    pcrClass.Focus();
                };
                frmClass.GestureRecognizers.Add(classTap);
                slClassDisplay.GestureRecognizers.Add(classTap);

                StackLayout slClassFrameLayout = new StackLayout
                {
                    Children = { frmClass }
                };

                StackLayout slClassLayout = new StackLayout
                {
                    Children = { slClassFrameLayout },
                    Orientation = StackOrientation.Vertical,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = false
                };

                //Grid Header
                Label lblTeachername = new Label
                {
                    Text = "Teacher Name",
                    TextColor = Color.Black
                };

                StackLayout slTeacherName = new StackLayout
                {
                    Children = { lblTeachername },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.CenterAndExpand
                };

                Label lblStubject = new Label
                {
                    Text = "Subject Name",
                    TextColor = Color.Black
                };

                StackLayout slSubject = new StackLayout
                {
                    Children = { lblStubject },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.EndAndExpand
                };

                #endregion

                Label lblSequensNo = new Label
                {
                    Text = "No",
                    TextColor = Color.Black
                };

                StackLayout slSequensNo = new StackLayout
                {
                    Children = { lblSequensNo },
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    HorizontalOptions = LayoutOptions.StartAndExpand
                };

                StackLayout grid = new StackLayout
                {
                    //Children = { slTeacherName, slSequensNo, slSubjectName },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible = false
                };

                Seperator spDisplayHeader = new Seperator { IsVisible = false };

                StackLayout slSearchinOneCol = new StackLayout
                {
                    Children = { slStandardLayout, slClassLayout },
                    Orientation = StackOrientation.Horizontal,
                    IsVisible = false
                };

                _NotAvailData = new Label { Text = "No data availalble for this search data.", TextColor = Color.Red, IsVisible = false };

                _Loader = new LoadingIndicator();

                radByTeacherOrClass.CheckedChanged += (sender, e) =>
                    {
                        Device.BeginInvokeOnMainThread(async () =>
                       {
                           var radio = sender as CustomRadioButton;

                           if (radio == null || radio.Id == -1)
                           {
                               return;
                           }

                           if (radio.Text == "By Teacher")
                           {
                               slTeacherLayout.IsVisible = true;
                               slSearchinOneCol.IsVisible = false;

                               foreach (TeacherModel item in _TeacherList)
                               {
                                   pcrTeacher.Items.Add(item.Name);
                               }

                               grid.Children.Add(slSequensNo);
                               grid.Children.Add(slStandardDisplay);
                               grid.Children.Add(slClassTypeName);
                               grid.Children.Add(slSubjectName);

                           }
                           else
                           {
                               slSearchinOneCol.IsVisible = true;
                               slTeacherLayout.IsVisible = false;

                               grid.Children.Add(slSequensNo);
                               grid.Children.Add(slTeacherName);
                               grid.Children.Add(slSubject);

                               _StatndardList = await StandardModel.GetStandard();

                               foreach (StandardModel item in _StatndardList)
                               {
                                   pcrStandard.Items.Add(item.Name);
                               }
                           }
                       });
                    };

                //List view
                ListView TimeTableListView = new ListView
                {
                    RowHeight = 50,
                    SeparatorColor = Color.Gray
                };

                TimeTableListView.ItemTemplate = new DataTemplate(() => new FillUpAttendanceCell());

                pcrStandard.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        try
                        {
                            _Loader.IsShowLoading = true;
                            pcrClass.Items.Clear();

                            string standardName = lblStandard.Text = pcrStandard.Items[pcrStandard.SelectedIndex];

                            _SelectedStandardID = _StatndardList.Where(x => x.Name == standardName).FirstOrDefault().Id;

                            _ClassTypeList = await ClassTypeModel.GetClassType(_SelectedStandardID);

                            if (_ClassTypeList.Count > 0 && _ClassTypeList != null)
                            {
                                slClassLayout.IsVisible = true;
                                _NotAvailData.IsVisible = false;
                            }
                            else
                            {
                                slClassLayout.IsVisible = false;
                                _NotAvailData.IsVisible = true;
                            }

                            foreach (ClassTypeModel item in _ClassTypeList)
                            {
                                pcrClass.Items.Add(item.Name);
                            }

                            _Loader.IsShowLoading = false;
                        }
                        catch (Exception ex)
                        {

                        }
                    });
                };

                //Class Picker Selected

                pcrClass.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        _Loader.IsShowLoading = true;
                        _NotAvailData.IsVisible = false;

                        string className = lblClass.Text = pcrClass.Items[pcrClass.SelectedIndex];

                        _SelectedClassTypeID = _ClassTypeList.FirstOrDefault(x => x.Name == className).Id;

                        //Get time table list
                        _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedStandardID, _SelectedClassTypeID);

                        if (_TimeTableList != null && _TimeTableList.Count > 0)
                        {
                            grid.IsVisible = true;
                            spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                            TimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            grid.IsVisible = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.Text = "There is no data for selected standard and class.";
                            _NotAvailData.IsVisible = true;
                        }
                        _Loader.IsShowLoading = false;
                    });
                };

                //Class Picker Selected

                pcrTeacher.SelectedIndexChanged += (sender, e) =>
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        _Loader.IsShowLoading = true;
                        _NotAvailData.IsVisible = false;

                        string teacherName = lblTeacher.Text = pcrTeacher.Items[pcrTeacher.SelectedIndex];

                        _SelectedTeacherID = _TeacherList.FirstOrDefault(x => x.Name == teacherName).ID;

                        //Get time table list
                        _TimeTableList = await TimeTableModel.ShowTimeTable(_SelectedTeacherID);

                        if (_TimeTableList != null && _TimeTableList.Count > 0)
                        {
                            grid.IsVisible = true;
                            spDisplayHeader.IsVisible = true;
                            Items = new ObservableCollection<TimeTableModel>(_TimeTableList);
                            TimeTableListView.ItemsSource = Items;
                        }
                        else
                        {
                            grid.IsVisible = false;
                            spDisplayHeader.IsVisible = false;
                            _NotAvailData.Text = "There is no data for selected standard and class.";
                            _NotAvailData.IsVisible = true;
                        }
                        _Loader.IsShowLoading = false;
                    });
                };

                StackLayout slTimeTable = new StackLayout
                {
                    Children = { 
                        new StackLayout{
                            Padding = new Thickness(20, Device.OnPlatform(40,20,0), 20, 20),
						    Children = {slTitle, spTitle.LineSeperatorView,slRadio,slTeacherLayout, slSearchinOneCol,grid,spDisplayHeader.LineSeperatorView, _Loader, _NotAvailData,TimeTableListView},
                            VerticalOptions = LayoutOptions.FillAndExpand,
                        },
                    },
                    BackgroundColor = LayoutHelper.PageBackgroundColor
                };

                Content = new ScrollView
                {
                    Content = slTimeTable,
                };
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #30
0
        public static CommaSeparatedValues <T> Load(string csvFilePath, Func <string[], T> converter, Seperator seperator = Seperator.Comma, bool hasHeader = false)
        {
            if (csvFilePath is null)
            {
                throw new ArgumentNullException(nameof(csvFilePath));
            }
            if (converter is null)
            {
                throw new ArgumentNullException(nameof(converter));
            }

            using (var fstream = File.Open(csvFilePath, FileMode.Open, FileAccess.Read))
            {
                using (var sr = new StreamReader(fstream))
                {
                    var raw = sr.ReadToEnd();
                    Debug.WriteLine(raw);
                    return(new CommaSeparatedValues <T>(raw, converter, seperator, hasHeader));
                }
            }
        }