Beispiel #1
0
 /// <summary>
 /// Gets the system info option.
 /// </summary>
 /// <param name="optionName">Name of the option.</param>
 /// <returns></returns>
 public static Boolean GetSystemInfoOption(String optionName)
 {
     SystemInformation systemInfo = SystemInformationRules.GetSystemInfo();
     DelphiStreamReader stream = new DelphiStreamReader(systemInfo.Data);
     TValueType valueType;
     if (stream.FindProperty(optionName, out valueType))
         return valueType.Equals(TValueType.vaTrue);
     return false;
 }
    protected override void OnFormBound()
    {
        object sender = this;
        EventArgs e = EventArgs.Empty;
        dtsProducts.Bind();

        SystemInformation si = SystemInformationRules.GetSystemInfo();
        DelphiStreamReader stream = new DelphiStreamReader(si.Data);
        TValueType type;
        if (stream.FindProperty("MultiCurrency", out type))
        {
            if (type.Equals(TValueType.vaTrue))
            {
                //grdProducts.Columns[7].Visible = true;
            }
            else
            {
                //grdProducts.Columns[7].Visible = false;
            }
        }

        string user = BusinessRuleHelper.GetCurrentUser().Id.ToString();
        grdProducts.Columns[10].Visible = (_roleSecurityService.HasAccess("Entities/Opportunity/Edit"));
        int team =0;
            using (NHibernate.ISession session = new Sage.Platform.Orm.SessionScopeWrapper())
            {
                string sql = "select count(*) from seccodejoins sj join seccode s on s.seccodeid=sj.parentseccodeid where sj.childseccodeid in (select defaultseccodeid from usersecurity where userid='"+user.ToString()+"') and s.seccodetype='G' and s.seccodedesc='Training'";
                team = session.CreateSQLQuery(sql).UniqueResult<int>();
            }

            if (team > 0 || user.ToString().Trim() == "ADMIN")
            {
                grdProducts.Columns[12].Visible = true;
            }
            else
            {
                grdProducts.Columns[12].Visible = false;
            }
        grdProducts.Columns[13].Visible = (_roleSecurityService.HasAccess("Entities/Opportunity/Edit"));

        base.OnFormBound();
    }
    protected override void OnFormBound()
    {
        object sender = this;
        EventArgs e = EventArgs.Empty;
        dtsProducts.Bind();

        SystemInformation si = SystemInformationRules.GetSystemInfo();
        DelphiStreamReader stream = new DelphiStreamReader(si.Data);
        TValueType type;
        if (stream.FindProperty("MultiCurrency", out type))
        {
            if (type.Equals(TValueType.vaTrue))
            {
                grdProducts.Columns[7].Visible = true;
            }
            else
            {
                grdProducts.Columns[7].Visible = false;
            }
        }

        base.OnFormBound();
    }
    /// <summary>
    /// Called when the smartpart has been bound.  Derived components should override this method to run code that depends on entity context being set and it not changing.
    /// </summary>
    protected override void OnFormBound()
    {
        base.OnFormBound();

        bool MC_On = false;

        SystemInformation si = SystemInformationRules.GetSystemInfo();
        DelphiStreamReader stream = new DelphiStreamReader(si.Data);
        TValueType type;
        if (stream.FindProperty("MultiCurrency", out type))
        {
            if (type.Equals(TValueType.vaTrue))
            {
                MC_On = true;
                GetCurrencyValues();
            }
            else
            {
                MC_On = false;
            }
        }

        IOpportunity entity = BindingSource.Current as IOpportunity;

        //Sets the text value for the link control from the hidden currency control.
        ActualAmountWon.Text = ActualAmount_Closed.FormattedText;

        if (entity == null) return;
        if (entity.Status == GetLocalResourceObject("Open_rsc").ToString())
        {
            Open.Style["display"] = "block";
            if (MC_On)
            {
                MC_Open.Style["display"] = "block";
                MC_Closed.Style["display"] = "none";
            }
            Closed_Value_Section.Style["display"] = "none";
            Closed_Summary_Section.Style["display"] = "none";
            Closed_Lost.Style["display"] = "none";
            Closed_Won.Style["display"] = "none";
            Closed_Remaining.Style["display"] = "none";
            Open_Summary.Style["display"] = "block";
        }
        else if (entity.Status == GetLocalResourceObject("ClosedWon_rsc").ToString())
        {
            Closed_Value_Section.Style["display"] = "block";
            if (MC_On)
            {
                MC_Open.Style["display"] = "none";
                MC_Closed.Style["display"] = "block";
            }
            Closed_Summary_Section.Style["display"] = "block";
            Closed_Won.Style["display"] = "block";
            Closed_Lost.Style["display"] = "none";
            Open.Style["display"] = "none";
            Closed_Remaining.Style["display"] = "block";
            Open_Summary.Style["display"] = "none";
        }
        else if (entity.Status == GetLocalResourceObject("ClosedLost_rsc").ToString())
        {
            Closed_Value_Section.Style["display"] = "block";
            if (MC_On)
            {
                MC_Open.Style["display"] = "none";
                MC_Closed.Style["display"] = "block";
            }
            Closed_Summary_Section.Style["display"] = "block";
            Closed_Lost.Style["display"] = "block";
            Closed_Won.Style["display"] = "none";
            Open.Style["display"] = "none";
            Closed_Remaining.Style["display"] = "block";
            Open_Summary.Style["display"] = "none";
        }
        else
        {
            Open.Style["display"] = "block";
            if (MC_On)
            {
                MC_Open.Style["display"] = "block";
                MC_Closed.Style["display"] = "none";
            }
            Closed_Value_Section.Style["display"] = "none";
            Closed_Summary_Section.Style["display"] = "none";
            Closed_Lost.Style["display"] = "none";
            Closed_Won.Style["display"] = "none";
            Closed_Remaining.Style["display"] = "none";
            Open_Summary.Style["display"] = "block";
        }

        if(ShowSalesProcessInfo(entity))
        {
            divSalesProcessInfo.Style["display"] = "block";
        }
        else
        {
            divSalesProcessInfo.Style["display"] = "none";
        }
        SetSendToEmailContext();
    }
    protected override void OnFormBound()
    {
        object sender = this;
        EventArgs e = EventArgs.Empty;
        dtsProducts.Bind();

        SystemInformation si = SystemInformationRules.GetSystemInfo();
        DelphiStreamReader stream = new DelphiStreamReader(si.Data);
        TValueType type;
        if (stream.FindProperty("MultiCurrency", out type))
        {
            if (type.Equals(TValueType.vaTrue))
            {
                grdProducts.Columns[7].Visible = true;
            }
            else
            {
                grdProducts.Columns[7].Visible = false;
            }
        }

        grdProducts.Columns[10].Visible = (_roleSecurityService.HasAccess("Entities/Opportunity/Edit"));
        grdProducts.Columns[11].Visible = (_roleSecurityService.HasAccess("Entities/Opportunity/Edit"));

        base.OnFormBound();
    }
    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));

            SystemInformation si = SystemInformationRules.GetSystemInfo();
            DelphiStreamReader stream = new DelphiStreamReader(si.Data);
            TValueType type;
            if (stream.FindProperty("LockOpportunityRate", out type))
            {
                if (type.Equals(TValueType.vaTrue))
                {
                    chkLockRate.Enabled = true;
                }
                else
                {
                    chkLockRate.Enabled = false;
                }
            }

            SystemInformation si2 = SystemInformationRules.GetSystemInfo();
            DelphiStreamReader stream2 = new DelphiStreamReader(si2.Data);
            TValueType type2;
            if (stream2.FindProperty("ChangeOpportunityRate", out type2))
            {
                if (type2.Equals(TValueType.vaTrue))
                {
                    txtExchangeRate.Enabled = true;
                }
                else
                {
                    txtExchangeRate.Enabled = false;
                }
            }
            chkLockRate.Checked = entity.ExchangeRateLocked.Value;

            GetFromValues();
        }
    }
 private bool GetMultiCurrency()
 {
     SystemInformation si = SystemInformationRules.GetSystemInfo();
     DelphiStreamReader stream = new DelphiStreamReader(si.Data);
     TValueType type;
     if (stream.FindProperty("MultiCurrency", out type))
     {
         return type.Equals(TValueType.vaTrue) ? true : false;
     }
     return false;
 }
    protected override void OnFormBound()
    {
        object sender = this;
         EventArgs e = EventArgs.Empty;
         dtsProducts.Bind();

         SystemInformation si = SystemInformationRules.GetSystemInfo();
         DelphiStreamReader stream = new DelphiStreamReader(si.Data);
         TValueType type;
         if (stream.FindProperty("MultiCurrency", out type))
         {
         if (type.Equals(TValueType.vaTrue))
         {
         grdProducts.Columns[7].Visible = true;
         }
         else
         {
         grdProducts.Columns[7].Visible = false;
         }
         }

         // TAC Code Here
         Sage.Entity.Interfaces.IOpportunity _entity = BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;
         if (_entity != null) {
         if (_entity.Status == "Closed - Lost" || _entity.Status == "Closed - Won") {
         //Set the Form as readOnly
         cmdAdd.Visible = false;
         grdProducts.Columns[10].Visible = false; //Edit
         grdProducts.Columns[11].Visible = false; //Delete

         } else {
         cmdAdd.Visible = true;
         grdProducts.Columns[10].Visible = true; //Edit
         grdProducts.Columns[11].Visible = true; //Delete

         }
         }

         base.OnFormBound();
    }