public NomineesPosition_Form(Nominee nominee)
        {
            InitializeComponent();

            //לשונית פריטים להזמנה
            //תיבת רשימה - פריטים בהזמנה
            //מוצאים את הפריטים בהזמנה הנוכחית
            // כל הזוגות פריט -הזמנה
            if (nominee != Nominee.Empty)
            {
                PositionNomineeArr positionNomineeArr = new PositionNomineeArr();
                positionNomineeArr.Fill();

                //סינון לפי הזמנה נוכחית

                positionNomineeArr = positionNomineeArr.Filter(nominee, Position.Empty);

                //רק אוסף הפריטים מתוך אוסף הזוגות פריט -הזמנה

                PositionArr positionArrInNominee = positionNomineeArr.ToPositionArr();
                PositionArrToForm(positionArrInNominee, listBox_ChosenPositions);


                //תיבת רשימה - פריטים פוטנציאלים
                //כל הפריטים - פחות אלו שכבר נבחרו

                PositionArr positionArrNotInNominee = new PositionArr();
                positionArrNotInNominee.Fill();

                //הורדת הפריטים שכבר קיימים בהזמנה

                positionArrNotInNominee.Remove(positionArrInNominee);
                PositionArrToForm(positionArrNotInNominee, listBox_AvailablePositions);
            }
            else
            {
                PositionArrToForm(new PositionArr(), listBox_ChosenPositions);

                PositionArr positionArrNotInNominee = new PositionArr();
                positionArrNotInNominee.Fill();

                //הורדת הפריטים שכבר קיימים בהזמנה
                PositionArrToForm(positionArrNotInNominee, listBox_AvailablePositions);
            }



            button_Add.Enabled    = false;
            button_Remove.Enabled = false;

            listBox_AvailablePositions.ClearSelected();
            listBox_ChosenPositions.ClearSelected();
        }
Example #2
0
        private NomineeScoreTypeArr FillData(NomineeScoreTypeArr nomineeScoreTypeArr, Nominee nominee, Interviewer interviewer)
        {
            //
            PositionNomineeArr positionNomineeArr = new PositionNomineeArr();

            positionNomineeArr.Fill();
            positionNomineeArr = positionNomineeArr.Filter(nominee, Position.Empty);

            PositionArr positionArr = positionNomineeArr.ToPositionArr();
            //

            ScoreTypeArr scoreTypeArr = new ScoreTypeArr();

            Position         position;
            ScoreType        scoreType;
            NomineeScoreType nomineeScoreType;

            for (int i = 0; i < positionArr.Count; i++)
            {
                position = positionArr[i] as Position;

                scoreTypeArr.Fill();
                scoreTypeArr = scoreTypeArr.Filter(position, "");

                for (int j = 0; j < scoreTypeArr.Count; j++)
                {
                    scoreType = scoreTypeArr[j] as ScoreType;

                    if (!nomineeScoreTypeArr.DoesContainData(interviewer, nominee, scoreType))
                    {
                        nomineeScoreType             = new NomineeScoreType();
                        nomineeScoreType.Interviewer = interviewer;
                        nomineeScoreType.Nominee     = nominee;
                        nomineeScoreType.ScoreType   = scoreType;
                        nomineeScoreType.DateTime    = DateTime.Now;

                        nomineeScoreTypeArr.Add(nomineeScoreType);
                    }
                }
            }
            return(nomineeScoreTypeArr);
        }
        private void NomineeToForm(Nominee nominee)
        {
            if (nominee != null)
            {
                SetLastChangedTextbox(nominee.DBId);
                label_ShowDisabled.Visible  = nominee.Disabled;
                textBox_FirstName.Text      = nominee.FirstName;
                textBox_LastName.Text       = nominee.LastName;
                textBox_ID.Text             = nominee.Id;
                textBox_Email.Text          = nominee.Email;
                textBox_BirthYear.Text      = nominee.BirthYear.ToString();
                comboBox_CellAreaCode.Text  = nominee.CellAreaCode;
                textBox_Cel.Text            = nominee.CellPhone;
                comboBox_City.SelectedValue = nominee.City.Id;
                checkBox_Sex.Checked        = nominee.Male;

                PositionNomineeArr positionNomineeArr = new PositionNomineeArr();
                positionNomineeArr.Fill();
                positionNomineeArr = positionNomineeArr.Filter(nominee, Position.Empty);

                PositionArr positionArr = positionNomineeArr.ToPositionArr();

                textBox_Positions.Tag = positionArr;
                SetPositionTextBoxAndToolTip(positionArr);

                //scores

                button_OpenScoreKeeping.Enabled = true;

                //end scores

                label_DBID.Text = nominee.DBId.ToString();

                (string path, string type)cv = GetCV(nominee.DBId);
                if (cv.path != "")
                {
                    button_Add_CV.BackColor = Color.Green;
                    button_Add_CV.Text      = "ישנם קורות חיים";
                    button_Add_CV.Tag       = cv.path;
                    //there is a cv file
                    if (cv.type == "pdf")
                    {
                        //the file is a pdf file
                        PDF_CV_Viewer.src = cv.path;
                    }
                    else
                    {
                        //the file is a docx file. open it with a word program.
                        PDF_CV_Viewer.src = GetCV(0).path;

                        PDF_CV_Viewer.Update();

                        try
                        {
                            Process.Start(cv.path);
                        }
                        catch
                        { }
                    }
                }
                else
                {
                    //there is no file
                    button_Add_CV.Text      = "הוסף קורות חיים";
                    button_Add_CV.BackColor = SystemColors.ButtonFace;
                    button_Add_CV.UseVisualStyleBackColor = true;

                    PDF_CV_Viewer.src = GetCV(0).path;

                    PDF_CV_Viewer.Update();
                }
            }
            else
            {
                comboBox_City.SelectedItem = null;
                textBox_Positions.Tag      = new PositionArr();
                SetPositionTextBoxAndToolTip(textBox_Positions.Tag as PositionArr);

                checkBox_Sex.Checked = false;

                //Reset the text and flags of the input fields.
                foreach (Control item in groupBox_PD.Controls)
                {
                    if (item is TextBox || item is ComboBox)
                    {
                        item.Text = "";
                        if (item.Name != "textBox_Last_Change")
                        {
                            item.BackColor = Color.White;
                        }
                    }
                }
                PDF_CV_Viewer.BeginInit();
                PDF_CV_Viewer.src = null;
                PDF_CV_Viewer.src = GetCV(0).path;
                PDF_CV_Viewer.EndInit();
                PDF_CV_Viewer.Update();

                button_Add_CV.Tag       = GetCV(0).path;
                button_Add_CV.Text      = "הוסף קורות חיים";
                button_Add_CV.BackColor = SystemColors.ButtonFace;
                button_Add_CV.UseVisualStyleBackColor = true;

                label_ShowDisabled.Visible = false;

                //scores
                button_OpenScoreKeeping.Enabled = false;


                //end scores


                label_DBID.Text = "0";
            }
        }