Ejemplo n.º 1
0
        public CallContext ProfileSettingSave(ProfileSetting entity, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.ProfilesSave;
            CallContext resContext = new ProfileSettingBL().EntitySave <ProfileSetting>(entity, resultContext);

            return(resContext);
        }
Ejemplo n.º 2
0
        public List<string> ValidateEntity(CallContext outputContext)
        {
            List<string> result = new List<string>();

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ValidationErrorsAsString = string.Empty;

          
            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            //if (string.IsNullOrEmpty(this.InquiryNumber))
            //{
            //    result.Add("The field `InquiryNumber` is required!");
            //}

            if (this.OfferDate == DateTime.MinValue)
            {
                result.Add("The field `Date` is required!");
            }


            if (string.IsNullOrEmpty(this.Customer))
            {
                result.Add("The field `Customer` is required!");
            }

            if (!this.idProfileSetting.HasValue)
            {
                result.Add("The field `Profile` is required!");
            }


            if (!this.idNumberOfCavities.HasValue)
            {
                result.Add("The field `Number of cavities` is required!");
            }

            if (!this.LME.HasValue)
            {
                result.Add("The field `LME` is required!");
            }

            if (!this.PREMIUM.HasValue)
            {
                result.Add("The field `PREMIUM` is required!");
            }


            if (!this.idProfileSetting.HasValue)
            {
                result.Add("The field `Profile` is required!");
            }


            if (this.idProfileSetting.HasValue)
            {
                ProfileSetting profileSetting = new ProfileSettingBL().GetEntityById(this.idProfileSetting.Value);

                if (profileSetting.hasA && !this.ValueForA.HasValue)
                {
                    result.Add("The field `Value for A (mm)` is required!");
                }

                if (profileSetting.hasB && !this.ValueForB.HasValue)
                {
                    result.Add("The field `Value for B (mm)` is required!");
                }

                if (profileSetting.hasC && !this.ValueForC.HasValue)
                {
                    result.Add("The field `Value for C (mm)` is required!");
                }

                if (profileSetting.hasD && !this.ValueForD.HasValue)
                {
                    result.Add("The field `Value for D (mm)` is required!");
                }

                if (profileSetting.hasS && !this.ValueForS.HasValue)
                {
                    result.Add("The field `Value for S (mm)` is required!");
                }


            }


            if (!this.LME.HasValue)
            {
                result.Add("The field `LME` is required!");
            }


            if (this.LME.HasValue && this.LME.Value == decimal.MinValue)
            {
                result.Add("The field `LME` is required and should be equal or bigger than zero!");
            }



            if (!this.PREMIUM.HasValue)
            {
                result.Add("The field `PREMIUM` is required!");
            }


            if (this.PREMIUM.HasValue && this.PREMIUM.Value == decimal.MinValue)
            {
                result.Add("The field `PREMIUM` is required and should be equal or bigger than zero!");
            }


            this.ValidationErrorsAsString = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, result.ToArray());

            if (!string.IsNullOrEmpty(this.ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            if (result.Count > 0)
            {
                outputContext.EntityID = "";
            }
            else
            {
                outputContext.EntityID = this.EntityID.ToString();
            }


            return result;
        }
Ejemplo n.º 3
0
 public CallContext RemoveProfileSetting(List<ProfileSetting> list, CallContext callContext)
 {
     callContext.securitySettings = ETEMEnums.SecuritySettings.ProfilesSave;
     callContext = new ProfileSettingBL().RemoveProfileSetting(list, callContext);
     return callContext;
 }
Ejemplo n.º 4
0
        public CallContext ProfileSettingSave(ProfileSetting entity, CallContext resultContext)
        {
            resultContext.securitySettings  = ETEMEnums.SecuritySettings.ProfilesSave;
            CallContext resContext          = new ProfileSettingBL().EntitySave<ProfileSetting>(entity, resultContext);

            return resContext;
        }
Ejemplo n.º 5
0
        public List <string> ValidateEntity(CallContext outputContext)
        {
            List <string> result = new List <string>();

            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            ValidationErrorsAsString = string.Empty;


            outputContext.ResultCode = ETEMEnums.ResultEnum.Success;

            //if (string.IsNullOrEmpty(this.InquiryNumber))
            //{
            //    result.Add("The field `InquiryNumber` is required!");
            //}

            if (this.OfferDate == DateTime.MinValue)
            {
                result.Add("The field `Date` is required!");
            }


            if (string.IsNullOrEmpty(this.Customer))
            {
                result.Add("The field `Customer` is required!");
            }

            if (!this.idProfileSetting.HasValue)
            {
                result.Add("The field `Profile` is required!");
            }


            if (!this.idNumberOfCavities.HasValue)
            {
                result.Add("The field `Number of cavities` is required!");
            }

            if (!this.LME.HasValue)
            {
                result.Add("The field `LME` is required!");
            }

            if (!this.PREMIUM.HasValue)
            {
                result.Add("The field `PREMIUM` is required!");
            }


            if (!this.idProfileSetting.HasValue)
            {
                result.Add("The field `Profile` is required!");
            }


            if (this.idProfileSetting.HasValue)
            {
                ProfileSetting profileSetting = new ProfileSettingBL().GetEntityById(this.idProfileSetting.Value);

                if (profileSetting.hasA && !this.ValueForA.HasValue)
                {
                    result.Add("The field `Value for A (mm)` is required!");
                }

                if (profileSetting.hasB && !this.ValueForB.HasValue)
                {
                    result.Add("The field `Value for B (mm)` is required!");
                }

                if (profileSetting.hasC && !this.ValueForC.HasValue)
                {
                    result.Add("The field `Value for C (mm)` is required!");
                }

                if (profileSetting.hasD && !this.ValueForD.HasValue)
                {
                    result.Add("The field `Value for D (mm)` is required!");
                }

                if (profileSetting.hasS && !this.ValueForS.HasValue)
                {
                    result.Add("The field `Value for S (mm)` is required!");
                }
            }


            if (!this.LME.HasValue)
            {
                result.Add("The field `LME` is required!");
            }


            if (this.LME.HasValue && this.LME.Value == decimal.MinValue)
            {
                result.Add("The field `LME` is required and should be equal or bigger than zero!");
            }



            if (!this.PREMIUM.HasValue)
            {
                result.Add("The field `PREMIUM` is required!");
            }


            if (this.PREMIUM.HasValue && this.PREMIUM.Value == decimal.MinValue)
            {
                result.Add("The field `PREMIUM` is required and should be equal or bigger than zero!");
            }


            this.ValidationErrorsAsString = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, result.ToArray());

            if (!string.IsNullOrEmpty(this.ValidationErrorsAsString))
            {
                outputContext.ResultCode = ETEMEnums.ResultEnum.Error;
            }

            outputContext.Message = this.ValidationErrorsAsString;
            if (result.Count > 0)
            {
                outputContext.EntityID = "";
            }
            else
            {
                outputContext.EntityID = this.EntityID.ToString();
            }


            return(result);
        }
Ejemplo n.º 6
0
 public CallContext RemoveProfileSetting(List <ProfileSetting> list, CallContext callContext)
 {
     callContext.securitySettings = ETEMEnums.SecuritySettings.ProfilesSave;
     callContext = new ProfileSettingBL().RemoveProfileSetting(list, callContext);
     return(callContext);
 }