public void LoadData() { base.LoadData(); ApasConfigurationManager cfg=new ApasConfigurationManager(); AdoNetManager db = new AdoNetManager("APAS_Regular"); db.ClearParameters(); db.objCmd.Parameters.Clear(); db.objCmd.Parameters.Add( "@id", SqlDbType.Int).Value = Id; DataTable tbl = db.queryTable( " SELECT * FROM APAS_Regular " + " WHERE intIdRegular = @id "); if (tbl.Rows.Count > 0) { ColorCode = (string)tbl.Rows[0]["strColorCodeRegular"]; } else { //if base regular exists and extended APAS_Regular does not //exist, assume null for ColorCode ColorCode = cfg.getConfigValue("DefaultClassColor"); //throw new ApasDatabaseException // ("Requested Regular record is not found."); } }
protected void btnSave_Click(object sender, EventArgs e) { ApasConfigurationManager cfg = new ApasConfigurationManager(); cfg.changeConfigValue("PaymentAdviceTemplateCFee", txtPaymentAdviceCFee.Text); cfg.changeConfigValue("PaymentAdviceTemplateOFee", txtPaymentAdviceOFee.Text); cfg.changeConfigValue("DefaultNewColor", ddlNew.Value); cfg.changeConfigValue("DefaultWithdrawnColor", ddlWithdrawn.Value); cfg.changeConfigValue("DefaultClassColor", ddlClass.Value); lblMessage.Text = "Save Successful"; }
protected void Page_Load(object sender, EventArgs e) { //SECURITY CHECK HERE //LOCK CHECK HERE if (Page.IsPostBack) return; ApasConfigurationManager cfg = new ApasConfigurationManager(); cfg.initConfigCollection(); txtPaymentAdviceCFee.Text = cfg.getConfigValue("PaymentAdviceTemplateCFee"); txtPaymentAdviceOFee.Text = cfg.getConfigValue("PaymentAdviceTemplateOFee"); ddlNew.Value = cfg.getConfigValue("DefaultNewColor"); ddlWithdrawn.Value = cfg.getConfigValue("DefaultWithdrawnColor"); ddlClass.Value = cfg.getConfigValue("DefaultClassColor"); }
public virtual void ComputeDynamicFields(PaymentAdvice parent) { ApasConfigurationManager cfg = new ApasConfigurationManager(); decimal deviationTotal = 0; PayableFee=Amount; foreach (FeeDeviationPayableFee objFD in FeeDeviations.Values) { //objFD returns exact amount. round it before adding to total deviationTotal += MyUtils.FormatCurrencyWithRounding(objFD.ComputeNetDeviation(0));//dummy zero, type is "fixed" } PayableFee += deviationTotal; BCStudent student = new BCStudent(); student.Id = parent.IdStudent ; student.loadData(); PaymentAdviceText = cfg.getConfigValue("PaymentAdviceTemplateOFee"); //get Config paymentadvice Text template and fill PaymentAdviceText PaymentAdviceText = PaymentAdviceText .Replace("[Name]", student.FullName) .Replace("[Amount]", String.Format("{0:C}", Amount)) .Replace("[Payable Fee]", String.Format("{0:C}", PayableFee)) .Replace("[Fee Deviation Total]", String.Format("{0:C}", deviationTotal)) .Replace("[Private Remarks]", PrivateRemark) .Replace("[Public Remarks]", PublicRemark) .Replace("[Month]", parent.GetParentPAList().Month.ToString("MMMM")) .Replace("[Year]", parent.GetParentPAList().Month.ToString("yyyy")) .Replace("[Type]", OtherFeeType.Name); }
//need not load this directly. always load through PaymentAdvice ///// <summary> ///// constructor to load from database ///// </summary> ///// <param name="key">primary key value of ClassFee</param> //public ClassFee(long key) //{ // Load(key, false); //} /// <summary> /// constructor to create "new" ClassFee /// </summary> /// <param name="parentPaymentAdvice"></param> /// <param name="pIdRegular"></param> public ClassFee(PaymentAdvice parentPaymentAdvice, int pIdRegular) { if (parentPaymentAdvice == null) throw new ApasInvaidOperationException( "Invalid Operation: Unable to create a classfee without " + "a vailid parent PaymentAdvice."); if (pIdRegular < 0) throw new ApasInvaidOperationException( "Invalid Operation: Unable to create a classfee without " + "a vailid regular class."); IdRegular = pIdRegular; Id = 0; Absence = 0; Prorate = 0; Makeup = 0; Forfeit = 0; Credit = 0; CreditAdjustment = 0; NextMonthCredit = 0; PayableCredit = 0; PerLessonFee = 0; PayableFee = 0; PrivateRemark = null; PublicRemark = null; PaymentAdviceText = null; IsExcluded = 0; ApasConfigurationManager cfg=new ApasConfigurationManager(); ColorCode = cfg.getConfigValue("DefaultNewColor"); Status = ClassFeeStatus.ClassFeeStatusDictionary["New: Unapproved"]; FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>(); parentPaymentAdvice.AddClassFee(this); }
public virtual void ComputeDynamicFields(PaymentAdvice parent) { ApasConfigurationManager cfg=new ApasConfigurationManager(); decimal deviationTotal=0; PayableCredit=NextMonthCredit -Credit +CreditAdjustment; PayableFee=PerLessonFee*PayableCredit; foreach(FeeDeviationPayableFee objFD in FeeDeviations.Values) { //objFD returns exact amount. round it before adding to total deviationTotal += MyUtils.FormatCurrencyWithRounding(objFD.ComputeNetDeviation(PayableFee)); } PayableFee += deviationTotal; PayableFee = MyUtils.FormatCurrencyWithRounding(PayableFee); //get Config paymentadvice Text template and fill PaymentAdviceText PaymentAdviceText = cfg.getConfigValue("PaymentAdviceTemplateCFee"); BCStudent student = new BCStudent(); student.Id = parent.IdStudent; student.loadData(); ApasRegular regClass = GetAssociatedClass(); PaymentAdviceText = PaymentAdviceText .Replace("[Name]", student.FullName) .Replace("[Subject]", regClass.GetSubject().name) .Replace("[Level]", regClass.getLevel().Name) .Replace("[Time Start]", regClass.TimeStart.ToString("hh:mm tt")) .Replace("[Time End]", regClass.TimeEnd.ToString("hh:mm tt")) .Replace("[Day]", regClass.Day) .Replace("[Absence]", Convert.ToString(Absence)) .Replace("[Prorate]", Convert.ToString(Prorate)) .Replace("[Makeup]", Convert.ToString(Makeup)) .Replace("[Forfeit]", Convert.ToString(Forfeit)) .Replace("[Credit]", Convert.ToString(Credit)) .Replace("[Payable Credit]", Convert.ToString(PayableCredit)) .Replace("[Next Mth Lessons]", Convert.ToString(NextMonthCredit)) .Replace("[Credit Adjustment]", Convert.ToString(CreditAdjustment)) .Replace("[Per Lesson Fee]", String.Format("{0:C}", PerLessonFee)) .Replace("[Fee Deviation Total]", String.Format("{0:C}", deviationTotal)) .Replace("[Payable Fee]", String.Format("{0:C}", PayableFee)) .Replace("[Private Remarks]", PrivateRemark) .Replace("[Public Remarks]", PublicRemark) .Replace("[Month]", parent.GetParentPAList().Month.ToString("MMMM")) .Replace("[Year]", parent.GetParentPAList().Month.ToString("yyyy")); }
/// <summary> /// Create "new" ClassFee from a template previoius ClassFee /// </summary> /// <param name="parentPaymentAdvice">Parent PaymentAdvice: must assign to create ClassFee</param> /// <param name="prevClassFee">Template previous ClassFee to copy necessary fields from</param> public ClassFee(PaymentAdvice parentPaymentAdvice, ClassFee prevClassFee) { ApasConfigurationManager cfg = new ApasConfigurationManager(); if (parentPaymentAdvice == null) throw new ApasInvaidOperationException( "Invalid Operation: Unable to create a ClassFee without " + "a vailid parent PaymentAdvice."); if (prevClassFee == null || prevClassFee.Validate().Count>0) throw new ApasInvaidOperationException( "Invalid Operation: Unable to create a ClassFee. Given " + "ClassFee template is not valid."); IdRegular = prevClassFee.IdRegular; Id = 0; PrivateRemark = prevClassFee.PrivateRemark; PublicRemark = prevClassFee.PublicRemark; ColorCode = prevClassFee.ColorCode ; Absence = 0; Prorate = 0; Makeup = 0; Forfeit = 0; Credit = 0; CreditAdjustment = 0; NextMonthCredit = 0; PayableCredit = 0; PerLessonFee = 0; PayableFee = 0; PaymentAdviceText = null; IsExcluded = 0; FeeDeviations = new Dictionary<int, FeeDeviationPayableFee>(); if (prevClassFee.Status.Name == "Withdrawn: Unapproved" || prevClassFee.Status.Name == "Withdrawn: Approved") { Status = ClassFeeStatus.ClassFeeStatusDictionary["New: Unapproved"]; ColorCode = cfg.getConfigValue("DefaultNewColor"); } else Status = ClassFeeStatus.ClassFeeStatusDictionary["Normal"]; parentPaymentAdvice.AddClassFee(this); Save(); foreach (FeeDeviationPayableFee fd in prevClassFee.FeeDeviations.Values) { if (fd.IsRecurring == 1) { FeeDeviationPayableFee newFD = new FeeDeviationPayableFee(this, fd); newFD.Save(); } } }