Exemplo n.º 1
0
        /// <summary>
        /// Downloads an attachment.
        /// Generates the "AttachmentConfirmDownload" event.
        /// </summary>
        public void AttachmentDownload()
        {
            var prime = ThisForm.PrimaryIDOCollection;

            if (prime == null)
            {
                return;
            }
            if (prime.GetSubCollection(AttachmentSubcollectionName, -1).GetCurrentObjectProperty("DocumentType") ==
                "URL")
            {
                ThisForm.GenerateEvent("AttachmentGoToURL");
            }
            else
            {
                if (string.IsNullOrEmpty(prime.GetSubCollection(AttachmentSubcollectionName, -1)
                                         .GetCurrentObjectProperty("DocumentObject")))
                {
                    Application.ShowMessage(Application.GetStringValue("sAttachmentContentEmpty"));
                }
                else
                {
                    ThisForm.Components[AttachmentGridColName].BlobFormat = prime
                                                                            .GetSubCollection(AttachmentSubcollectionName, -1)
                                                                            .GetCurrentObjectProperty("DocumentExtension");
                    ThisForm.GenerateEvent("AttachmentConfirmDownload");
                }
            }
        }
        /// <summary>;
        /// This stores the logic for the dialog's custom submit action. It leverages IsLastAction to either move to the next grid item, or move on to the save functionality.
        /// </summary>
        public void CustomCancelAction()
        {
            if (IsLastAction())
            {
                if (ChildFormDelete() == 0)
                {
                    ChildFormSave();
                }
            }
            else
            {
                var child = ThisForm.ModalChildForm;

                if (child != null)
                {
                    var variable = child.Variables("VarID");

                    if (variable.Value != null)
                    {
                        ChildFormDelete();
                    }
                }
            }
            ThisForm.GenerateEvent("StdFormExitCancel");
        }
Exemplo n.º 3
0
        public void ModalFormReturned()
        {
            if (!ThisForm.LastModalChildEndedOk)
            {
                return;
            }

            var modalFormContext = ThisForm.ModalChildForm.Variables("VarModalContext").GetValueOfString(string.Empty).ToLower();

            switch (modalFormContext)
            {
            case "crmquickaddaccount":
                ThisForm.GenerateEvent("SetAccountIdFromModalForm");
                break;

            case "crmdialogaddress":
                SetAddress();
                ThisForm.PrimaryIDOCollection.RefreshCurrentObject();
                break;

            case "crmlookupbillto":
                SetBillTo();
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// This takes the values from the CRMMenuHandleRouting Global Script, which does the generic Menu item parsing and applies
        /// more process specific logic to the data to build up the needed form signatures.
        /// </summary>
        public void ExpandRoute()
        {
            var nextForm  = ThisForm.Variables("VarFormRoute").Value;
            var variables = ThisForm.Variables("VarSetVariables").Value;

            var key = PullKeyFromChild();

            if (!string.IsNullOrWhiteSpace(key))
            {
                if (!key.StartsWith("FILTER("))
                {
                    variables = string.Format("{0},{1}", variables, key);
                    key       = string.Empty;
                }
                else
                {
                    variables = variables.Replace("InitialCommand=Add,", string.Empty).Replace("InitialCommand=Add", string.Empty);
                    variables = variables.Replace("InitialCommand = Add,", string.Empty).Replace("InitialCommand = Add", string.Empty);
                    if (!variables.Contains("InitialCommand"))
                    {
                        variables = string.Format("InitialCommand=Refresh,{0}", variables);
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(variables))
            {
                variables = string.Format("SETVARVALUES({0})", variables);
            }
            var path = string.Format("{0}(CONTAINER(frmContainer) {1} {2})", nextForm, variables, key);

            ThisForm.Variables("VarFormPath").SetValue(path);
            ThisForm.GenerateEvent("CRMGoToForm");
        }
Exemplo n.º 5
0
        public void SurveyNavigation()
        {
            var relationalItemsPointOfReference = ThisForm.Variables("VarRelationalItemsPointOfReference").Value;

            ThisForm.PrimaryIDOCollection.SaveCurrent();
            ThisForm.Variables("VarRelationalItemsPointOfReference").SetValue(relationalItemsPointOfReference);
            ThisForm.GenerateEvent("RelatedItemsNavigation");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Clicking the Submit button prior to selecting the Count Quantity Confirmed checkbox for each and every lot code containing Stock Adjustment amounts
        /// will pop up a dialog message indicating the "Unconfirmed" adjustments will be ignored and provide the classic Continue and Cancel action buttons.
        /// </summary>
        public void ValidateSubmit()
        {
            bool showUnconfirmedAdjustmentsPrompt = false;

            int numOfAdjustments = 0;

            ThisForm.PrimaryIDOCollection.First();
            for (int i = 0; i < ThisForm.PrimaryIDOCollection.GetNumEntries() - 1; i++)
            {
                string count             = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("CountQuantity");
                string adjustment        = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("Adjustment");
                string confirmAdjustment = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty("ConfirmAdjustment");

                Application.ShowMessage(i + "\n" + count + "\n" + adjustment + "\n" + confirmAdjustment);

                //something went wrong, adjustment did not get calculated
                if (!count.Equals("") && adjustment.Equals(""))
                {
                    Application.ShowMessage("Count " + count + " was not processed");
                }

                //if adjustment is empty, skip
                if (adjustment.Equals(""))
                {
                    ThisForm.PrimaryIDOCollection.Next();
                    continue;
                }

                //check if confirm is empty
                if (confirmAdjustment.Equals("") || confirmAdjustment.Equals("0"))
                {
                    showUnconfirmedAdjustmentsPrompt = true;
                }
                else
                {
                    Application.DiagnosticsLog("record " + i + " has a value of " + confirmAdjustment);
                }

                numOfAdjustments++;
                ThisForm.PrimaryIDOCollection.Next();
            }

            ThisForm.Variables("VarNumOfAdjustments").Value = numOfAdjustments.ToString();

            if (showUnconfirmedAdjustmentsPrompt)
            {
                ThisForm.GenerateEvent("PromptUnconfirmedAdjustments");
            }
            else
            {
                ThisForm.GenerateEvent("SubmitStockAudit");
            }
        }
Exemplo n.º 7
0
 public void runActionEvent(string actionEvent)
 {
     if (!string.IsNullOrWhiteSpace(actionEvent))
     {
         Application.DiagnosticsLog(string.Format("Now attempting to generate event -- {0}.", actionEvent));
         ThisForm.GenerateEvent(actionEvent);
     }
     else
     {
         Application.DiagnosticsLog(string.Format("Action event for {0} was blank.", actionEvent));
     }
 }
Exemplo n.º 8
0
        public void SurveyHistory()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();
            var sp       = variable.Split(';');

            string[] properties;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;

            //returns SurveyID, EntityType, EntitiyID
            properties = GetSurveyAssociationValues(associationID).Split(';');
            ThisForm.Variables("VarSurveyHistoryID").SetValue(properties[0]);
            ThisForm.GenerateEvent("LaunchSurveyHistory");
        }
Exemplo n.º 9
0
        /// <summary>
        /// Primary Event for CRM File Panel User Component.
        /// Generates "AttachmentUpload", "AttachmentDownload", or "AttachmentDelete" events.
        /// </summary>
        public void AttachmentPrimaryEvent()
        {
            var prime = ThisForm.PrimaryIDOCollection;

            if (prime == null)
            {
                return;
            }

            var flag = ThisForm.Components[AttachmentFileComponentName].Value;

            if (flag == "1")
            {
                ThisForm.GenerateEvent("AttachmentUpload");
            }
            else if (flag.Length > 1 && flag.Substring(0, 2) == "2-")
            {
                if (flag.Length <= 2)
                {
                    return;
                }
                var index = int.Parse(flag.Substring(2, flag.Length - 2));
                //Application.ShowMessage("Index=" + index);
                prime.GetSubCollection(AttachmentSubcollectionName, -1)
                .MoveCurrentIndexAndRefresh(index, true);
                ThisForm.GenerateEvent("AttachmentDownload");
            }
            else if (flag.Length > 1 && flag.Substring(0, 2) == "3-")
            {
                if (flag.Length <= 2)
                {
                    return;
                }
                var index = int.Parse(flag.Substring(2, flag.Length - 2));
                prime.GetSubCollection(AttachmentSubcollectionName, -1)
                .MoveCurrentIndexAndRefresh(index, true);
                ThisForm.GenerateEvent("AttachmentDelete");
            }
            else if (flag.Length > 1 && flag.Substring(0, 2) == "5-")
            {
                if (flag.Length <= 2)
                {
                    return;
                }
                var index = int.Parse(flag.Substring(2, flag.Length - 2));
                prime.GetSubCollection(AttachmentSubcollectionName, -1)
                .MoveCurrentIndexAndRefresh(index, true);
                ThisForm.GenerateEvent("AttachmentEdit");
            }
        }
Exemplo n.º 10
0
 public void importMethod()
 {
     if (ThisForm.Variables("varConnection").Value.Equals("ION"))
     {
         ThisForm.GenerateEvent("IonImportSelectedIdos");
     }
     else if (ThisForm.Variables("varConnection").Value.Equals("TOKEN"))
     {
         ThisForm.GenerateEvent("tokenImportSelectedIdos");
     }
     else
     {
         Application.ShowMessage(ThisForm.Variables("varConnection").Value + " HAS TO BE EITHER ION OR TOKEN");
     }
 }
Exemplo n.º 11
0
 public void importIdoNamesMethod()
 {
     if (ThisForm.Variables("varConnection").Value.Equals("ION"))
     {
         ThisForm.GenerateEvent("ionLoadIdoNamesFromProject");
     }
     else if (ThisForm.Variables("varConnection").Value.Equals("TOKEN"))
     {
         ThisForm.GenerateEvent("tokenLoadIdoNamesFromProject");
     }
     else
     {
         Application.ShowMessage(ThisForm.Variables("varConnection").Value + " HAS TO BE EITHER ION OR TOKEN");
     }
 }
Exemplo n.º 12
0
        public void StartNewSurvey()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();

            var sp = variable.Split(';');

            string[] properties;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;
            string   newID         = string.Empty;
            string   resultMessage = string.Empty;

            //returns SurveyID, EntityType, EntitiyID, NEED TO GET STATUS TO CHECK
            properties = GetSurveyAssociationValues(associationID).Split(';');

            var insertReq = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyRecord",
                MethodName = "InsertSurveyRecord",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(properties[0]),
                    new InvokeParameter(properties[1]),
                    new InvokeParameter(properties[2]),
                    new InvokeParameter(newID),
                    new InvokeParameter(resultMessage)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp = IDOClient.Invoke(insertReq);
                if (int.Parse(resp.ReturnValue) == 0)
                {
                    ThisForm.Variables("VarSurveyRecordID").Value = resp.Parameters[3].Value;
                    ThisForm.GenerateEvent("LaunchSurveyRecord");
                }
                else
                {
                    throw new Exception(resp.Parameters[4].Value);
                }
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.Message);
                return;
            }
        }
Exemplo n.º 13
0
        public void ValidateInProgressSurveys()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();
            var sp       = variable.Split(';');

            string[] properties;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;
            string   resultMessage = string.Empty;
            string   result;

            //returns SurveyID, EntityType, EntitiyID
            properties = GetSurveyAssociationValues(associationID).Split(';');
            int inProgress;
            var req = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyRecord",
                MethodName = "PreInsertValidateInProgress",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(properties[1]),
                    new InvokeParameter(properties[2]),
                    new InvokeParameter(properties[0]),
                    new InvokeParameter(resultMessage)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp       = IDOClient.Invoke(req);
                inProgress = int.Parse(resp.ReturnValue);
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.ToString());
                return;
            }
            if (inProgress != 0)
            {
                ThisForm.GenerateEvent("SurveyInProgress");
            }
            else
            {
                ThisForm.GenerateEvent("NoSurveyInProgress");
            }
        }
Exemplo n.º 14
0
        private void RefreshFilter()
        {
            var modalFormContext = ThisForm.ModalChildForm.Variables("VarModalContext").GetValueOfString(string.Empty).ToLower();

            switch (modalFormContext)
            {
            case "crmfilteraccountinvoice":
                ThisForm.Variables("VarERPInvoiceStatus").SetValue(string.Empty);
                ThisForm.Variables("VarAccountingEntity").SetValue(string.Empty);
                ThisForm.Variables("VarAccountInvoiceFilter").SetValue(string.Empty);
                ThisForm.GenerateEvent("CRMResetRelatedItemFilterCount");
                break;

            case "crmfilteraccountreceivable":
                ThisForm.Variables("VarERPReceivableStatus").SetValue(string.Empty);
                ThisForm.Variables("VarAccountingEntityReceivable").SetValue(string.Empty);
                ThisForm.Variables("VarAccountReceivableFilter").SetValue(string.Empty);
                ThisForm.GenerateEvent("CRMResetRelatedItemFilterCount");
                break;

            case "crmfilteraccountshipment":
                ThisForm.Variables("VarERPShipmentStatus").SetValue(string.Empty);
                ThisForm.Variables("VarAccountingEntityShipment").SetValue(string.Empty);
                ThisForm.Variables("VarAccountShipmentFilter").SetValue(string.Empty);
                ThisForm.GenerateEvent("CRMResetRelatedItemFilterCount");
                break;

            case "crmfilteraccountsalesorder":
                ThisForm.Variables("VarSalesOrderStatus").SetValue(string.Empty);
                ThisForm.Variables("VarAccountingEntityOrder").SetValue(string.Empty);
                ThisForm.Variables("VarAccountOrderFilter").SetValue(string.Empty);
                ThisForm.GenerateEvent("CRMResetRelatedItemFilterCount");
                break;

            case "crmfilteraccountquote":
                ThisForm.Variables("VarQuoteStatus").SetValue(string.Empty);
                ThisForm.Variables("VarAccountingEntityQuote").SetValue(string.Empty);
                ThisForm.Variables("VarAccountQuoteFilter").SetValue(string.Empty);
                ThisForm.GenerateEvent("CRMResetRelatedItemFilterCount");
                break;

            default:
                break;
            }
        }
Exemplo n.º 15
0
 /// <summary>
 /// This stores the logic for the dialog's custom submit action. It leverages IsLastAction to either move to the next grid item, or move on to the save functionality.
 /// </summary>
 public new void CustomSubmitAction()
 {
     if (IsLastAction())
     {
         if (ChildFormSave() == 0)
         {
             SetReturnVariables();
             ThisForm.GenerateEvent("StdFormExitOk");
         }
     }
     else
     {
         if (ChildFormSave() == 0)
         {
             ThisForm.PrimaryIDOCollection.Next();
         }
     }
 }
Exemplo n.º 16
0
        public void ContinueInProgressSurvey()
        {
            var variable = ThisForm.Variables("VarRelationalItemsPointOfReference").Value.Trim();
            var sp       = variable.Split(';');

            string[] properties;
            var      accordionType = (sp.Length > 1) ? (sp[1] ?? string.Empty) : string.Empty;
            var      associationID = (sp.Length > 2) ? (sp[2] ?? string.Empty) : string.Empty;
            var      eventName     = (sp.Length > 3) ? (sp[3] ?? string.Empty) : string.Empty; // event or itemid
            string   NewID         = string.Empty;

            //returns SurveyID, EntityType, EntitiyID
            properties = GetSurveyAssociationValues(associationID).Split(';');

            var insertReq = new InvokeRequestData()
            {
                IDOName    = "CRMSurveyRecord",
                MethodName = "GetInProgressSurvey",
                Parameters = new InvokeParameterList()
                {
                    new InvokeParameter(properties[1]),
                    new InvokeParameter(properties[2]),
                    new InvokeParameter(properties[0]),
                    new InvokeParameter(NewID)
                }
            };

            try
            {
                InvokeResponseData resp = null;
                resp = IDOClient.Invoke(insertReq);
                ThisForm.Variables("VarSurveyRecordID").SetValue(resp.Parameters[3].GetValue(String.Empty));
            }
            catch (Exception ex)
            {
                Application.ShowMessage(ex.ToString());
                return;
            }
            ThisForm.GenerateEvent("LaunchSurveyRecord");
        }
Exemplo n.º 17
0
        public void CRMShowFormInDialog(string formName, string filter, string linkBy, string setVarVals, string setPropVals, bool rlac, bool okCancel, string initComm,
                                        string setVariable, string fireEvent)
        {
            var formPath          = string.Empty;
            var formFilterSection = string.Empty;

            if (string.IsNullOrWhiteSpace(formName))
            {
                Application.ShowMessage(Application.GetStringValue("mNoFormNameProvided"));
                return;
            }

            var setValues = setVarVals ?? string.Empty;

            if (!string.IsNullOrWhiteSpace(initComm))
            {
                var initSet = string.Format("InitialCommand={0}", initComm);
                setValues = string.Concat(setValues, (string.IsNullOrWhiteSpace(setValues) ? string.Empty : ", "), initSet);
            }

            formFilterSection = string.Concat("POPUP() ",
                                              !string.IsNullOrWhiteSpace(filter) ? string.Format("FILTER({0}) ", filter) : string.Empty,
                                              !string.IsNullOrWhiteSpace(linkBy) ? string.Format("LINKBY({0}) ", linkBy) : string.Empty,
                                              !string.IsNullOrWhiteSpace(setValues) ? string.Format("SETVARVALUES({0}) ", setValues) : string.Empty,
                                              !string.IsNullOrWhiteSpace(setPropVals) ? string.Format("SETPROPVALUES({0}) ", setPropVals) : string.Empty,
                                              rlac ? "RLACS() " : string.Empty,
                                              okCancel ? "OKCANCELOPTIONAL() " : string.Empty);

            formPath = string.Format("{0}({1})", formName, formFilterSection);

            Application.DiagnosticsLog(formPath);
            if (!string.IsNullOrEmpty(setVariable))
            {
                ThisForm.Variables(setVariable).SetValue(formPath);
            }
            if (!string.IsNullOrEmpty(fireEvent))
            {
                ThisForm.GenerateEvent(fireEvent);
            }
        }
Exemplo n.º 18
0
        public void importSelectedIdos()
        {
            ThisForm.Variables("varDebug").Value += "importSelectedIdos\n";

            JObject jobject = JObject.Parse(ThisForm.Variables("varTablesInIdos").Value);
            Dictionary <string, List <string> > tablesInIdosDict = jobject.ToObject <Dictionary <string, List <string> > >();

            int idosImported = 0;

            foreach (KeyValuePair <string, List <string> > entry in tablesInIdosDict)
            {
                string ido    = entry.Key;
                string tables = String.Join(",", entry.Value);
                ThisForm.Variables("varDebug").Value += ido + " -> " + tables + "\n";

                if (!isEventRunning(aesEventName, ido))
                {
                    ThisForm.Variables("varTableNames").Value = tables;
                    ThisForm.Variables("varIdoName").Value    = ido;

                    if (ThisForm.Variables("varConnection").Value.Equals("ION"))
                    {
                        ThisForm.GenerateEvent("IonBatchImport");
                    }
                    else if (ThisForm.Variables("varConnection").Value.Equals("TOKEN"))
                    {
                        ThisForm.GenerateEvent("tokenBatchImport");
                    }
                    else
                    {
                        Application.ShowMessage(ThisForm.Variables("varConnection").Value + " HAS TO BE EITHER ION OR TOKEN");
                    }
                    idosImported++;
                }
            }
            Application.ShowMessage(idosImported.ToString() + "/" + tablesInIdosDict.Count.ToString() + " are now importing. Please check the 'Event Status' form to check the status of each table.");
        }
Exemplo n.º 19
0
 /// <summary>
 /// A wrapper for calling into the SetParentFormWithOneValue form event. The goal is to provide a place for
 ///    all of the defensive programming checks to make this easy to implement from an implementing form.
 /// </summary>
 /// <param name="value"></param>
 public virtual void SetOneValueOnParentForm(string value)
 {
     if (OpenedWithParentForm())
     {
         Application.DiagnosticsLog(ThisForm.Name + " has a parent named, " + ThisForm.ParentForm.Name);
         // aggressive comma parsing ruins everything
         value = value.Replace(",", ";|;");
         ThisForm.Variables("VarParentReturnValue").SetValue(value);
         if (!string.IsNullOrWhiteSpace(ThisForm.Variables("VarParentReturnType").Value) &&
             !string.IsNullOrWhiteSpace(ThisForm.Variables("VarParentReturnName").Value)
             )
         {
             ThisForm.GenerateEvent("SetParentFormWithOneValue");
         }
         else
         {
             Application.DiagnosticsLog("VarParentReturnType or VarParentReturnName was blank. nothing to update.");
         }
     }
     else
     {
         Application.DiagnosticsLog(ThisForm.Name + " has no parent form found, nothing to update.");
     }
 }
Exemplo n.º 20
0
        public void HandleMenuRouting(string source)
        {
            //Application.ShowMessage(source);
            if (source == null)
            {
                return;
            }

            CrmMenuData data;

            JsonHelper.TryDeserialize <CrmMenuData>(source, out data);

            if (data == null)
            {
                return;
            }

            bool okCancelOpt = (data.OkCancelOptional == "1");

            ThisForm.Variables("VarOkCancelOptional").SetValue(okCancelOpt ? "OKCANCELOPTIONAL()" : string.Empty);

            switch (data.ActionType.ToLowerInvariant())
            {
            case "method":
            {
                switch (data.Action.ToLowerInvariant())
                {
                case "systemsignout":
                {
                    Application.Signout();
                    break;
                }

                default:
                {
                    ThisForm.Variables("VarMethodRoute").Value  = data.Action;
                    ThisForm.Variables("VarSetVariables").Value = data.SetVariables;
                    ThisForm.GenerateEvent("HandleMethodRouting");
                    break;
                }
                }
                break;
            }

            case "form":
            {
                ThisForm.Variables("VarFormRoute").Value    = data.Action;
                ThisForm.Variables("VarSetVariables").Value = data.SetVariables;
                ThisForm.GenerateEvent("HandleFormRouting");
                break;
            }

            case "url":
            {
                ThisForm.Variables("VarURLRoute").Value     = data.Action;
                ThisForm.Variables("VarSetVariables").Value = data.SetVariables;
                ThisForm.GenerateEvent("HandleURLRouting");
                break;
            }

            default:
            {
                break;
            }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Validate the account if the owner is everyone or not
        /// Everyone: does not allow delete
        /// </summary>
        public void ValidateDelete()
        {
            string selectedOwner        = "SecCodeID";
            string selectedAccountName  = "AccountName";
            string showDetail           = ThisForm.Variables("VarShowDetail").GetValue <string>();
            string itemsCannotbeDeleted = string.Empty;

            if (string.Equals(showDetail, "0"))
            {
                itemsCannotbeDeleted = string.Empty;
                var rowCount = ThisForm.PrimaryIDOCollection.GetNumEntries();
                for (var i = 0; i < rowCount; i++)
                {
                    var currentRowValue    = ThisForm.PrimaryIDOCollection.GetObjectProperty(selectionProperty, i);
                    var currentRowOwner    = ThisForm.PrimaryIDOCollection.GetObjectProperty(selectedOwner, i);
                    var currentAccountName = ThisForm.PrimaryIDOCollection.GetObjectProperty(selectedAccountName, i);

                    var filter = string.Format("ID=N'{0}' and Type=N'{1}'", currentRowOwner, "System");

                    var AccountInfo = IDOClient.LoadCollection("CRMSeccodeView", "ID", filter, string.Empty, -1);

                    if (currentRowValue == "1")
                    {
                        if (AccountInfo.Items.Count > 0)
                        {
                            itemsCannotbeDeleted = itemsCannotbeDeleted + currentAccountName + ",";
                        }
                        else
                        {
                            ThisForm.GenerateEvent("StdFormDelete");
                            return;
                        }
                    }
                }
            }
            else
            {
                itemsCannotbeDeleted = string.Empty;
                var currentRowOwner    = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty(selectedOwner);
                var currentAccountName = ThisForm.PrimaryIDOCollection.GetCurrentObjectProperty(selectedAccountName);

                var filter = string.Format("ID=N'{0}' and Type=N'{1}'", currentRowOwner, "System");

                var AccountInfo = IDOClient.LoadCollection("CRMSeccodeView", "ID", filter, string.Empty, -1);

                if (AccountInfo.Items.Count > 0)
                {
                    itemsCannotbeDeleted = currentAccountName;
                }
                else
                {
                    ThisForm.GenerateEvent("StdFormDelete");
                    return;
                }
            }

            if (!string.IsNullOrEmpty(itemsCannotbeDeleted))
            {
                Application.ShowMessage(Application.GetStringValue("sCannotDeleteAccount").Replace("%1", itemsCannotbeDeleted));
            }
        }