コード例 #1
0
        private void ShowDetailsManual(PContactAttributeRow ARow)
        {
            if (ARow == null)
            {
                pnlDetails.Enabled       = false;
                ucoContactDetail.Enabled = false;
            }
            else
            {
                pnlDetails.Enabled       = true;
                ucoContactDetail.Enabled = true;

                // Pass the contact attribute to the user control - it will then update itself
                ucoContactDetail.SetContactAttribute(ARow.ContactAttributeCode);
            }
        }
コード例 #2
0
        private void NewRowManual(ref PContactAttributeRow ARow)
        {
            string NewName        = Catalog.GetString("NEWATTRIBUTE");
            Int32  CountNewDetail = 0;

            if (FMainDS.PContactAttribute.Rows.Find(new object[] { NewName }) != null)
            {
                while (FMainDS.PContactAttribute.Rows.Find(new object[] { NewName + CountNewDetail.ToString() }) != null)
                {
                    CountNewDetail++;
                }

                NewName += CountNewDetail.ToString();
            }

            ARow.ContactAttributeCode = NewName;
        }
コード例 #3
0
 private void GetDetailDataFromControlsManual(PContactAttributeRow ARow)
 {
     // Tell the user control to get its data, too
     ucoContactDetail.GetDetailsFromControls();
 }
コード例 #4
0
 private void GetDetailDataFromControlsManual(PContactAttributeRow ARow)
 {
     // Tell the user control to get its data, too
     ucoContactDetail.GetDetailsFromControls();
 }
コード例 #5
0
        private void ShowDetailsManual(PContactAttributeRow ARow)
        {
            if (ARow == null)
            {
                pnlDetails.Enabled = false;
                ucoContactDetail.Enabled = false;
            }
            else
            {
                pnlDetails.Enabled = true;
                ucoContactDetail.Enabled = true;

                // Pass the contact attribute to the user control - it will then update itself
                ucoContactDetail.SetContactAttribute(ARow.ContactAttributeCode);
            }
        }
コード例 #6
0
        private void NewRowManual(ref PContactAttributeRow ARow)
        {
            string NewName = Catalog.GetString("NEWATTRIBUTE");
            Int32 CountNewDetail = 0;

            if (FMainDS.PContactAttribute.Rows.Find(new object[] { NewName }) != null)
            {
                while (FMainDS.PContactAttribute.Rows.Find(new object[] { NewName + CountNewDetail.ToString() }) != null)
                {
                    CountNewDetail++;
                }

                NewName += CountNewDetail.ToString();
            }

            ARow.ContactAttributeCode = NewName;
        }
コード例 #7
0
        private Boolean PerformContactAttributeAddOrRemoval(DataRow AChangingRow, out Boolean AIsRemoval)
        {
            Boolean ReturnValue = false;

            AIsRemoval = false;

            try
            {
                String AttributeCode       = AChangingRow["AttributeCode"].ToString();
                String AttributeDetailCode = AChangingRow["AttributeDetailCode"].ToString();

                DataRow ExistingDataRow = FSelectedContactAttributeTable.Rows.Find(new object[] { FContactID, AttributeCode, AttributeDetailCode });

                if (ExistingDataRow == null)
                {
                    /*
                     * Add Contact Attribute
                     */

                    DataRow DeletedRow = null;

                    // check that this contact attribute hasn't previously been deleted
                    foreach (DataRow Row in FSelectedContactAttributeTable.Rows)
                    {
                        if ((Row.RowState == DataRowState.Deleted) &&
                            (Convert.ToInt64(Row[PPartnerContactAttributeTable.GetContactIdDBName(), DataRowVersion.Original]) == FContactID) &&
                            (Row[PPartnerContactAttributeTable.GetContactAttributeCodeDBName(),
                                 DataRowVersion.Original].ToString() == AttributeCode) &&
                            (Row[PPartnerContactAttributeTable.GetContactAttrDetailCodeDBName(),
                                 DataRowVersion.Original].ToString() == AttributeDetailCode))
                        {
                            DeletedRow = Row;
                        }
                    }

                    if (DeletedRow != null)
                    {
                        // undelete the previously deleted row
                        DeletedRow.RejectChanges();
                    }
                    else
                    {
                        // Check: is this Contact Attribute assignable
                        PContactAttributeRow ContactAttribute =
                            (PContactAttributeRow)FContactAttributeTableDV.Table.Rows.Find(new Object[] { AttributeCode });
                        PContactAttributeDetailRow ContactAttributeDetail =
                            (PContactAttributeDetailRow)FContactAttributeDetailTableDV.Table.Rows.Find(new Object[] { AttributeCode,
                                                                                                                      AttributeDetailCode });

                        // -1 means this is being used in a find screen and we can select inactive attributes
                        if ((FContactID != -1) && (!ContactAttribute.Active || !ContactAttributeDetail.Active))
                        {
                            MessageBox.Show(
                                string.Format(Catalog.GetString("This Contact Attribute is inactive and cannot be added to this Contact Log."),
                                              AttributeCode),
                                Catalog.GetString("Inactive Contact Attribute"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                            return(false);
                        }

                        // add new row to PartnerType table
                        PPartnerContactAttributeRow TheNewRow = FSelectedContactAttributeTable.NewRowTyped();
                        TheNewRow.ContactId             = FContactID;
                        TheNewRow.ContactAttributeCode  = AttributeCode;
                        TheNewRow.ContactAttrDetailCode = AttributeDetailCode;
                        FSelectedContactAttributeTable.Rows.Add(TheNewRow);
                    }

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

                    // Delete row

                    if (ExistingDataRow.RowState == DataRowState.Added)
                    {
                        FAddedAttributeDeleted = true;
                    }

                    ExistingDataRow.Delete();

                    ReturnValue = true;
                    AIsRemoval  = true;
                }
            }
            catch (Exception E)
            {
                MessageBox.Show(E.ToString());
                ReturnValue = false;
            }

            return(ReturnValue);
        }