예제 #1
0
        private void CheckExist(object sender, EventArgs e)
        {
            Show_button.Enabled = false;

            uint PodrID;
            uint OTypeID;
            int  DayFrom, DayTo;

            if (OType_combo.SelectedIndex > -1)
            {
                OTypeID = G.OType.Rows.GetID(OType_combo.SelectedIndex);

                if (Podr_combo.SelectedIndex == 0)
                {
                    PodrID = 0;
                }
                else
                {
                    PodrID = G.Podr.Rows.GetID(Podr_combo.SelectedIndex - 1);
                }

                DayFrom = ATMisc.GetYMDFromDateTime(From_Picker.Value.AddDays(-1));
                DayTo   = ATMisc.GetYMDFromDateTime(To_Picker.Value.AddMonths(1));

                var CheckSM = G.SM.QUERRY()
                              .EXIST
                              .WHERE
                              .AC(C.SM.Amount).More.BV <double>(0)
                              .AND.ARC(C.SM.Sample, C.Sample.Number).More.BV <int>(0)
                              .AND.ARC(C.SM.Sample, C.Sample.CYMD).More.BV(DayFrom)
                              .AND.ARC(C.SM.Sample, C.Sample.CYMD).Less.BV(DayTo)
                              .AND.ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.YMDS).Less.BV(DayTo)
                              .AND.OB()
                              .ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.YMDE).More.BV(DayFrom)
                              .OR.ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.YMDE).EQUI.BV(0)
                              .CB()
                              .AND.ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.Object, C.Object.OLocationFrom, C.OLocation.Volumed).EQUI.BV <bool>(true)
                              .AND.ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.Object, C.Object.OType).EQUI.BV(OTypeID);

                if (PodrID > 0)
                {
                    CheckSM.AND.ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.Podr).EQUI.BV(PodrID);
                }
                else
                {
                    CheckSM.AND.ARC(C.SM.Sample, C.Sample.SPoint, C.SPoint.Podr).More.BV <uint>(0);
                }

                if ((bool)CheckSM.DO()[0].Value)
                {
                    Existence_label.Text = "Концентрации обнаружены";
                    Show_button.Enabled  = true;
                }
                else
                {
                    Existence_label.Text = "Концентрации НЕ обнаружены";
                    Show_button.Enabled  = false;
                }
            }
            else
            {
                Existence_label.Text = "Заполните поля";
            }
        }