private void OnRecalculateScreenParts(TRecalculateScreenPartsEventArgs e)
 {
     if (RecalculateScreenParts != null)
     {
         RecalculateScreenParts(this, e);
     }
 }
예제 #2
0
 private void RecalculateTabHeaderCounters(System.Object sender, TRecalculateScreenPartsEventArgs e)
 {
     // MessageBox.Show('TUC_PartnerEdit_PartnerTabSet2.RecalculateTabHeaderCounters');
     if (e.ScreenPart == TScreenPartEnum.spCounters)
     {
         CalculateTabHeaderCounters(sender);
     }
 }
 private void DoRecalculateScreenParts(System.Object sender, TRecalculateScreenPartsEventArgs e)
 {
     // trigger event so outer controls can react
     if (RecalculateScreenParts != null)
     {
         RecalculateScreenParts(sender, e);
     }
 }
예제 #4
0
        private void TxtPartnerComment_Validated(System.Object sender, System.EventArgs e)
        {
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;

            RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
            RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
            OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);
        }
예제 #5
0
        /// <summary>
        /// todoComment
        /// </summary>
        public void FireRecalculateScreenPartsEventArgs()
        {
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;

            RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
            RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
            OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);
        }
예제 #6
0
        /// <summary>
        /// Loads FamilyMembers Data from Petra Server into FMainDS.
        ///
        /// </summary>
        /// <returns>true if successful and Family has Family Members, otherwise false.
        /// //DevAge.ComponentModel.Validator;</returns>
        public Boolean LoadDataOnDemand()
        {
            Boolean ReturnValue;
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;
            Int64 FamilyPartnerKey;

            if (FMainDS.PPartner[0].PartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY))
            {
                FamilyPartnerKey = FMainDS.PFamily[0].PartnerKey;
            }
            else
            {
                FamilyPartnerKey = FMainDS.PPerson[0].FamilyKey;
            }

            // retrieve Family Members from PetraServer
            // If family has no members, returns false
            try
            {
                // Make sure that Typed DataTable is already there at Client side
                if (FMainDS.FamilyMembers == null)
                {
                    FMainDS.Tables.Add(new PartnerEditTDSFamilyMembersTable(PartnerEditTDSFamilyMembersTable.GetTableName()));
                    FMainDS.InitVars();
                }

                FMainDS.FamilyMembers.Rows.Clear();
                FMainDS.Merge(FPartnerEditUIConnector.GetDataFamilyMembers(FamilyPartnerKey, ""));
                FMainDS.FamilyMembers.AcceptChanges();

                if (FMainDS.FamilyMembers.Rows.Count > 0)
                {
                    ReturnValue = true;
                }
                else
                {
                    ReturnValue = false;
                }
            }
            catch (System.NullReferenceException)
            {
                ReturnValue = false;
                return(false);
            }
            catch (Exception)
            {
                ReturnValue = false;

                // raise;
            }

            // Fire OnRecalculateScreenParts event
            RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
            RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
            OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);
            FDataGrid.Selection.Focus(new Position(1, 1), true);
            return(ReturnValue);
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private void RecalculateTabHeaderCounter()
        {
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;

            /* Fire OnRecalculateScreenParts event to update the Tab Counters */
            RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
            RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
            OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);
        }
예제 #8
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AGrid"></param>
        /// <param name="tmpDT"></param>
        /// <param name="IsNew"></param>
        public void RefreshDataGrid(ref TSgrdDataGrid AGrid, DataTable tmpDT, Boolean IsNew)
        {
            DataRow             TheNewRow;
            PPartnerInterestRow tmpPartnerInterestRow;
            PInterestRow        tmpInterestRow = null; // todo: this needs to be assigned? says Timo while converting from delphi
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;
            Int32            counter;
            StringCollection ACollection = new StringCollection();
            StringCollection SortedCollection;

            // AInterestRow : PInterestRow;
            MessageBox.Show("TmpDT count:" + tmpDT.Rows.Count.ToString());
            tmpPartnerInterestRow =
                ((PPartnerInterestRow)FMultiTableDS.PPartnerInterest.Rows.Find(new Object[] { FMultiTableDS.PPartner[0].PartnerKey, FInterestNumber }));

            // tmpPartnerInterestRow := tmpDT.rows[tmpDT.rows.count1] as PPartnerInterestRow;
            // tmpInterestRow := tmpDT.rows[tmpDT.rows.count1] as PInterestRow;
            // MessageBox.Show('Refreshgrid: '+tmpPartnerInterestRow.Interest);
            // AInterestRow := (FMultiTableDS.PInterest.Rows.Find(new Object[]{[tmpPartnerInterestRow.Interest]}) as PinterestRow);
            FPartnerInterestsGridTable = new DataTable();
            TheNewRow = FPartnerInterestsGridTable.NewRow();

            // TheNewRow['Category'] := AInterestROw.Category as System.Object;
            // TheNewRow['Category'] := 'DOG';
            TheNewRow["Interest"] = (System.Object)tmpPartnerInterestRow.Interest;
            TheNewRow["Country"]  = (System.Object)tmpPartnerInterestRow.Country;
            TheNewRow["Field"]    = (System.Object)tmpPartnerInterestRow.FieldKey;
            TheNewRow["Level"]    = (System.Object)tmpPartnerInterestRow.Level;
            TheNewRow["Comment"]  = (System.Object)tmpPartnerInterestRow.Comment;
            FPartnerInterestsGridTable.Rows.Add(TheNewRow);
            AGrid.DataSource = new DevAge.ComponentModel.BoundDataView(FPartnerInterestsGridTable.DefaultView);
            counter          = 0;

            foreach (DataRow tmpRow in FPartnerInterestsGridTable.Rows)
            {
                ACollection.Add(tmpRow[PInterestTable.GetCategoryDBName()].ToString());
            }

            SortedCollection = StringHelper.StrSort(ACollection);

            foreach (String AInterestString in SortedCollection)
            {
                counter = counter + 1;

                if (AInterestString == tmpInterestRow.Interest.ToString())
                {
                    break;
                }
            }

            RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
            RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
            OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);
            AGrid.Selection.Focus(new Position(1, 1), true);
            AGrid.Selection.ResetSelection(false);
            AGrid.Selection.SelectRow(counter, true);
        }
예제 #9
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="AChangingPartnerTypeRow"></param>
        /// <param name="AIsRemoval"></param>
        /// <returns></returns>
        public Boolean PerformPartnerTypeAddOrRemoval(DataRow AChangingPartnerTypeRow, out Boolean AIsRemoval)
        {
            const String TYPECODE_COSTCENTRE = "COSTCENTRE";

            Boolean ReturnValue = false;

            AIsRemoval = false;
            String            TypeCode;
            DataRow           ExistingMatchingDataRow;
            PPartnerTypeTable PartnerTypeTable;
            PPartnerTypeRow   TheNewRow;
            PTypeRow          CheckTypeRow;

            DataRowView[] CheckTypeRows;
            DialogResult  CheckTypeRowsAnswer;
            TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs;
            String CostCentreLink;

            PartnerTypeTable = FMainDS.PPartnerType;

            try
            {
                TypeCode = AChangingPartnerTypeRow["TypeCode"].ToString();

                ExistingMatchingDataRow = PartnerTypeTable.Rows.Find(new Object[] { ((PPartnerRow)FMainDS.PPartner.Rows[0]).PartnerKey, TypeCode });

                if (ExistingMatchingDataRow == null)
                {
                    /*
                     * Add Special Type
                     */

                    // Check security permission
                    if (!UserInfo.GUserInfo.IsTableAccessOK(TTableAccessPermission.tapCREATE, PPartnerTypeTable.GetTableDBName()))
                    {
                        TMessages.MsgSecurityException(new ESecurityDBTableAccessDeniedException("", "create",
                                                                                                 PPartnerTypeTable.GetTableDBName()), this.GetType());

                        AChangingPartnerTypeRow.CancelEdit();   // reset to unchecked
                        return(false);
                    }

                    // Check: is this Partner Type assignable?

//                  MessageBox.Show("Perform check: is PartnerType assignable?  TypeCode: " + TypeCode);
                    CheckTypeRows = FDataCache_PartnerTypeListDV.FindRows(TypeCode);

                    if (CheckTypeRows.Length > 0)
                    {
                        CheckTypeRow = (PTypeRow)CheckTypeRows[0].Row;

                        if (!CheckTypeRow.ValidType)
                        {
                            /*CheckTypeRowsAnswer = TMessages.MsgQuestion(
                             *  ErrorCodes.GetErrorInfo(PetraErrorCodes.ERR_VALUEUNASSIGNABLE, TypeCode),
                             *  this.GetType(), false);*/

                            CheckTypeRowsAnswer = MessageBox.Show(
                                string.Format(StrTheCodeIsNoLongerActive, TypeCode),
                                Catalog.GetString("Invalid Data Entered"),
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button2);

                            if (CheckTypeRowsAnswer == DialogResult.No)
                            {
                                // reset to unchecked
                                AChangingPartnerTypeRow.CancelEdit();
                                return(false);
                            }
                        }
                    }

                    // add new row to PartnerType table
                    PartnerTypeTable      = FMainDS.PPartnerType;
                    TheNewRow             = PartnerTypeTable.NewRowTyped();
                    TheNewRow.PartnerKey  = FMainDS.PPartner[0].PartnerKey;
                    TheNewRow.TypeCode    = TypeCode;
                    TheNewRow.CreatedBy   = UserInfo.GUserInfo.UserID;
                    TheNewRow.DateCreated = DateTime.Now.Date;
                    PartnerTypeTable.Rows.Add(TheNewRow);

                    // Fire OnRecalculateScreenParts event
                    RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
                    RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
                    OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);

                    ReturnValue = true;
                    AIsRemoval  = false;
                }
                else
                {
                    /*
                     * Remove Special Type
                     */

                    // Check security permission
                    if (!UserInfo.GUserInfo.IsTableAccessOK(TTableAccessPermission.tapDELETE, PPartnerTypeTable.GetTableDBName()))
                    {
                        TMessages.MsgSecurityException(new ESecurityDBTableAccessDeniedException("", "delete",
                                                                                                 PPartnerTypeTable.GetTableDBName()), this.GetType());

                        // reset to checked
                        AChangingPartnerTypeRow.CancelEdit();
                        return(false);
                    }

                    // perform check: If COSTCENTRE is to be removed then check whether Partner has a link to costcentre set up
                    if (TypeCode == TYPECODE_COSTCENTRE)
                    {
                        try
                        {
                            if (FPartnerEditUIConnector.HasPartnerCostCentreLink(out CostCentreLink))
                            {
                                MessageBox.Show(String.Format(StrPartnerHasCostCentreLink, CostCentreLink,
                                                              StrPartnerHasCostCentreLinkTitle));

                                // reset to checked
                                AChangingPartnerTypeRow.CancelEdit();
                                return(false);
                            }
                        }
                        catch (ESecurityAccessDeniedException Exp)
                        {
                            TMessages.MsgSecurityException(Exp, this.GetType());
                            MessageBox.Show(StrSecurityPreventsRemoval, StrSecurityPreventsRemovalTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);

                            // reset to checked
                            AChangingPartnerTypeRow.CancelEdit();
                            return(false);
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }

                    // Delete row from PartnerType table
                    ExistingMatchingDataRow.Delete();

                    // Fire OnRecalculateScreenParts event
                    RecalculateScreenPartsEventArgs            = new TRecalculateScreenPartsEventArgs();
                    RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters;
                    OnRecalculateScreenParts(RecalculateScreenPartsEventArgs);

                    ReturnValue = true;
                    AIsRemoval  = true;
                }

                /*
                 * Check if this change could be applied to Family Members
                 */
// TODO PartnerTypeFamilyMembersPropagationSelectionWinForm Dialog still missing
#if TODO
                if (SharedTypes.PartnerClassStringToEnum(FMainDS.PPartner[0].PartnerClass) == TPartnerClass.FAMILY)
                {
                    if (HasFamilyFamilyMembers())
                    {
                        if (FDelegatePartnerTypePropagationSelection != null)
                        {
                            if (!AIsRemoval)
                            {
                                FMainDS.Merge(FDelegatePartnerTypePropagationSelection(TypeCode, "ADD"));
                            }
                            else
                            {
                                FMainDS.Merge(FDelegatePartnerTypePropagationSelection(TypeCode, "DELETE"));
                            }
                        }
                    }
                }
#endif
            }
            catch (Exception E)
            {
                MessageBox.Show(E.ToString());
                ReturnValue = false;
            }

            return(ReturnValue);
        }
예제 #10
0
 private void RethrowRecalculateScreenParts(System.Object sender, TRecalculateScreenPartsEventArgs e)
 {
     OnRecalculateScreenParts(e);
 }