예제 #1
0
        private void btnaddTask_Click(object sender, EventArgs e)
        {
            txtEmail.Focus();
            txtPass.Focus();
            txtEmail.Focus();
            if (!VisaTask.IsValidEmailAddress(txtEmail.Text))
            {
                return;
            }

            if (!VisaTask.IsValidPassword(txtPass.Text))
            {
                return;
            }

            VisaTask task = new VisaTask()
            {
                ArrivalDt       = dtArrivalDate.Text,
                Receipt         = txtBillNum.Text,
                Category        = cbxCategory.SelectedItem.ToString(),
                CategoryCode    = Const.CategoryCodeByCat(cbxCategory.SelectedItem.ToString()),
                City            = cbxCity.SelectedItem.ToString(),
                CityCode        = Const.CityCodeByCity(cbxCity.SelectedItem.ToString()),
                CountAdult      = (int)numCountA.Value,
                CountChild      = (int)numCountC.Value,
                Dob             = dtDob.Text,
                Email           = txtEmail.Text,
                LastName        = txtLastName.Text,
                Name            = txtName.Text,
                Nationality     = cbxNation.SelectedItem.ToString(),
                PassportEndDate = dtEndPass.Text,
                Password        = txtPass.Text,
                Purpose         = cbxPurpose.SelectedItem.ToString(),
                PurposeCode     = Const.PurposeCodeByPurpose(cbxPurpose.SelectedItem.ToString()),
                Status          = cbxStatus.SelectedItem.ToString(),
                StatusCode      = Const.StatusCodeByStatus(cbxStatus.SelectedItem.ToString()),
                RedLine         = dtRedLine.Text,
                GreenLine       = dtGreenLine.Text,
                Priority        = cbxPriority.SelectedIndex
            };

            Logger.Info("Задание добавленно " + task.GetInfo());
            _visaTasks.Add(task);
            VisaTask.Save(_visaTasks, VisaEntityType.New);
            dataGridView1.Refresh();
            SendMessage(task, Actions.Create);

            _engine.RefreshViewTabs();

            txtPass.Text = txtName.Text = txtBillNum.Text = txtEmail.Text = txtLastName.Text = txtName.Text = string.Empty;
        }