public OtherFeeView ConvertOtherFee(OtherFee input) { OtherFeeView output = new OtherFeeView(); output.Amount = input.Amount; output.ColorCode = input.ColorCode; output.FeeDeviations = new ArrayList(); foreach (FeeDeviationPayableFee objFD in input.FeeDeviations.Values) { FeeDeviationPayableFeeView newFD = ConvertFeeDeviationPayableFee(objFD, 0); //zero is dummy, otherfees can only have "fixed" fee deviations output.FeeDeviations.Add(newFD); } output.Id = input.Id; output.IdPaymentAdvice = input.IdPaymentAdvice; output.IsExcluded = (input.IsExcluded==1); output.IsPaid = (input.IsPaid==1); output.IsRecurring = (input.IsRecurring==1); output.OtherFeeType = input.OtherFeeType.Name.Trim(); output.PayableFee = input.PayableFee; output.PaymentAdviceText = input.PaymentAdviceText; output.PrivateRemark = (input.PrivateRemark == null) ? "" : input.PrivateRemark; output.PublicRemark = (input.PublicRemark == null) ? "" : input.PublicRemark ; return output; }
public void UpdateOtherFee(OtherFeeView obj) { //SECURITY CHECK HERE if (_CurrentPaymentAdvice == null) throw new ApasInvaidOperationException( "Invalid Operation: Select a payment advice before updating its properties"); OtherFee tempOF; if (_CurrentPaymentAdvice.OtherFees.TryGetValue( obj.Id, out tempOF)) { //read the values first tempOF.ColorCode = obj.ColorCode; tempOF.Amount = obj.Amount; tempOF.IsExcluded = obj.IsExcluded ? 1 : 0; tempOF.IsPaid = obj.IsPaid ? 1 : 0; tempOF.IsRecurring = obj.IsRecurring ? 1 : 0; tempOF.PrivateRemark = obj.PrivateRemark; tempOF.PublicRemark = obj.PublicRemark; //Validations List<string> eList; eList = _CurrentPaymentAdvice.Validate(); if (eList.Count > 0) throw new ApasValidationException( "Validation Error: Unable to save payment advice because " + "it is not valid. ", eList); eList = tempOF.Validate(); if (eList.Count > 0) throw new ApasValidationException( "Validation Error: Unable to save payment advice because " + "one of its other fees is not valid. ", eList); //syncing, locking to be done *ATTENTION* tempOF.ComputeDynamicFields(_CurrentPaymentAdvice); //save tempOF.Save(); //log _CurrentPaymentAdvice.LastAction = "Edit OtherFee"; _CurrentPaymentAdvice.LastModifiedBy = ApasAccessControlManager.GetCurrentInstance().LogonUser.Id; _CurrentPaymentAdvice.LastModifiedTime = DateTime.Now; _CurrentPaymentAdvice.Save(); } }
public OtherFeeView UpdateOtherFee(OtherFeeView obj, string lockKey) { //ClassFeeView obj =(ClassFeeView) AjaxPro.JavaScriptDeserializer.DeserializeFromJson(jsonString, typeof(ClassFeeView)); PaymentAdviceManager pMgr = new PaymentAdviceManager(obj.IdPaymentAdvice, lockKey); pMgr.UpdateOtherFee(obj); return pMgr.GetOtherFee(obj.Id); }