예제 #1
0
        /// <summary>
        /// Process the changing content
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChangeContentCallback(object sender, EventArgs e)
        {
            TextBox tb       = (TextBox)sender;
            var     position = Table.GetCellPosition(tb);

            if (position.Column == 0)
            {
                teachersList[position.Row - 2].FullName = tb.Text;
            }
            else
            {
                string         columnName   = ColumnNameCB.Text;
                int            rowPos       = position.Row - 2;
                TeacherAddInfo addInfoModel = teachersList[rowPos].AddInfo;
                switch (AppConstants.columnsTeacherList.IndexOf(columnName))
                {
                case 0:
                    addInfoModel.Birthday = tb.Text;
                    break;

                case 1:
                    addInfoModel.Address = tb.Text;
                    break;

                case 2:
                    addInfoModel.Passport = tb.Text;
                    break;

                case 3:
                    addInfoModel.SNILS = tb.Text;
                    break;

                case 4:
                    addInfoModel.INN = tb.Text;
                    break;

                case 5:
                    addInfoModel.Account = tb.Text;
                    break;

                case 6:
                    addInfoModel.BankAccont = tb.Text;
                    break;

                case 7:
                    addInfoModel.Phone = tb.Text;
                    break;
                }
                teachersList[rowPos].AddInfo = addInfoModel;
            }
        }
예제 #2
0
        private void ColumnNameCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            string columnName = ColumnNameCB.Text;

            for (int i = 2; i < Table.RowCount; i++)
            {
                TextBox tb = (TextBox)Table.GetControlFromPosition(1, i);
                tb.TextChanged -= ChangeContentCallback;
                TeacherAddInfo tai = teachersList[i - 2].AddInfo;
                switch (AppConstants.columnsTeacherList.IndexOf(columnName))
                {
                case 0:
                    tb.Text = tai.Birthday;
                    break;

                case 1:
                    tb.Text = tai.Address;
                    break;

                case 2:
                    tb.Text = tai.Passport;
                    break;

                case 3:
                    tb.Text = tai.SNILS;
                    break;

                case 4:
                    tb.Text = tai.INN;
                    break;

                case 5:
                    tb.Text = tai.Account;
                    break;

                case 6:
                    tb.Text = tai.BankAccont;
                    break;

                case 7:
                    tb.Text = tai.Phone;
                    break;
                }
                tb.TextChanged += ChangeContentCallback;
            }
        }
예제 #3
0
 /// <summary>
 /// Fill dictionary with lists of Classes
 /// </summary>
 /// <param name="classData">String that represent table from Word document</param>
 private void fillDictionary(string teacher)
 {
     string[] teacherInfo = teacher.Split(new string[] { "\r\a" }, StringSplitOptions.None);
     if (teacherInfo.Length > 2)
     {
         Teacher teach = new Teacher();
         teach.FullName = teacherInfo[1];
         TeacherAddInfo tm = new TeacherAddInfo()
         {
             Birthday   = teacherInfo[2],
             Address    = teacherInfo[3],
             Passport   = teacherInfo[4],
             SNILS      = teacherInfo[5],
             INN        = teacherInfo[6],
             Account    = teacherInfo[7],
             BankAccont = teacherInfo[8],
             Phone      = teacherInfo[9]
         };
         teach.AddInfo = tm;
         teachersList.Add(teach);
     }
 }