Example #1
0
        /// <summary>
        /// Invokes the Quick Insert Account view.
        /// </summary>
        /// <param name="form">The Insert Sales Order form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void btnAddNewAccount_OnClickStep(IInsertSalesOrder form, EventArgs args)
        {
            var dialogService = form.Services.Get <IWebDialogService>();

            if (dialogService != null)
            {
                dialogService.SetSpecs(20, 20, 300, 800, "QuickInsertAccountContact", "", true);
                dialogService.EntityType = typeof(IContact);
                dialogService.ShowDialog();
            }
        }
 /// <summary>
 /// Invokes the Quick Insert Account view.
 /// </summary>
 /// <param name="form">The Insert Sales Order form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void btnAddNewAccount_OnClickStep(IInsertSalesOrder form, EventArgs args)
 {
     Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart;
     Sage.Platform.WebPortal.Services.IWebDialogService dialogService =  smartpart.DialogService;
     if (dialogService != null)
     {
         dialogService.SetSpecs(20, 20, 265, 800, "QuickInsertAccountContact", "", true);
         dialogService.EntityType = typeof(IContact);
         dialogService.ShowDialog();
     }
 }
 /// <summary>
 /// Invokes the Quick Insert Account view.
 /// </summary>
 /// <param name="form">The Insert Sales Order form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void btnAddNewAccount_OnClickStep(IInsertSalesOrder form, EventArgs args)
 {
     Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart smartpart     = form.NativeForm as Sage.Platform.WebPortal.SmartParts.EntityBoundSmartPart;
     Sage.Platform.WebPortal.Services.IWebDialogService      dialogService = smartpart.DialogService;
     if (dialogService != null)
     {
         dialogService.SetSpecs(20, 20, 300, 800, "QuickInsertAccountContact", "", true);
         dialogService.EntityType = typeof(IContact);
         dialogService.ShowDialog();
     }
 }
        public static void OnLoad1Step(IInsertSalesOrder form, EventArgs args)
        {
            ISalesOrder so = form.CurrentEntity as ISalesOrder;

            if (so == null)
            {
                return;
            }
            IAppIdMappingService mappingService = ApplicationContext.Current.Services.Get <IAppIdMappingService>(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   = 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 = EntityFactory.Create <ISalesOrderAddress>();
                            so.BillingAddress = billAddr;
                        }
                        so.SetSalesOrderBillingAddress(newContact.Address);

                        if (so.ShippingAddress == null)
                        {
                            ISalesOrderAddress shipAddr = EntityFactory.Create <ISalesOrderAddress>();
                            so.ShippingAddress = shipAddr;
                        }
                        so.SetSalesOrderShippingAddress(newContact.Address);
                        srv.SetSelectionContext("QuickInsertAccountContact", null);
                    }
                }
            }
        }
 /// <summary>
 /// Assigns the Sales Order type.
 /// </summary>
 /// <param name="form">The Insert Sales Order form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void btnSaveNew_OnClickStep(IInsertSalesOrder form, EventArgs args)
 {
     ISalesOrder salesOrder = form.CurrentEntity as ISalesOrder;
     if (salesOrder != null)
     {
         string selectedValue = form.rdgSOType.SelectedValue;
         if (selectedValue.Equals("SalesOrder"))
         {
             salesOrder.IsQuote = false;
         }
         else if (selectedValue.Equals("Quote"))
         {
             salesOrder.IsQuote = true;
         }
         salesOrder.Save();
         HttpContext.Current.Response.Redirect(string.Format("SalesOrder.aspx?entityId={0}", salesOrder.Id.ToString()), false);
     }
 }
Example #6
0
        /// <summary>
        /// Assigns the Sales Order type.
        /// </summary>
        /// <param name="form">The Insert Sales Order form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void btnSaveNew_OnClickStep(IInsertSalesOrder form, EventArgs args)
        {
            ISalesOrder salesOrder = form.CurrentEntity as ISalesOrder;

            if (salesOrder != null)
            {
                string selectedValue = form.rdgSOType.SelectedValue;
                if (selectedValue.Equals("SalesOrder"))
                {
                    salesOrder.IsQuote = false;
                }
                else if (selectedValue.Equals("Quote"))
                {
                    salesOrder.IsQuote = true;
                }
                salesOrder.Save();
                HttpContext.Current.Response.Redirect(string.Format("SalesOrder.aspx?entityId={0}", salesOrder.Id.ToString()), 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())
            {
                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);
                  }
              }
            }
        }
        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())
            {
                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);
                    }
                }
            }
        }