예제 #1
0
        private void SetDateRangeForAllConferences(SelectConferenceTDS ASelectedConferences)
        {
            DateTime EarliestDate = DateTime.MaxValue;
            DateTime LatestDate   = DateTime.MinValue;

            foreach (PcConferenceRow Row in ASelectedConferences.PcConference.Rows)
            {
                if (Row.Start.Value.CompareTo(EarliestDate) < 0)
                {
                    EarliestDate = Row.Start.Value;
                }

                if (Row.End.Value.CompareTo(LatestDate) > 0)
                {
                    LatestDate = Row.End.Value;
                }
            }

            dtpStartDate.Date = EarliestDate;

            dtpEndDate.Date = LatestDate;
        }
예제 #2
0
        private void SetDateRange()
        {
            SelectConferenceTDS SelectedConferences = TRemote.MConference.WebConnectors.GetConferences("", "");

            if (ucoConferenceSelection.AllConferenceSelected)
            {
                SetDateRangeForAllConferences(SelectedConferences);
            }
            else if (ucoConferenceSelection.OneConferenceSelected)
            {
                foreach (PcConferenceRow Row in SelectedConferences.PcConference.Rows)
                {
                    String PartnerKey = Row.ConferenceKey.ToString();
                    int    Diff       = 10 - PartnerKey.Length;

                    if (Diff > 0)
                    {
                        PartnerKey = new String('0', Diff) + PartnerKey;
                    }

                    if (PartnerKey == ucoConferenceSelection.ConferenceKey)
                    {
                        if (!Row.IsStartNull())
                        {
                            dtpStartDate.Date = Row.Start.Value;
                        }

                        if (!Row.IsEndNull())
                        {
                            dtpEndDate.Date = Row.End.Value;
                        }

                        break;
                    }
                }
            }
        }
예제 #3
0
        public static SelectConferenceTDS GetConferences(String AConferenceName, String APrefix)
        {
            SelectConferenceTDS ResultTable = new SelectConferenceTDS();

            PcConferenceTable ConferenceTable = new PcConferenceTable();
            PcConferenceRow TemplateRow = (PcConferenceRow)ConferenceTable.NewRow();

            TDBTransaction ReadTransaction;
            Boolean NewTransaction = false;

            if (APrefix == "*")
            {
                APrefix = "";
            }

            if (AConferenceName == "*")
            {
                AConferenceName = "";
            }
            else if (AConferenceName.EndsWith("*"))
            {
                AConferenceName = AConferenceName.Substring(0, AConferenceName.Length - 1);
            }

            TLogging.LogAtLevel(9, "TConferenceOptions.GetConferences called!");

            ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead,
                TEnforceIsolationLevel.eilMinimum,
                out NewTransaction);

            try
            {
                /* Load data */

                if (APrefix.Length > 0)
                {
                    APrefix = APrefix.Replace('*', '%') + "%";
                    TemplateRow.OutreachPrefix = APrefix;

                    StringCollection Operators = new StringCollection();
                    Operators.Add("LIKE");

                    ConferenceTable = PcConferenceAccess.LoadUsingTemplate(TemplateRow, Operators, null, ReadTransaction);
                }
                else
                {
                    ConferenceTable = PcConferenceAccess.LoadAll(ReadTransaction);
                }
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TConferenceOptions.GetConferences: committed own transaction.");
                }
            }

            String ShortName;
            TPartnerClass PartnerClass;

            foreach (PcConferenceRow ConferenceRow in ConferenceTable.Rows)
            {
                TPartnerServerLookups.GetPartnerShortName(ConferenceRow.ConferenceKey, out ShortName, out PartnerClass);

                if ((AConferenceName.Length > 0)
                    && (!ShortName.StartsWith(AConferenceName, true, null)))
                {
                    continue;
                }

                ResultTable.PcConference.ImportRow(ConferenceRow);

                DataRow NewRow = ResultTable.PPartner.NewRow();
                NewRow[PPartnerTable.GetPartnerShortNameDBName()] = ShortName;
                NewRow[PPartnerTable.GetPartnerKeyDBName()] = ConferenceRow.ConferenceKey;

                ResultTable.PPartner.Rows.Add(NewRow);
            }

            return ResultTable;
        }
예제 #4
0
        public static SelectConferenceTDS GetConferences(String AConferenceName, String APrefix)
        {
            SelectConferenceTDS ResultTable = new SelectConferenceTDS();

            PcConferenceTable ConferenceTable = new PcConferenceTable();
            PcConferenceRow   TemplateRow     = (PcConferenceRow)ConferenceTable.NewRow();

            TDBTransaction ReadTransaction;
            Boolean        NewTransaction = false;

            if (APrefix == "*")
            {
                APrefix = "";
            }

            if (AConferenceName == "*")
            {
                AConferenceName = "";
            }
            else if (AConferenceName.EndsWith("*"))
            {
                AConferenceName = AConferenceName.Substring(0, AConferenceName.Length - 1);
            }

            TLogging.LogAtLevel(9, "TConferenceOptions.GetConferences called!");

            TDataBase db = DBAccess.Connect("GetConferences");

            ReadTransaction = db.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead,
                                                             out NewTransaction);

            try
            {
                /* Load data */

                if (APrefix.Length > 0)
                {
                    APrefix = APrefix.Replace('*', '%') + "%";
                    TemplateRow.OutreachPrefix = APrefix;

                    StringCollection Operators = new StringCollection();
                    Operators.Add("LIKE");

                    ConferenceTable = PcConferenceAccess.LoadUsingTemplate(TemplateRow, Operators, null, ReadTransaction);
                }
                else
                {
                    ConferenceTable = PcConferenceAccess.LoadAll(ReadTransaction);
                }
            }
            finally
            {
                if (NewTransaction)
                {
                    ReadTransaction.Commit();
                    TLogging.LogAtLevel(7, "TConferenceOptions.GetConferences: committed own transaction.");
                }
            }

            String        ShortName;
            TPartnerClass PartnerClass;

            foreach (PcConferenceRow ConferenceRow in ConferenceTable.Rows)
            {
                TPartnerServerLookups.GetPartnerShortName(ConferenceRow.ConferenceKey, out ShortName, out PartnerClass);

                if ((AConferenceName.Length > 0) &&
                    (!ShortName.StartsWith(AConferenceName, true, null)))
                {
                    continue;
                }

                ResultTable.PcConference.ImportRow(ConferenceRow);

                DataRow NewRow = ResultTable.PPartner.NewRow();
                NewRow[PPartnerTable.GetPartnerShortNameDBName()] = ShortName;
                NewRow[PPartnerTable.GetPartnerKeyDBName()]       = ConferenceRow.ConferenceKey;

                ResultTable.PPartner.Rows.Add(NewRow);
            }

            return(ResultTable);
        }
        private void SetDateRangeForAllConferences(SelectConferenceTDS ASelectedConferences)
        {
            DateTime EarliestDate = DateTime.MaxValue;
            DateTime LatestDate = DateTime.MinValue;

            foreach (PcConferenceRow Row in ASelectedConferences.PcConference.Rows)
            {
                if (Row.Start.Value.CompareTo(EarliestDate) < 0)
                {
                    EarliestDate = Row.Start.Value;
                }

                if (Row.End.Value.CompareTo(LatestDate) > 0)
                {
                    LatestDate = Row.End.Value;
                }
            }

            dtpStartDate.Date = EarliestDate;

            dtpEndDate.Date = LatestDate;
        }