Exemplo n.º 1
0
        private static Boolean IsMember(string TeamName, string Type)
        {
            Boolean blnReturn = false; // Intialize False

            //Get Current 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            currentuser = usersvc.GetUser();
            // get the DataService to get a connection string to the database
            string SQL = "";

            SQL  = "select accessid from secrights where seccodeid = ";
            SQL += " (select seccodeid from seccode where (seccodedesc = '" + TeamName + "') ";
            SQL += " and (seccodetype = '" + Type + "')) and (accessid = '" + currentuser.Id.ToString() + "')";

            Sage.Platform.Data.IDataService datasvc = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Data.IDataService>();
            using (System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(datasvc.GetConnectionString()))
            {
                conn.Open();
                using (System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(SQL, conn))
                {
                    OleDbDataReader reader = cmd.ExecuteReader();
                    //loop through the reader
                    while (reader.Read())
                    {
                        if (reader["accessid"].ToString() != string.Empty)
                        {
                            blnReturn = true;
                        }
                    }
                    reader.Close();
                }
            }
            return(blnReturn);
        }
Exemplo n.º 2
0
        public static void EuroOnAfterTicketInsert(ITicket ticket)
        {
            //=========================================================================
            // Needed to Update IT Tickets to the Correct Owner
            //=========================================================================
            string result;

            if (ticket.ITTicketLevel != null && ticket.ITTicketLevel != string.Empty)
            {
                //Get Current 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            currentuser = usersvc.GetUser();
                if (currentuser.Id.ToString() == "ADMIN       ")
                {
                    //Set it to the default Assigned to
                    result = GetField <string>("ASSIGNEDTOID", "EUROTICKETDEFAULTS", "");
                }
                else
                {
                    //Not the Admin User
                    result = Extentions.GetField <string>("ORIGINATORSECCODEID", "EUROXTICKETMAPPING", "USERID = '" + currentuser.Id.ToString() + "'");
                    if (result == null)
                    {
                        //Set it to the default Assigned to as there is no Origniator Team to be found.
                        result = GetField <string>("ASSIGNEDTOID", "EUROTICKETDEFAULTS", "");
                    }
                }
                Sage.Entity.Interfaces.IOwner MyOwner = Sage.Platform.EntityFactory.GetById <Sage.Entity.Interfaces.IOwner>(result);
                ticket.Owner = MyOwner;
                ticket.Save();
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        ChangePasswordOptions options = ChangePasswordOptions.CreateNew();

        // this check necessary to allow creation of new instance every postback (known bug),
        // but allowing UI changes
        if (string.IsNullOrEmpty(_newPassword.Text))
        {
            _newPassword.Text     = options.NewPassword; // default is empty
            _confirmPassword.Text = options.NewPassword; // default is empty
        }
        //}
        slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as Sage.SalesLogix.Security.SLXUserService;
        curUser        = slxUserService.GetUser().Id.ToString();

        if (curUser.ToString().Trim() != "ADMIN")
        {
            lblUser.Visible   = false;
            this.User.Visible = false;
            PrefsPasswordHelpLink.NavigateUrl = "prefspass.aspx";
        }
        else
        {
            PrefsPasswordHelpLink.NavigateUrl = "prefspassadmin.aspx";
            if (this.User.LookupResultValue == null)
            {
                this.User.LookupResultValue = curUser;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        ChangePasswordOptions options = ChangePasswordOptions.CreateNew();

        // this check necessary to allow creation of new instance every postback (known bug),
        // but allowing UI changes
        if (string.IsNullOrEmpty(_newPassword.Text))
        {
            _newPassword.Text = options.NewPassword;  // default is empty
            _confirmPassword.Text = options.NewPassword;  // default is empty
        }
        //}
        slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Security.IUserService>() as Sage.SalesLogix.Security.SLXUserService;
         curUser = slxUserService.GetUser().Id;

             if (curUser.ToString().Trim() != "ADMIN")
             {
                 lblUser.Visible = false;
                 this.User.Visible = false;
                 PrefsPasswordHelpLink.NavigateUrl = "prefspass.aspx";
             }
             else
             {
                 PrefsPasswordHelpLink.NavigateUrl = "prefspassadmin.aspx";
                 if (this.User.LookupResultValue == null)
                 {
                     this.User.LookupResultValue = curUser;

                 }
             }
    }
Exemplo n.º 5
0
 public static void EuroGetTicketOriginatorTeam(ITicket ticket, out String result)
 {
     //Get Current 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            currentuser = usersvc.GetUser();
     if (currentuser.Id.ToString() == "ADMIN       ")
     {
         //Set it to the default Assigned to
         result = GetField <string>("ASSIGNEDTOID", "EUROTICKETDEFAULTS", "");
     }
     else
     {
         //Not the Admin User
         result = Extentions.GetField <string>("ORIGINATORSECCODEID", "EUROXTICKETMAPPING", "USERID = '" + currentuser.Id.ToString() + "'");
         if (result == null)
         {
             //Set it to the default Assigned to as there is no Origniator Team to be found.
             result = GetField <string>("ASSIGNEDTOID", "EUROTICKETDEFAULTS", "");
         }
     }
 }
Exemplo n.º 6
0
    private void SetInsertDefaults()
    {
        if (Activity.ActivityId == "")
        {
            Sage.SalesLogix.Security.SLXUserService slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as Sage.SalesLogix.Security.SLXUserService;
            if (slxUserService != null)
            {
                string currentUserID = slxUserService.GetUser().Id.ToString();  // store the Current UserID in the Group context object

                Activity.CreateUser = currentUserID;
                Activity.ModifyUser = currentUserID;
                Activity.UserId     = currentUserID;
                Activity.Attendees.Add(currentUserID);
            }

            FollowUp.SelectedValue       = GetLocalResourceObject("Const_None").ToString();
            CarryOverNotes.Checked       = true;
            CarryOverAttachments.Checked = true;

            SetTacoDefaults();
        }
    }
    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
        }
    }