Example #1
0
 private void Show_button_Click(object sender, EventArgs e)
 {
     if (period == Misc.Podrs_class.PeriodType.None)
     {
         MessageBox.Show(this, "Не указан тип периода", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         if (OType_combo.SelectedIndex > -1)
         {
             if (Podr_combo.SelectedIndex == 0)
             {
                 Misc.OtchMassOutgo(0, ATMisc.GetYMFromDateTime(From_Picker.Value), period, G.OType.Rows.GetID(OType_combo.SelectedIndex), true, CreateNew_check.Checked);
             }
             else
             {
                 Misc.OtchMassOutgo(G.Podr.Rows.GetID(Podr_combo.SelectedIndex - 1), ATMisc.GetYMFromDateTime(From_Picker.Value), period, G.OType.Rows.GetID(OType_combo.SelectedIndex), true, CreateNew_check.Checked);
             }
         }
         else
         {
             MessageBox.Show(this, "Не указан тип воды", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Example #2
0
        void SelectCurrentSPool()
        {
            Period_combo.Items.Clear();

            int YMTo;

            _synchPoolManager.GetDiapPeriods(out YMStart, out YMTo);

            for (int i = YMStart; i <= YMTo; i++)
            {
                var DT = ATMisc.GetDateTimeFromYM(i);
                Period_combo.Items.Add(ATMisc.GetMonthName1(DT.Month) + ' ' + DT.Year.ToString());
            }

            int YM = ATMisc.GetYMFromDateTime(T.SPool.Rows.Get <DateTime>(_synchPoolManager.LastPoolID, C.SPool.Date));

            if (Period_combo.SelectedIndex == YM - YMStart)
            {
                Period_combo_SelectedIndexChanged(null, null);
            }
            else
            {
                Period_combo.SelectedIndex = YM - YMStart;
            }
        }
Example #3
0
        public void GetDiapPeriods(out int YMFrom, out int YMTo)
        {
            var DTMax = (DateTime)_sPool.QUERRY().GET.C(C.SPool.Date).Max(C.SPool.Date).By().DO()[0].Value;
            var DTMin = (DateTime)_sPool.QUERRY().GET.C(C.SPool.Date).Min(C.SPool.Date).By().DO()[0].Value;

            YMFrom = ATMisc.GetYMFromDateTime(DTMin);
            YMTo   = ATMisc.GetYMFromDateTime(DTMax);
        }
Example #4
0
        private void Protoks_Grid_CellValuePushed(object sender, DataGridViewCellValueEventArgs e)
        {
            switch (e.ColumnIndex)
            {
            case Columns.DateCr:
                if (e.Value != null)
                {
                    DateTime DateCr;

                    if (DateTime.TryParse((string)e.Value, out DateCr))
                    {
                        Protokols[e.RowIndex].YM  = ATMisc.GetYMFromDateTime(DateCr);
                        Protokols[e.RowIndex].Day = DateCr.Day;
                    }
                }
                break;

            case Columns.Act:
                if (e.Value != null)
                {
                    int ActNumber;

                    if (int.TryParse((string)e.Value, out ActNumber))
                    {
                        Protokols[e.RowIndex].Act = ActNumber;
                    }
                }
                break;

            case Columns.Time:
                if (e.Value != null)
                {
                    var value = ((string)e.Value).Replace('-', ':');

                    Protokols[e.RowIndex].StrTime = value;
                }
                break;

            case Columns.Number:
                if (IsInPeriod && AllowGeneration)
                {
                    if (e.Value != null)
                    {
                        int Number;

                        if (int.TryParse((string)e.Value, out Number))
                        {
                            if (Number == 0)
                            {
                                MessageBox.Show(this, "Номер протокола должен быть больше нуля.", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            else
                            {
                                Protokols[e.RowIndex].Number = Number;
                            }
                        }
                    }
                }
                break;
            }
        }