protected override void OnBindingContextChanged()
        {
            model = (InterviewsModel)BindingContext;
            base.OnBindingContextChanged();
            StackLayout stack = CreateEditLineItem();

            View = stack;
        }
Beispiel #2
0
        public static Task <string> SaveInterviewRound(InterviewsModel objInterview)
        {
            var responseStr = new TaskCompletionSource <string>();

            using (var client = new HttpClient())
            {
                try
                {
                    var stringContent = new StringContent(JsonConvert.SerializeObject(objInterview), Encoding.UTF8, "application/json");
                    var result        = client.PostAsync(Constant.LocalhostURL + "Interview/SaveInterviewRound/", stringContent).Result;
                    responseStr.TrySetResult(result.Content.ReadAsStringAsync().Result);
                }
                catch (Exception ex)
                {
                    responseStr.TrySetResult(ex.Message.ToString());
                }
                return(responseStr.Task);
            }
        }
Beispiel #3
0
        public TestExam()
        {
            SubjectTakensModel subjectTakenModel = new SubjectTakensModel();

            InterviewsModel interviewsModel = new InterviewsModel();
            List <Batch>    batchModel      = new List <Batch>();

            Device.BeginInvokeOnMainThread(async() =>
            {
                var getCandidateIdByUserId = await Service.GetCandidateDetail(1);  //here should be ACTContext.userId

                if (getCandidateIdByUserId != null)
                {
                    interviewsModel = JsonConvert.DeserializeObject <InterviewsModel>(getCandidateIdByUserId);
                    //batchModel = (List<Batch>)JsonConvert.DeserializeObject<List<Batch>>(getBatchList);
                    ACTContext.candidateId = interviewsModel.CandidateId;
                    //ACTContext.batchId = (from c in batchModel where c.CollegeId == interviewsModel.id select c.Id).SingleOrDefault();

                    subjectTakenModel.CandidateId = ACTContext.candidateId;
                    var getBatchList          = await Service.GetBatch(ACTContext.candidateId);
                    subjectTakenModel.BatchId = int.Parse(getBatchList);  //need to know how batch id works
                }
            });

            List <QuestionSet> questions = new List <QuestionSet>();


            Device.BeginInvokeOnMainThread(async() =>
            {
                var resultSubjectTakenModel = await Service.QuetionsListByQuetionSetId(subjectTakenModel);
                var resultQuestions         = await Service.GetQuestionSet();

                if (resultQuestions != null && resultSubjectTakenModel != null)
                {
                    subjectTakenModel = JsonConvert.DeserializeObject <SubjectTakensModel>(resultSubjectTakenModel);
                    questions         = (List <QuestionSet>)JsonConvert.DeserializeObject <List <QuestionSet> >(resultQuestions);
                    TestExamLayout(subjectTakenModel);
                    examRemainigHour     = subjectTakenModel.ExamDuration / 60;
                    examReamainingMinute = subjectTakenModel.ExamDuration % 60;
                    examRemainingSecond  = 1;
                }
            });
        }
        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());
            }
        }
Beispiel #5
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());
            }
        }
 public InterviewMatrixCell(List <InterviewsModel> lstInterviewRoundsDetail, List <Models.CandidateDetails> candidateListForIm, InterviewsModel canditeInterviwsModel)
 {
     items = lstInterviewRoundsDetail;
     itemsCandidateDetail = candidateListForIm;
     interviewsModel      = canditeInterviwsModel;
 }