Exemplo n.º 1
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == dataGridView1.Columns["deleteColumn"].Index)
     {
         VisaTask vt = dataGridView1.Rows[e.RowIndex].DataBoundItem as VisaTask;
         Logger.Warning("Удаляю задание " + vt.GetInfo());
         _engine.DeleteTask(vt);
         dataGridView1.Rows.RemoveAt(e.RowIndex);
         DeleteTask(vt);
         SendMessage(vt, Actions.Delete);
     }
     if (e.ColumnIndex == dataGridView1.Columns["duplColumn"].Index)
     {
         var currItem = (VisaTask)dataGridView1.CurrentRow.DataBoundItem;
         using (DuplForm form = new DuplForm())
         {
             form.FillCombo(Const.GetListFromDict(Const.SettingsCities));
             if (form.ShowDialog(this) == DialogResult.OK)
             {
                 VisaTask vt = currItem.Clone();
                 vt.City     = form.GetSelectedCity();
                 vt.CityCode = Const.CityCodeByCity(vt.City);
                 _visaTasks.Add(vt);
                 VisaTask.Save(_visaTasks, VisaEntityType.New);
                 _engine.RefreshViewTabs();
                 SendMessage(vt, Actions.Create);
             }
         }
     }
 }
Exemplo n.º 2
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell == null)
            {
                return;
            }
            if (e.ColumnIndex == dataGridView1.Columns["City"].Index)
            {
                var currItem = (VisaTask)dataGridView1.CurrentRow.DataBoundItem;
                var prevItem = currItem.Clone();
                prevItem.City = _cityBefore.Substring(_cityBefore.IndexOf(")") + 1);
                SendMessage(prevItem, Actions.Delete);
                currItem.CityCode = Const.CityCodeByCity(dataGridView1.CurrentCell.Value.ToString());
                SendMessage(currItem, Actions.Create);

                Logger.Info(string.Format("Город изменен с {0} на {1}", _cityBefore, currItem.City));
                TabPage tp1 = null;
                TabPage tp2 = null;
                foreach (TabPage tab in tabControl1.TabPages)
                {
                    string tabtextClear = tab.Text;
                    if (tab.Text.IndexOf("~") != -1)
                    {
                        tabtextClear = tab.Text.Remove(tab.Text.IndexOf("~"));
                    }

                    if (_cityBefore.Equals(tabtextClear))
                    {
                        tp1 = tab;
                    }
                    else if (currItem.CityV.Equals(tabtextClear))
                    {
                        tp2 = tab;
                    }
                }

                if (tp1 != null)
                {
                    tabControl1.TabPages.Remove(tp1);
                    _engine.DeleteCityKey(_cityBefore);
                }
                if (tp2 != null)
                {
                    tabControl1.TabPages.Remove(tp2);
                    _engine.DeleteCityKey(currItem.CityV);
                }
                _cityBefore = string.Empty;
                _engine.RefreshViewTabs();
                VisaTask.Save(_visaTasks, VisaEntityType.New);
            }
            else if (e.ColumnIndex == dataGridView1.Columns["priorityComboBoxColumn"].Index)
            {
                VisaTask.Save(_visaTasks, VisaEntityType.New);
            }
        }
Exemplo n.º 3
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;
        }