Esempio n. 1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AGridDataView"></param>
        /// <param name="APreselectedSiteKey"></param>
        /// <param name="ARowNumber"></param>
        /// <param name="ASiteKey"></param>
        public void DetermineInitiallySelectedSite(DataView AGridDataView, Int64 APreselectedSiteKey, out Int32 ARowNumber, out Int64 ASiteKey)
        {
            System.Int16 CurrentRow;

            if ((APreselectedSiteKey == 0) || (APreselectedSiteKey == -1))
            {
                ASiteKey = TSystemDefaults.GetSiteKeyDefault();
            }
            else
            {
                ASiteKey = APreselectedSiteKey;
            }

            FSiteKey   = ASiteKey;
            ARowNumber = 0;

            for (CurrentRow = 0; CurrentRow <= AGridDataView.Count - 1; CurrentRow += 1)
            {
                ARowNumber = ARowNumber + 1;

                if (Convert.ToInt64(AGridDataView[CurrentRow].Row[PPartnerLedgerTable.GetPartnerKeyDBName()]) == ASiteKey)
                {
                    break;
                }
            }
        }
 private void NewRowManual(ref PmStaffDataRow ARow)
 {
     ARow.Key            = Convert.ToInt32(TRemote.MCommon.WebConnectors.GetNextSequence(TSequenceNames.seq_staff_data));
     ARow.PartnerKey     = FMainDS.PPerson[0].PartnerKey;
     ARow.ReceivingField = 0;
     ARow.SetReceivingFieldOfficeNull();
     ARow.OfficeRecruitedBy = TSystemDefaults.GetSiteKeyDefault();
     ARow.HomeOffice        = TSystemDefaults.GetSiteKeyDefault();
     ARow.StartOfCommitment = DateTime.Now.Date;
 }
        private void RunOnceOnActivationManual()
        {
            // AlanP March 2013:  Use a try/catch block because nUnit testing on this screen does not support Drag/Drop in multi-threaded model
            // It is easier to do this than to configure all the different test execution methods to use STA
            try
            {
                trvUnits.AllowDrop = true;
                trvUnits.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(treeView_ItemDrag);
                trvUnits.DragOver += new System.Windows.Forms.DragEventHandler(treeView_DragOver);
                trvUnits.DragDrop += new System.Windows.Forms.DragEventHandler(treeView_DragDrop);
            }
            catch (InvalidOperationException)
            {
                // ex.Message is: DragDrop registration did not succeed.
                // Inner exception is: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made.
            }

            trvUnits.Click           += new EventHandler(UnitsClick);
            trvUnits.ShowNodeToolTips = true;
            trvUnits.MouseWheel      += new MouseEventHandler(treeView_MouseWheel);
            trvUnits.Focus();

            txtChild.TextChanged  += new EventHandler(EvaluateParentChange);
            txtParent.TextChanged += new EventHandler(EvaluateParentChange);

            FPetraUtilsObject.UnhookControl(pnlDetails, true); // I don't want changes in these values to cause SetChangedFlag.
            FPetraUtilsObject.UnhookControl(txtStatus, false);

            ArrayList UnitNodes = TRemote.MPersonnel.WebConnectors.GetUnitHeirarchy();
            //
            // The list of nodes returned by the above call are ordered to the extent that:
            //  * The root node appears first,
            //  * a parent appears before its child.
            UnitHierarchyNode RootData = (UnitHierarchyNode)UnitNodes[0];
            TreeNode          RootNode = new TreeNode(RootData.Description);

            RootNode.Tag         = RootData;
            RootNode.ToolTipText = RootData.TypeCode;
            UnitNodes.RemoveAt(0);
            trvUnits.Nodes.Add(RootNode);
            AddChildren(RootNode, UnitNodes);
            Int64 MySiteKey = TSystemDefaults.GetSiteKeyDefault();

            ShowThisUnit(MySiteKey);
        }
        /// <summary>
        /// add a new short term application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewRowShortTermApp(System.Object sender, EventArgs e)
        {
            // Clear any validation errors so that the following call to ValidateAllData starts with a 'clean slate'.
            FPetraUtilsObject.VerificationResultCollection.Clear();

            if (ValidateAllData(true, TErrorProcessingMode.Epm_IgnoreNonCritical))
            {
                // we create the table locally, no dataset
                IndividualDataTDSPmGeneralApplicationRow NewRowGeneralApp = FMainDS.PmGeneralApplication.NewRowTyped(true);
                PmShortTermApplicationRow NewRowShortTermApp = FMainDS.PmShortTermApplication.NewRowTyped(true);

                NewRowGeneralApp.PartnerKey                 = FMainDS.PPerson[0].PartnerKey;
                NewRowGeneralApp.ApplicationKey             = GetNextApplicationKey();
                NewRowGeneralApp.RegistrationOffice         = TSystemDefaults.GetSiteKeyDefault();
                NewRowGeneralApp.GenAppDate                 = DateTime.Today;
                NewRowGeneralApp.ApplicationForEventOrField = Catalog.GetString("Event");

                //TODO temp, needs to be changed
                NewRowGeneralApp.AppTypeName = "CONFERENCE";
                NewRowGeneralApp.OldLink     =
                    TSystemDefaults.GetSiteKeyDefault().ToString() + ";" + NewRowGeneralApp.ApplicationKey.ToString();
                NewRowGeneralApp.GenApplicantType = "Participant";

                NewRowShortTermApp.PartnerKey         = NewRowGeneralApp.PartnerKey;
                NewRowShortTermApp.ApplicationKey     = NewRowGeneralApp.ApplicationKey;
                NewRowShortTermApp.RegistrationOffice = NewRowGeneralApp.RegistrationOffice;
                NewRowShortTermApp.StAppDate          = NewRowGeneralApp.GenAppDate;

                //TODO temp, needs to be changed
                NewRowShortTermApp.StApplicationType = "A";
                NewRowShortTermApp.StBasicOutreachId = NewRowGeneralApp.OldLink;

                FMainDS.PmGeneralApplication.Rows.Add(NewRowGeneralApp);
                FMainDS.PmShortTermApplication.Rows.Add(NewRowShortTermApp);

                FPetraUtilsObject.SetChangedFlag();

                grdDetails.DataSource = null;
                grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.PmGeneralApplication.DefaultView);

                SelectDetailRowByDataTableIndex(FMainDS.PmGeneralApplication.Rows.Count - 1);
            }
        }
Esempio n. 5
0
        private static void CreateShortTermApplication(XmlNode ANode,
                                                       Int64 APartnerKey,
                                                       ref PartnerImportExportTDS AMainDS,
                                                       TDBTransaction ATransaction)
        {
            String strEventKey = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_EVENTKEY);
            long   EventKey    = -1;

            if (strEventKey.Length > 0)
            {
                try
                {
                    EventKey = long.Parse(strEventKey);
                }
                catch (System.FormatException)
                {
                    AddVerificationResult("Bad number format in EventKey: " + strEventKey);
                }

                if (!PUnitAccess.Exists(EventKey, ATransaction))
                {
                    AddVerificationResult("EventKey not known - application cannot be imported: " + EventKey);
                    return;
                }

                PmGeneralApplicationRow GenAppRow = AMainDS.PmGeneralApplication.NewRowTyped();

                GenAppRow.PartnerKey     = APartnerKey;
                GenAppRow.ApplicationKey = (int)DBAccess.GDBAccessObj.GetNextSequenceValue("seq_application", ATransaction);

                GenAppRow.OldLink =
                    TSystemDefaults.GetSiteKeyDefault() + ";" + GenAppRow.ApplicationKey.ToString();
                GenAppRow.RegistrationOffice = DomainManager.GSiteKey; // When this is imported, RegistrationOffice can't be null.

                GenAppRow.GenAppDate           = DateTime.Now;
                GenAppRow.AppTypeName          = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_APPTYPE);
                GenAppRow.GenApplicationStatus = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_APPSTATUS);
                GenAppRow.Comment = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_APPCOMMENTS);

                PmShortTermApplicationRow ShortTermRow = AMainDS.PmShortTermApplication.NewRowTyped();
                ShortTermRow.PartnerKey         = APartnerKey;
                ShortTermRow.ApplicationKey     = GenAppRow.ApplicationKey;
                ShortTermRow.RegistrationOffice = GenAppRow.RegistrationOffice; // When this is imported, RegistrationOffice can't be null.
                ShortTermRow.StBasicOutreachId  = "Unused field";               // This field is scheduled for deletion, but NOT NULL now.
                ShortTermRow.StAppDate          = DateTime.Now;
                ShortTermRow.StApplicationType  = GenAppRow.AppTypeName;
                ShortTermRow.StConfirmedOption  = EventKey;
                String TimeString = "";

                try
                {
                    TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ARRIVALDATE);

                    if (TimeString.Length > 0)
                    {
                        ShortTermRow.Arrival = DateTime.Parse(TimeString);
                    }

                    TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_DEPARTUREDATE);

                    if (TimeString.Length > 0)
                    {
                        ShortTermRow.Departure = DateTime.Parse(TimeString);
                    }
                }
                catch (System.FormatException)
                {
                    AddVerificationResult("Bad date format in Application: " + TimeString);
                }

                DateTime TempTime;

                TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_ARRIVALTIME);

                if (TimeString.Length > 0)
                {
                    try
                    {
                        TempTime = DateTime.Parse(TimeString);
                        ShortTermRow.ArrivalHour   = TempTime.Hour;
                        ShortTermRow.ArrivalMinute = TempTime.Minute;
                    }
                    catch (System.FormatException)
                    {
                        AddVerificationResult("Bad time format in Application: " + TimeString);
                    }
                }

                TimeString = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_DEPARTURETIME);

                if (TimeString.Length > 0)
                {
                    try
                    {
                        TempTime = DateTime.Parse(TimeString);
                        ShortTermRow.DepartureHour   = TempTime.Hour;
                        ShortTermRow.DepartureMinute = TempTime.Minute;
                    }
                    catch (System.FormatException)
                    {
                        AddVerificationResult("Bad time format in Application: " + TimeString);
                    }
                }

                ShortTermRow.OutreachRole = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_EVENTROLE);
                String ChargedField = TXMLParser.GetAttribute(ANode, MPartnerConstants.PARTNERIMPORT_CHARGEDFIELD);

                if (ChargedField.Length > 0)
                {
                    try
                    {
                        ShortTermRow.StFieldCharged = long.Parse(ChargedField);
                    }
                    catch
                    {
                        AddVerificationResult("Bad number format in ChargedField: " + ChargedField);
                    }
                }

                AMainDS.PmGeneralApplication.Rows.Add(GenAppRow);
                AMainDS.PmShortTermApplication.Rows.Add(ShortTermRow);
                AddVerificationResult("Application Record Created.", TResultSeverity.Resv_Status);
            }
        }