Пример #1
0
    /// <summary>
    /// Derived components should override this method to wire up event handlers.
    /// </summary>

    #endregion



    protected void cmdRemoveTemplate_Click1(object sender, EventArgs e)
    {
        Sage.Entity.Interfaces.IOpportunity _entity = BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;
        if (_entity != null)
        {
            if (_entity.OppFulFilTasks.Count > 0)
            {
                do
                {
                    foreach (Sage.Entity.Interfaces.IOppFulFilStage tmpStage in _entity.OppFulFilStages)
                    {
                        _entity.OppFulFilStages.Remove(tmpStage);
                        tmpStage.Delete();
                        _entity.Save();
                        break;
                    }
                } while (_entity.OppFulFilStages.Count > 0);

                do
                {
                    foreach (Sage.Entity.Interfaces.IOppFulFilTask tmpTask in _entity.OppFulFilTasks)
                    {
                        _entity.OppFulFilTasks.Remove(tmpTask);
                        tmpTask.Delete();
                        _entity.Save();
                        break;
                    }
                } while (_entity.OppFulFilTasks.Count > 0);
            }
        }
    }
Пример #2
0
 /// <summary>
 /// Loads the view.
 /// </summary>
 private void LoadView()
 {
     _OppFulfilmentTemplate = GetParentEntity() as IOpportunity;
     LoadGrid();
     LoadcomboBox();
     Sage.Entity.Interfaces.IOpportunity _entity = BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;
     if (_entity != null)
     {
         if (_entity.OppFulFilTasks.Count > 0)
         {
             ddlTemplates.Visible   = false;
             cmdAddTemplate.Visible = false;
         }
         else
         {
             ddlTemplates.Visible   = true;
             cmdAddTemplate.Visible = true;
         }
     }
     //Senior Opps
     if (IsMember("Senior Operations", "G"))
     {
         cmdRemoveTemplate.Visible = true;
     }
     else
     {
         cmdRemoveTemplate.Visible = false;
     }
 }
    private void GetFromValues()
    {
        Sage.Entity.Interfaces.IOpportunity entity = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;

        curFrom.ExchangeRate = entity.ExchangeRate.GetValueOrDefault(1);
        curFrom.CurrentCode  = entity.ExchangeRateCode;
        curFrom.Text         = entity.SalesPotential.ToString();
    }
    protected override void OnFormBound()
    {
        if (!blnGetValues)
        {
            base.OnFormBound();
            Sage.Entity.Interfaces.IOpportunity entity = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;

            lblOppCurRate.Text   = string.Format(GetLocalResourceObject("OppsCurrentRate_rsc").ToString(), entity.ExchangeRateCode, Convert.ToString(entity.ExchangeRate.GetValueOrDefault(1))).ToString();
            lblRateDate.Text     = string.Format(GetLocalResourceObject("RateAssignedOn_rsc").ToString(), Convert.ToString(entity.ExchangeRateDate.Value.ToShortDateString())).ToString();
            lveChangeRate.Text   = entity.ExchangeRateCode;
            txtExchangeRate.Text = Convert.ToString(entity.ExchangeRate.GetValueOrDefault(1));

            var  optionSvc   = ApplicationContext.Current.Services.Get <Sage.SalesLogix.Services.ISystemOptionsService>(true);
            bool lockOppRate = optionSvc.LockOpportunityRate;
            chkLockRate.Enabled = lockOppRate;
            bool changeOppRate = optionSvc.ChangeOpportunityRate;
            txtExchangeRate.Enabled = changeOppRate;
            chkLockRate.Checked     = entity.ExchangeRateLocked.Value;

            GetFromValues();
        }
    }
    protected void GetExchangeRate(object sender, EventArgs e)
    {
        Sage.Entity.Interfaces.IOpportunity entity = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;

        //IExchangeRate exchRate = lveChangeRate.LookupResultValue as IExchangeRate;
        IExchangeRate exchRate = EntityFactory.GetById <IExchangeRate>(lveChangeRate.LookupResultValue);

        if (exchRate != null)
        {
            txtExchangeRate.Text = exchRate.Rate.ToString();
            lblRateCurrent.Text  = string.Format(GetLocalResourceObject("ThisRateCurrent_rsc").ToString(), Convert.ToString(exchRate.ModifyDate.Value.ToShortDateString())).ToString();

            GetFromValues();

            curTo.ExchangeRate = exchRate.Rate.GetValueOrDefault(1);
            curTo.CurrentCode  = exchRate.Id.ToString();
            curTo.Text         = Convert.ToString(entity.SalesPotential);

            lveChangeRate.Text   = exchRate.Id.ToString();
            txtExchangeRate.Text = Convert.ToString(exchRate.Rate.GetValueOrDefault(1));
        }
        blnGetValues = true;
    }
    protected void SetLocked(object sender, EventArgs e)
    {
        Sage.Entity.Interfaces.IOpportunity entity = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;

        entity.ExchangeRateLocked = chkLockRate.Checked;
    }
        /// <summary>
        /// Invokes the association lookup for competitors.
        /// </summary>
        /// <param name="form">the instance of the OpportunityCompetitor dialog</param>
        /// <param name="args">empty</param>
        public static void lueAssociateCompetitor_OnChangeStep(IOpportunityCompetitors form, EventArgs args)
        {
            if (form.lueAssociateCompetitor.LookupResultValue != null)
            {
                Sage.Entity.Interfaces.IOpportunity parentEntity  = form.CurrentEntity as Sage.Entity.Interfaces.IOpportunity;
                Sage.Entity.Interfaces.ICompetitor  relatedEntity = form.lueAssociateCompetitor.LookupResultValue as Sage.Entity.Interfaces.ICompetitor;
                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 ((parentEntity != null) && (relatedEntity != null))
                {
                    // check for duplicates
                    bool found = false;
                    foreach (Sage.Entity.Interfaces.IOpportunityCompetitor oc in parentEntity.Competitors)
                    {
                        if (oc.Competitor == relatedEntity)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        if (smartpart != null && smartpart.DialogService != null)
                        {
                            string msg = string.Format(form.GetResource("DuplicateCompetitorMsg").ToString(), relatedEntity.CompetitorName);
                            smartpart.DialogService.ShowMessage(msg, form.GetResource("DuplicateCompetitorMsgTitle").ToString());
                        }
                    }
                    else
                    {
                        Sage.Entity.Interfaces.IOpportunityCompetitor relationshipEntity = Sage.Platform.EntityFactory.Create <Sage.Entity.Interfaces.IOpportunityCompetitor>();
                        relationshipEntity.Opportunity = parentEntity;
                        relationshipEntity.Competitor  = relatedEntity;
                        parentEntity.Competitors.Add(relationshipEntity);
                        if (page.ModeId.ToUpper() != "INSERT")
                        {
                            parentEntity.Save();
                        }

                        if (smartpart.DialogService != null)
                        {
                            smartpart.DialogService.SetSpecs(0, 0, 400, 600, "EditOpportunityCompetitor", string.Empty, true);
                            smartpart.DialogService.EntityType = typeof(Sage.Entity.Interfaces.IOpportunityCompetitor);
                            string id = string.Empty;

                            smartpart.DialogService.CompositeKeyNames = "OpportunityId,CompetitorId";
                            id = string.Format("{0},{1}", relationshipEntity.OpportunityId, relationshipEntity.CompetitorId);
                            if (Sage.Platform.WebPortal.PortalUtil.ObjectIsNewEntity(relationshipEntity))
                            {
                                id = relationshipEntity.InstanceId.ToString();
                                Sage.Platform.ChangeManagement.ChangeManagementEntityFactory.RegisterInstance(relationshipEntity, relationshipEntity.InstanceId);

                                if (relationshipEntity != null && relatedEntity != null)
                                {
                                    relationshipEntity.SetOppCompetitorDefaults(relatedEntity);
                                }
                            }
                            smartpart.DialogService.EntityID = id;
                            smartpart.DialogService.ShowDialog();
                        }
                    }
                }
                form.lueAssociateCompetitor.LookupResultValue = null; //34026
            }
        }