private void SetPositionTextBoxAndToolTip(PositionArr positionArr)
        {
            if (positionArr == null)
            {
                textBox_Positions.Text = "נבחרו 0 משרות";
                toolTip_Positions.SetToolTip(textBox_Positions, "אף משרה לא נבחרה");
                return;
            }

            if (positionArr.Count == 0)
            {
                textBox_Positions.Text = "נבחרו 0 משרות";
                toolTip_Positions.SetToolTip(textBox_Positions, "אף משרה לא נבחרה");
            }
            else if (positionArr.Count == 1)
            {
                textBox_Positions.Text = "נבחרה משרה אחת";
                toolTip_Positions.SetToolTip(textBox_Positions, positionArr[0].ToString());
            }
            else
            {
                textBox_Positions.Text = "נבחרו " + positionArr.Count + " משרות";
                string positions = positionArr[0].ToString();
                for (int i = 1; i < positionArr.Count; i++)
                {
                    positions += "\n" + positionArr[i].ToString();
                }

                toolTip_Positions.SetToolTip(textBox_Positions, positions);
            }
        }
        private PositionNomineeArr FormToPositionNomineeArr(Nominee curNom)
        {
            //יצירת אוסף המוצרים להזמנה מהטופס
            //מייצרים זוגות של הזמנה-מוצר, ההזמנה - תמיד אותה הזמנה )הרי מדובר על הזמנה אחת(, המוצר - מגיע מרשימת
            //המוצרים שנבחרו
            PositionArr positionArr = (textBox_Positions.Tag as PositionArr);

            PositionNomineeArr positionNomineeArr = new PositionNomineeArr();
            //יצירת אוסף הזוגות הזמנה-מוצר
            PositionNominee positionNominee;

            //סורקים את כל הערכים בתיבת הרשימה של המוצרים שנבחרו להזמנה
            for (int i = 0; i < positionArr.Count; i++)
            {
                positionNominee = new PositionNominee();
                //ההזמנה הנוכחית היא ההזמנה לכל הזוגות באוסף
                positionNominee.Nominee = curNom;
                //מוצר נוכחי לזוג הזמנה-מוצר
                positionNominee.Position = positionArr[i] as Position;

                //הוספת הזוג הזמנה - מוצר לאוסף
                positionNomineeArr.Add(positionNominee);
            }
            return(positionNomineeArr);
        }
        private void MoveSelectedItemBetweenListBox(ListBox listBox_From, ListBox listBox_To)
        {
            PositionArr positionArr;

            //מוצאים את הפריט הנבחר

            object selectedItem = listBox_From.SelectedItem;

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

            if (listBox_To.DataSource != null)
            {
                positionArr = listBox_To.DataSource as PositionArr;
            }
            else
            {
                positionArr = new PositionArr();
            }

            positionArr.Insert(0, selectedItem);
            PositionArrToForm(positionArr, listBox_To);

            ///הסרת הפריט הנבחרים מרשימת הפריטים הנבחרים

            positionArr = listBox_From.DataSource as PositionArr;
            positionArr.Remove(selectedItem);
            PositionArrToForm(positionArr, listBox_From);
        }
        private void button_ShowPositions_Click(object sender, EventArgs e)
        {
            PositionArr positionArr = textBox_Positions.Tag as PositionArr;
            Nominee     nom;

            if (label_DBID.Text != "0")
            {
                NomineeArr nomineeArr = new NomineeArr();
                nomineeArr.Fill();
                nom = nomineeArr.GetNomineeByDBId(int.Parse(label_DBID.Text));
            }
            else
            {
                nom = Nominee.Empty;
            }


            NomineesPosition_Form npForm;

            if ((textBox_Positions.Tag as PositionArr).Count == 0)
            {
                npForm = new NomineesPosition_Form(nom);
            }
            else
            {
                npForm = new NomineesPosition_Form(positionArr);
            }

            npForm.ShowDialog();

            positionArr           = npForm.ChosenPositionArr;
            textBox_Positions.Tag = positionArr;

            SetPositionTextBoxAndToolTip(positionArr);
        }
        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();
        }
        private void PositionArrToForm()
        {
            PositionArr positionArr = new PositionArr();

            positionArr.Fill();
            positionArr.Insert(0, Position.Empty);

            comboBox_Position.DataSource         = positionArr;
            comboBox_Position.ValueMember        = "Id";
            comboBox_Position.DisplayMember      = "Name";
            comboBox_Position.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            comboBox_Position.AutoCompleteSource = AutoCompleteSource.ListItems;
            comboBox_Position.SelectedValue      = 0;
        }
Example #7
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);
        }
        public NomineesPosition_Form(PositionArr positionArr)
        {
            InitializeComponent();

            PositionArrToForm(positionArr, listBox_ChosenPositions);


            PositionArr positionArrNotInNominee = new PositionArr();

            positionArrNotInNominee.Fill();

            positionArrNotInNominee.Remove(positionArr);
            PositionArrToForm(positionArrNotInNominee, listBox_AvailablePositions);



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

            listBox_AvailablePositions.ClearSelected();
            listBox_ChosenPositions.ClearSelected();
        }
        //----------------------------------------------------------------------------------------------------

        private void PositionArrToForm(PositionArr positionArr, ListBox listBox)
        {
            //מקבלת אוסף פריטים ותיבת רשימה לפריטים ומציבה את האוסף בתוך התיבה
            //אם האוסף ריק - מייצרת אוסף חדש מלא בכל הערכים מהטבלה

            listBox.DataSource = null;
            if (positionArr == null)
            {
                positionArr = new PositionArr();
                positionArr.Fill();
            }
            listBox.DataSource = positionArr;

            if (listBox == listBox_AvailablePositions)
            {
                availablePosArr = positionArr;
            }
            else
            {
                chosenPosArr = positionArr;
            }
        }
Example #10
0
        private void FilterArrsToForm()
        {
            PositionArr positionArr = new PositionArr();

            positionArr.Fill();
            positionArr.Insert(0, Position.Empty);

            comboBox_PositionFilter.DataSource         = positionArr;
            comboBox_PositionFilter.ValueMember        = "Id";
            comboBox_PositionFilter.DisplayMember      = "Name";
            comboBox_PositionFilter.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            comboBox_PositionFilter.AutoCompleteSource = AutoCompleteSource.ListItems;



            InterviewerArr interviewerArr = new InterviewerArr();

            interviewerArr.Fill();

            comboBox_InterviewerFilter.DataSource         = interviewerArr;
            comboBox_InterviewerFilter.ValueMember        = "Id";
            comboBox_InterviewerFilter.DisplayMember      = "FullName";
            comboBox_InterviewerFilter.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            comboBox_InterviewerFilter.AutoCompleteSource = AutoCompleteSource.ListItems;



            NomineeArr nomineeArr = new NomineeArr();

            nomineeArr.Fill();
            nomineeArr.Insert(0, Nominee.Empty);

            comboBox_NomineeFilter.DataSource         = nomineeArr;
            comboBox_NomineeFilter.ValueMember        = "Id";
            comboBox_NomineeFilter.DisplayMember      = "FullName";
            comboBox_NomineeFilter.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            comboBox_NomineeFilter.AutoCompleteSource = AutoCompleteSource.ListItems;
        }
Example #11
0
        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";
            }
        }