Esempio n. 1
0
 /// <summary>
 /// Called when [my dialog closing].
 /// </summary>
 /// <param name="from">From.</param>
 /// <param name="e">The <see cref="Sage.Platform.WebPortal.Services.WebDialogClosingEventArgs"/> instance containing the event data.</param>
 protected override void OnMyDialogClosing(object from, WebDialogClosingEventArgs e)
 {
     base.OnMyDialogClosing(from, e);
     //we nned to refresh the salesprocess page or we will get un wanted postbacks on the Stages DDL.
     Session.Remove("MANAGESTAGESACTIVE");
     Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = PageWorkItem.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>();
     refresher.RefreshAll();
 }
    protected void OnSearch(object sender, EventArgs e)
    {
        IUserOptionsService userOpts = ApplicationContext.Current.Services.Get <IUserOptionsService>();

        if (userOpts != null)
        {
            userOpts.SetCommonOption("LastWebUpdate", "Web", ChangeDate.DateTimeValue.Value.ToString(), false);
        }

        Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = Locator.GetPageWorkItem().Services.Get <IPanelRefreshService>();
        if (refresher != null)
        {
            refresher.RefreshAll();
        }
    }
    protected void btnSaveHistory_ClickAction(object sender, EventArgs e)
    {
        ILead CurrentLead = this.BindingSource.Current as ILead;

        //TAC Code Here to Create the Linked Activity.
        // Create Activity Record
        Sage.Entity.Interfaces.IHistory History = Sage.Platform.EntityFactory.Create <Sage.Entity.Interfaces.IHistory>();
        //History.AccountId = oppfulfiltask.Opportunity.Account.Id.ToString();
        //History.AccountName = oppfulfiltask.Opportunity.Account.AccountName;
        //History.OpportunityId = oppfulfiltask.Opportunity.Id.ToString();
        //History.OpportunityName = oppfulfiltask.Opportunity.Description;
        //todo.ContactId = histContactID;
        //todo.ContactName = histContactName;
        History.LeadId   = CurrentLead.Id.ToString();
        History.LeadName = CurrentLead.LeadNameFirstLast;
        History.Type     = HistoryType.atPhoneCall;
        //todo.Category = histCategory;
        // get the current user as a User

        Sage.SalesLogix.Security.SLXUserService usersvc = (Sage.SalesLogix.Security.SLXUserService)Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>();
        Sage.Entity.Interfaces.IUser            user    = usersvc.GetUser();

        History.UserId = user.Id.ToString();

        History.Duration      = 5;
        History.StartDate     = System.DateTime.UtcNow.AddMinutes(-5);
        History.OriginalDate  = System.DateTime.UtcNow.AddMinutes(-5);
        History.CompletedDate = System.DateTime.UtcNow;
        History.CompletedUser = user.Id.ToString();
        History.Description   = Left(Description.PickListValue, 64);

        History.LongNotes  = Notes.Text;
        History.Notes      = Left(Notes.Text, 255);
        History.Timeless   = false;
        History.Result     = Left(Result.PickListValue, 64);
        History.ResultCode = "COMP";



        try
        {
            History.Save();

            //ListBox lbFollowUp = FindCompActControl("FollowUp") as ListBox;
            //if (lbFollowUp == null) return false;
            //CheckBox cxCarryOverNotes = FindCompActControl("CarryOverNotes") as CheckBox;
            //if (cxCarryOverNotes == null) return false;
            //CheckBox cxCarryOverAttachments = FindCompActControl("CarryOverAttachments") as CheckBox;
            //if (cxCarryOverAttachments == null) return false;
            if (CurrentLead.FirstName == null && CurrentLead.LastName == null)
            {
                CurrentLead.FirstName = "No";
                CurrentLead.LastName  = "Name";
            }
            CurrentLead.CfxLastCallResult = Left(Result.PickListValue, 64);
            CurrentLead.ModifyUser        = user.Id.ToString(); // Force Modify User and Modify Date to be set
            CurrentLead.ModifyDate        = DateTime.UtcNow;
            CurrentLead.ValidateLead();
            CurrentLead.Save();
            //Refresh
            if (this.PageWorkItem != null)
            {
                Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = PageWorkItem.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>();
                if (refresher != null)
                {
                    refresher.RefreshAll();
                }
                else
                {
                    Response.Redirect(Request.Url.ToString());
                }
            }

            if (Followup.Checked)
            {
                Dictionary <string, string> args = new Dictionary <string, string>();
                args.Add("type", "atPhoneCall");

                //if (cxCarryOverNotes.Checked || cxCarryOverAttachments.Checked)
                //{
                args.Add("historyid", History.Id.ToString());
                //}
                //if (cxCarryOverNotes.Checkeod)
                //{
                args.Add("carryovernotes", "true");
                //}
                //if (cxCarryOverAttachments.Checked)
                //{
                //    args.Add("carryoverattachments", "true");
                //}
                args.Add("aid", History.AccountId);
                args.Add("cid", History.ContactId);
                args.Add("oid", History.OpportunityId);
                args.Add("tid", History.TicketId);
                args.Add("lid", History.LeadId);
                args.Add("leadname", History.LeadName);
                args.Add("description", History.Description);

                // if we're in batch mode (multiple complete from ActivityReminders)
                // pass that fact on to ScheduleActivity, so it can link to next activity in batch


                Link.ScheduleActivity(args);
            }
            //===================================================
            // Initialize
            //===================================================
            Result.PickListValue      = String.Empty;
            Description.PickListValue = String.Empty;
            Notes.Text       = String.Empty;
            Followup.Checked = false;
        }
        catch (Exception)
        {
            //Exception But Continue
        }
    }