コード例 #1
0
        public override Tuple <CallContext, string> UserControlSave()
        {
            OfferProducitivity offerProducitivity = this.ownerPage.CostCalculationRef.GetOfferProducitivityByOfferID(this.CurrentEntityMasterID);



            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;

            if (offerProducitivity != null)
            {
                KeyValue kvSelectPress, kvPackaging;

                kvSelectPress = this.ownerPage.GetKeyValueByID(offerProducitivity.idPress);
                kvPackaging   = this.ownerPage.GetKeyValueByIntCode("CostCenter", "Packaging");



                offerProducitivity.PressProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(this.tbxPressProducitivity_KG_MH.Text);


                if (offerProducitivity.PressProducitivity_KG_MH > BaseHelper.ConvertToDecimalOrZero(kvSelectPress.DefaultValue3))
                {
                    offerProducitivity.PressProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(kvSelectPress.DefaultValue3);

                    this.tbxPressProducitivity_KG_MH.Text = offerProducitivity.PressProducitivity_KG_MH.ToStringNotFormatted();
                }


                offerProducitivity.PressProducitivity_TON_MH = offerProducitivity.PressProducitivity_TON_MH_Computable;

                offerProducitivity.COMetalProducitivity_KG_MH  = offerProducitivity.PressProducitivity_KG_MH; //Productivity for QC and COMETAL is equal to productivity for press
                offerProducitivity.COMetalProducitivity_TON_MH = offerProducitivity.COMetalProducitivity_TON_MH_Computable;

                offerProducitivity.QCProducitivity_KG_MH  = offerProducitivity.PressProducitivity_KG_MH;      //Productivity for QC and COMETAL is equal to productivity for press
                offerProducitivity.QCProducitivity_TON_MH = offerProducitivity.QCProducitivity_TON_MH_Computable;

                offerProducitivity.PackagingProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(this.tbxPackagingProducitivity_KG_MH.Text);

                if (offerProducitivity.PackagingProducitivity_KG_MH > BaseHelper.ConvertToDecimalOrZero(kvPackaging.DefaultValue3))
                {
                    offerProducitivity.PackagingProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(kvPackaging.DefaultValue3);

                    this.tbxPackagingProducitivity_KG_MH.Text = offerProducitivity.PackagingProducitivity_KG_MH.ToStringNotFormatted();;
                }


                offerProducitivity.PackagingProducitivity_TON_MH = offerProducitivity.PackagingProducitivity_TON_MH_Computable;



                this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.OfferProducitivitySave(offerProducitivity, this.ownerPage.CallContext);
            }



            this.lbResultContext.Text = this.ownerPage.CallContext.Message;
            if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success)
            {
                this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID;
            }

            CheckIfResultIsSuccess();



            return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("OfferMain_Data")));
        }
コード例 #2
0
        private void AddCustomSearchCriterias(ICollection <AbstractSearch> searchCriteria)
        {
            if (this.ddlCostCenter.SelectedValue != Constants.INVALID_ID_STRING)
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.Equal,
                    Property   = "idCostCenter",
                    SearchTerm = this.ddlCostCenter.SelectedValueINT
                });
            }
            if (this.ddlProfileSetting.SelectedValue != Constants.INVALID_ID_STRING)
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.Equal,
                    Property   = "idProfileSetting",
                    SearchTerm = this.ddlProfileSetting.SelectedValueINT
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfHoursFrom.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.GreaterOrEqual,
                    Property   = "SumOfHours",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfHoursFrom.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfHoursTo.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.LessOrEqual,
                    Property   = "SumOfHours",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfHoursTo.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfConsumptionFrom.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.GreaterOrEqual,
                    Property   = "SumOfConsumption",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfConsumptionFrom.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfConsumptionTo.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.LessOrEqual,
                    Property   = "SumOfConsumption",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfConsumptionTo.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfProductionFrom.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.GreaterOrEqual,
                    Property   = "SumOfProduction",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfProductionFrom.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfProductionTo.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.LessOrEqual,
                    Property   = "SumOfProduction",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfProductionTo.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxProductivityKGhFrom.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.GreaterOrEqual,
                    Property   = "ProductivityKGh",
                    SearchTerm = Convert.ToDecimal(this.tbxProductivityKGhFrom.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxSumOfProductionTo.Text))
            {
                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.LessOrEqual,
                    Property   = "ProductivityKGh",
                    SearchTerm = Convert.ToDecimal(this.tbxSumOfProductionTo.Text)
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxScrapRateFrom.Text))
            {
                decimal scrapRate = BaseHelper.ConvertToDecimalOrZero(this.tbxScrapRateFrom.Text, 9) / 100;

                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.GreaterOrEqual,
                    Property   = "ScrapRate",
                    SearchTerm = scrapRate
                });
            }
            if (!string.IsNullOrWhiteSpace(this.tbxScrapRateTo.Text))
            {
                decimal scrapRate = BaseHelper.ConvertToDecimalOrZero(this.tbxScrapRateTo.Text, 9) / 100;

                searchCriteria.Add(
                    new NumericSearch
                {
                    Comparator = NumericComparators.LessOrEqual,
                    Property   = "ScrapRate",
                    SearchTerm = scrapRate
                });
            }
        }