コード例 #1
0
        private bool Data_Changed(PermitAllocation current)
        {
            if (Builder_Id != current.Builder_Id)
            {
                return(true);
            }

            if (Amount_Allocated_Formatted != current.Amount_Allocated_Formatted)
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
        public List <string> ValidateImpactFeeCredits()
        {
            List <string> errors = new List <string>();

            Permit_Number = Permit_Number.Trim();
            var current = PermitAllocation.Get(Permit_Number);
            var pif     = PermitImpactFee.Get(Permit_Number, "IFCR");

            if (pif.Error_Text.Length > 0)
            {
                errors.Add(pif.Error_Text);
            }
            if (current.Permit_Number.Length == 0)
            {
                // the checks we perform in this block are for
                // new credits only
                if (pif.Cashier_Id.Length > 0)
                {
                    errors.Add("This fee has already been paid, so it is not eligible for the impact fee credit process.");
                }
            }
            if (Builder_Id < 0)
            {
                errors.Add("The Builder Id provided was invalid.");
            }
            if (Permit_Number.Length == 0)
            {
                errors.Add("No Permit Number was specified.");
            }
            if (Permit_Number.Length != 8)
            {
                errors.Add("Permit Number was not 8 digits.");
            }
            if (Amount_Allocated < 0)
            {
                errors.Add("The Amount Allocated cannot be a negative number.");
            }
            return(errors);
        }
コード例 #3
0
        public bool Update(Models.UserAccess ua, string IpAddress)
        {
            var current = PermitAllocation.Get(Permit_Number);

            if (current == null)
            {
                return(false);                // some kind of error occurred while getting the current permit data.
            }
            if (current.Audit_Log.Length > 0) // this record already exists
            {
                if (!Data_Changed(current))
                {
                    return(true);                // if the data doesn't change, we don't need to do anything.
                }
                string s = "";
                if (Amount_Allocated_Formatted != current.Amount_Allocated_Formatted)
                {
                    // If the amount changes, we will also need to reapply the credit
                    // to the ccCashierItem table.
                    s         = Constants.Create_Audit_Log(ua.user_name, "Amount Allocated", current.Amount_Allocated_Formatted, Amount_Allocated_Formatted);
                    Audit_Log = s + '\n' + current.Audit_Log;
                }

                if (Builder_Id != current.Builder_Id)
                {
                    // we're going to get all of the combined allocation data now
                    // in order to create a proper audit log
                    var data           = CombinedAllocation.Get();
                    var currentBuilder = (from d in data
                                          where d.Builder_Id == current.Builder_Id
                                          select d).First();

                    var newBuilder = (from d in data
                                      where d.Builder_Id == Builder_Id
                                      select d).First();
                    // check to see if the builder name changed here
                    var currentBuilderName = currentBuilder.Builder_Name + " (" + currentBuilder.Builder_Id + ")";
                    var newBuilderName     = newBuilder.Builder_Name + " (" + newBuilder.Builder_Id + ")";
                    s         = Constants.Create_Audit_Log(ua.user_name, "Builder", currentBuilderName, newBuilderName);
                    Audit_Log = s + '\n' + current.Audit_Log;

                    // check to see if the agreement changed
                    if (currentBuilder.Agreement_Number != newBuilder.Agreement_Number)
                    {
                        s         = Constants.Create_Audit_Log(ua.user_name, "Agreement Number", currentBuilder.Agreement_Number, newBuilder.Agreement_Number);
                        Audit_Log = s + '\n' + current.Audit_Log;
                    }
                }
            }
            else // this is a new permit number
            {
                Audit_Log = Constants.Create_Audit_Log(ua.user_name, "Record Created");
                // will also need to apply the credit.
            }
            if (!SaveAllocation())
            {
                return(false);
            }
            var permit = PermitImpactFee.Get(Permit_Number, "IFCR");

            if (!permit.ItemId.HasValue)
            {
                return(false);
            }
            if (permit.ImpactFee_Amount < this.Amount_Allocated)
            {
                // This is a partial impact fee credit.
                // Those credits are applied when the remainder is paid.
                return(true);
            }
            return(ApplyCreditPayment(permit, IpAddress, ua));
        }