Esempio n. 1
0
 protected void cmdSchedule_Click(object sender, EventArgs e)
 {
     if (lueContactToScheduleFor.LookupResultValue == null)
     {
         throw new ValidationException(GetLocalResourceObject("error_ScheduleFor.Message").ToString());
     }
     try
     {
         LoadOwner();
         if (cboProcessType.DataSource != null)
         {
             Plugin   selectedPlugin = ((IList <Plugin>)cboProcessType.DataSource)[cboProcessType.SelectedIndex];
             object[] objarray       = new[]
             {
                 lueContactToScheduleFor.LookupResultValue,
                 selectedPlugin.PluginId,
                 selectedPlugin.Family,
                 selectedPlugin.Name,
                 ownProcessOwner.LookupResultValue
             };
             Sage.Platform.Orm.DynamicMethodLibraryHelper.Instance.Execute("Contact.ScheduleProcess", objarray);
             DialogService.CloseEventHappened(sender, e);
             IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(true);
             refresher.RefreshTabWorkspace();
         }
         else
         {
             DialogService.ShowMessage(GetLocalResourceObject("Error_ProcessTypes").ToString(), "SalesLogix");
         }
     }
     catch (Exception ex)
     {
         string sSlxErrorId = null;
         var    sMsg        = ErrorHelper.GetClientErrorHtmlMessage(ex, ref sSlxErrorId);
         if (!string.IsNullOrEmpty(sSlxErrorId))
         {
             log.Error(
                 ErrorHelper.AppendSlxErrorId(
                     "The call to SmartParts_Process_ScheduleProcess.cmdSchedule_Click failed", sSlxErrorId), ex);
         }
         DialogService.ShowHtmlMessage(sMsg, ErrorHelper.IsDevelopmentContext() ? 600 : -1,
                                       ErrorHelper.IsDevelopmentContext() ? 800 : -1);
     }
 }
Esempio n. 2
0
    protected void btnSave_ClickActionBRC(object sender, EventArgs e)
    {
        IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();

        refresher.RefreshTabWorkspace();
    }
Esempio n. 3
0
        public static void QFButton_OnClickStep(IInsertAccountContact form, EventArgs args)
        {
            IUser    currentUser = MySlx.Security.CurrentSalesLogixUser;
            IContact contact     = form.CurrentEntity as IContact;
            var      account     = form.lueAccount.LookupResultValue as IAccount;

            IAddress ad = EntityFactory.Create <IAddress>();

            ad.Description = contact.Address.Description;
            ad.Address1    = contact.Address.Address1;
            ad.Address2    = contact.Address.Address2;
            ad.Address3    = contact.Address.Address3;
            ad.Address4    = contact.Address.Address4;
            ad.City        = contact.Address.City;
            ad.State       = contact.Address.State;
            ad.PostalCode  = contact.Address.PostalCode;
            ad.Country     = contact.Address.Country;
            ad.County      = contact.Address.County;
            ad.Salutation  = contact.Address.Salutation;

            contact.Account        = account;
            contact.AccountManager = currentUser;
            contact.Owner          = currentUser.DefaultOwner;
            contact.SaveContactAccount(account);

            var _parent = form.WorkItem.Services.Get <IEntityContextService>().GetEntity();

            if (_parent is IERPBillTo)
            {
                var billToContact = EntityFactory.Create <IERPBillToContact>();
                billToContact.Contact   = contact;
                billToContact.ERPBillTo = (IERPBillTo)_parent;
                billToContact.Save();
            }
            else if (_parent is IERPShipTo)
            {
                var shipToContact = EntityFactory.Create <IERPShipToContact>();
                shipToContact.Contact   = contact;
                shipToContact.ERPShipTo = (IERPShipTo)_parent;
                shipToContact.Save();
            }
            else if (_parent is IERPPayFrom)
            {
                var payFromContact = EntityFactory.Create <IERPPayFromContact>();
                payFromContact.Contact    = contact;
                payFromContact.ERPPayFrom = (IERPPayFrom)_parent;
                payFromContact.Save();
            }

            ISelectionService srv     = ApplicationContext.Current.Services.Get <ISelectionService>(true);
            ISelectionContext sc      = new SimpleSelectionContext();
            SelectionInfo     selInfo = new SelectionInfo();
            SelectionItem     item    = new SelectionItem {
                Id = contact.Id.ToString()
            };

            selInfo.Selections.Add(item);
            sc.Key           = "InsertAccountContact";
            sc.SelectionInfo = selInfo;
            srv.SetSelectionContext(sc.Key, sc);

            IPanelRefreshService refresher = form.Services.Get <IPanelRefreshService>();

            if (refresher != null)
            {
                refresher.RefreshTabWorkspace();
            }
        }