示例#1
0
 /// <summary>
 /// Sets the forms toolbar buttons visibility based on the display mode of the product.
 /// </summary>
 /// <param name="form">The product details form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void OnFormLoad(IProductDetails form, EventArgs args)
 {
     Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart;
     Sage.Platform.WebPortal.EntityPage page = (Sage.Platform.WebPortal.EntityPage)smartpart.Page;
     if (page != null)
     {
         Sage.Platform.SData.IAppIdMappingService mappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(true);
         if (mappingService.IsIntegrationEnabled())
         {
             form.clIntegrationContract.Visible = true;
             form.curCost.Enabled = false;
             //form.txtDescription.Enabled = false;
             form.txtName.Enabled          = false;
             form.txtSKU.Enabled           = false;
             form.pklFamily.Enabled        = false;
             form.pklStatus.Enabled        = false;
             form.pklType.Enabled          = false;
             form.lueUnitOfMeasure.Enabled = false;
             form.btnDelete.Visible        = false;
             form.btnSave.Visible          = false;
             form.btnInsertSave.Visible    = false;
         }
         else
         {
             form.clIntegrationContract.Visible = false;
             bool bInsertMode = page.ModeId.ToUpper().Equals("INSERT");
             form.btnDelete.Visible     = !bInsertMode;
             form.btnSave.Visible       = !bInsertMode;
             form.btnInsertSave.Visible = bInsertMode;
         }
     }
 }
示例#2
0
        public static void SetupIntegrationContractStep(IInsertOpportunity form, EventArgs args)
        {
            IOpportunity opportunity = form.CurrentEntity as IOpportunity;

            if (opportunity == null)
            {
                return;
            }
            Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(false);
            if (oMappingService != null && oMappingService.IsIntegrationEnabled())
            {
                if (!opportunity.CanChangeOperatingCompany())
                {
                    form.lueERPApplication.Enabled = false;
                    form.luePriceList.Enabled      = false;
                }
                else
                {
                    form.lueERPApplication.Enabled = true;
                    form.luePriceList.Enabled      = (form.lueERPApplication.LookupResultValue != null);
                }
            }
            else
            {
                form.clIntegrationContract.Visible = false;
            }
        }
 private void LoadSOTasks(EntityPage page)
 {
     if (page.IsDetailMode)
     {
         divEntitySalesOrder.Style.Add("display", "block");
         _currentSOEntity = EntityFactory.GetRepository <ISalesOrder>().Get(page.EntityContext.EntityID);
         rowCheckPrices.Style.Add("display", "none");
         rowSOSubmit.Style.Add("display", "none");
         rowSOStatus.Style.Add("display", "block");
         divSOLastUpdate.Style.Add("display", "block");
         lblStatus.ForeColor = lblSOStatus.ForeColor;
         Sage.Platform.SData.IAppIdMappingService mappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(true);
         if (!mappingService.IsIntegrationEnabled())
         {
             rowSOStatus.Style.Add("display", "none");
             divSOLastUpdate.Style.Add("display", "none");
         }
         else
         {
             bool isOpen = true;
             if (!String.IsNullOrEmpty(_currentSOEntity.ERPSalesOrder.ERPStatus))
             {
                 isOpen =
                     (_currentSOEntity.ERPSalesOrder.ERPStatus.Equals(
                          GetLocalResourceObject("ERPStatus_Open").ToString()) ||
                      _currentSOEntity.ERPSalesOrder.ERPStatus.Equals(GetLocalResourceObject("ERPStatus_Rejected").ToString()));
             }
             lblStatus.Text = _currentSOEntity.ERPSalesOrder.ERPStatus;
             //sales order has never been submitted
             if (!_currentSOEntity.GlobalSyncId.HasValue && isOpen)
             {
                 rowCheckPrices.Style.Add("display", "block");
                 rowSOSubmit.Style.Add("display", "block");
             }
             else if (_currentSOEntity.GlobalSyncId.HasValue && !isOpen)
             {
                 lblStatus.ForeColor = Color.Red;
                 rowCheckPrices.Style.Add("display", "none");
                 rowSOSubmit.Style.Add("display", "none");
             }
         }
         if (mappingService.IsIntegrationEnabled())
         {
             lblSOSubmittedOn.Text = String.Format(GetLocalResourceObject("lblSoSubmittedOn.Caption").ToString(),
                                                   TimeZone.UTCDateTimeToLocalTime(
                                                       (DateTime)_currentSOEntity.ModifyDate),
                                                   _currentSOEntity.ModifyUser);
         }
         if (page.IsNewEntity)
         {
             updateSOPanel.Update();
         }
     }
 }
示例#4
0
        public static void SetupIntegrationContractStep(IInsertOpportunity form, EventArgs args)
        {
            IOpportunity opportunity = form.CurrentEntity as IOpportunity;

            if (opportunity == null)
            {
                return;
            }
            Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(false);
            if (oMappingService != null && oMappingService.IsIntegrationEnabled())
            {
                if (!opportunity.CanChangeOperatingCompany())
                {
                    form.lueERPApplication.Enabled = false;
                    form.luePriceList.Enabled      = false;
                }
                else
                {
                    form.lueERPApplication.Enabled = true;
                    object oValue = form.lueERPApplication.LookupResultValue;
                    string sValue = string.Empty;
                    if (oValue != null)
                    {
                        sValue = oValue.ToString();
                    }
                    if (string.IsNullOrEmpty(sValue))
                    {
                        form.luePriceList.Text = string.Empty;
                        form.luePriceList.LookupResultValue = null;
                        form.luePriceList.Enabled           = false;
                    }
                    else
                    {
                        form.luePriceList.Enabled = true;
                    }
                    SalesLogix.HighLevelTypes.LookupPreFilter filterAppId = new SalesLogix.HighLevelTypes.LookupPreFilter();
                    filterAppId.LookupEntityName = "Sage.Entity.Interfaces.IAppIdMapping";
                    filterAppId.PropertyName     = "Id";
                    filterAppId.OperatorCode     = "!=";
                    filterAppId.FilterValue      = oMappingService.LocalAppId;
                    filterAppId.PropertyType     = "System.String";
                    form.lueERPApplication.LookupPreFilters.Add(filterAppId);
                }
            }
            else
            {
                form.clIntegrationContract.Visible = false;
            }
        }
        public static void OnLoad1Step(IInsertSalesOrder form, EventArgs args)
        {
            ISalesOrder so = form.CurrentEntity as ISalesOrder;

            if (so == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(form.rdgSOType.SelectedValue))
            {
                form.rdgSOType.SelectedValue = "SalesOrder";
            }
            Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(false);
            if (oMappingService != null && oMappingService.IsIntegrationEnabled())
            {
                if (!so.CanChangeOperatingCompany())
                {
                    form.lueERPApplication.Enabled = false;
                    form.luePriceList.Enabled      = false;
                }
                else
                {
                    form.lueERPApplication.Enabled = true;
                    form.luePriceList.Enabled      = (form.lueERPApplication.LookupResultValue != null);
                }
            }
            else
            {
                form.clIntegrationContract.Visible = false;
            }

            ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true);

            if (srv != null)
            {
                ISelectionContext sc = srv.GetSelectionContext("QuickInsertAccountContact");
                if (sc != null)
                {
                    List <string> sels = sc.GetSelectedIds();
                    if (sels.Count > 0)
                    {
                        string   newContactId = sels[0];
                        IContact newContact   = Sage.Platform.EntityFactory.GetById <IContact>(newContactId);
                        IAccount newAccount   = newContact.Account;
                        so.Account         = newAccount;
                        so.AccountManager  = newAccount.AccountManager;
                        so.BillingContact  = newContact;
                        so.ShippingContact = newContact;
                        so.BillToName      = newContact.NameLF;
                        so.ShipToName      = newContact.NameLF;

                        if (so.BillingAddress == null)
                        {
                            ISalesOrderAddress billAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>();
                            so.BillingAddress = billAddr;
                        }
                        so.SetSalesOrderBillingAddress(newContact.Address);

                        if (so.ShippingAddress == null)
                        {
                            ISalesOrderAddress shipAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>();
                            so.ShippingAddress = shipAddr;
                        }
                        so.SetSalesOrderShippingAddress(newContact.Address);
                        srv.SetSelectionContext("QuickInsertAccountContact", null);
                    }
                }
            }
        }
        public static void OnLoad1Step(IInsertSalesOrder form, EventArgs args)
        {
            ISalesOrder so = form.CurrentEntity as ISalesOrder;

            if (so == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(form.rdgSOType.SelectedValue))
            {
                form.rdgSOType.SelectedValue = "SalesOrder";
            }
            Sage.Platform.SData.IAppIdMappingService oMappingService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.SData.IAppIdMappingService>(false);
            if (oMappingService != null && oMappingService.IsIntegrationEnabled())
            {
                form.clIntegrationContract.Visible = true;
                object oValue = form.lueERPApplication.LookupResultValue;
                string sValue = string.Empty;
                if (oValue != null)
                {
                    sValue = oValue.ToString();
                }
                if (string.IsNullOrEmpty(sValue))
                {
                    form.luePriceList.Text = string.Empty;
                    form.luePriceList.LookupResultValue = null;
                    form.luePriceList.Enabled           = false;
                }
                else
                {
                    form.luePriceList.Enabled = true;
                }

                Sage.SalesLogix.HighLevelTypes.LookupPreFilter filterAppId = new Sage.SalesLogix.HighLevelTypes.LookupPreFilter();
                filterAppId.LookupEntityName = "Sage.Entity.Interfaces.IAppIdMapping";
                filterAppId.PropertyName     = "Id";
                filterAppId.OperatorCode     = "!=";
                filterAppId.FilterValue      = oMappingService.LocalAppId;
                filterAppId.PropertyType     = "System.String";
                form.lueERPApplication.LookupPreFilters.Add(filterAppId);
            }
            else
            {
                form.clIntegrationContract.Visible = false;
            }

            ISelectionService srv = ApplicationContext.Current.Services.Get <ISelectionService>(true);

            if (srv != null)
            {
                ISelectionContext sc = srv.GetSelectionContext("QuickInsertAccountContact");
                if (sc != null)
                {
                    List <string> sels = sc.GetSelectedIds();
                    if (sels.Count > 0)
                    {
                        string   newContactId = sels[0];
                        IContact newContact   = Sage.Platform.EntityFactory.GetById <IContact>(newContactId);
                        IAccount newAccount   = newContact.Account;
                        so.Account         = newAccount;
                        so.AccountManager  = newAccount.AccountManager;
                        so.BillingContact  = newContact;
                        so.ShippingContact = newContact;
                        so.BillToName      = newContact.NameLF;
                        so.ShipToName      = newContact.NameLF;

                        if (so.BillingAddress == null)
                        {
                            ISalesOrderAddress billAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>();
                            so.BillingAddress = billAddr;
                        }
                        so.BillingAddress.Address1   = newContact.Address.Address1;
                        so.BillingAddress.Address2   = newContact.Address.Address2;
                        so.BillingAddress.Address3   = newContact.Address.Address3;
                        so.BillingAddress.Address4   = newContact.Address.Address4;
                        so.BillingAddress.City       = newContact.Address.City;
                        so.BillingAddress.State      = newContact.Address.State;
                        so.BillingAddress.Country    = newContact.Address.Country;
                        so.BillingAddress.County     = newContact.Address.County;
                        so.BillingAddress.PostalCode = newContact.Address.PostalCode;

                        if (so.ShippingAddress == null)
                        {
                            ISalesOrderAddress shipAddr = Sage.Platform.EntityFactory.Create <ISalesOrderAddress>();
                            so.ShippingAddress = shipAddr;
                        }

                        so.ShippingAddress.Address1   = newContact.Address.Address1;
                        so.ShippingAddress.Address2   = newContact.Address.Address2;
                        so.ShippingAddress.Address3   = newContact.Address.Address3;
                        so.ShippingAddress.Address4   = newContact.Address.Address4;
                        so.ShippingAddress.City       = newContact.Address.City;
                        so.ShippingAddress.State      = newContact.Address.State;
                        so.ShippingAddress.Country    = newContact.Address.Country;
                        so.ShippingAddress.County     = newContact.Address.County;
                        so.ShippingAddress.PostalCode = newContact.Address.PostalCode;

                        srv.SetSelectionContext("QuickInsertAccountContact", null);
                    }
                }
            }
        }