Exemplo n.º 1
0
        private bool Data_Changed(BuilderAllocation current)
        {
            if (Allocation_Amount_Formatted != current.Allocation_Amount_Formatted)
            {
                return(true);
            }

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

            return(false);
        }
Exemplo n.º 2
0
        public bool Update(string Username)
        {
            if (!Id.HasValue)
            {
                return(Save(Username));
            }
            var current = BuilderAllocation.Get(Agreement_Number, Id.Value);

            if (current == null)
            {
                return(false);
            }
            if (Data_Changed(current))
            {
                string s = "";
                if (Allocation_Amount_Formatted != current.Allocation_Amount_Formatted)
                {
                    s         = Constants.Create_Audit_Log(Username, "Amount Allocated", current.Allocation_Amount_Formatted, Allocation_Amount_Formatted);
                    Audit_Log = s + '\n' + current.Audit_Log;
                }

                if (Builder_Name != current.Builder_Name)
                {
                    s         = Constants.Create_Audit_Log(Username, "Builder Name", current.Builder_Name, Builder_Name);
                    Audit_Log = s + '\n' + current.Audit_Log;
                }

                string query = @"
        UPDATE ImpactFees_Builder_Allocations 
          SET 
            Amount_Allocated=@Allocation_Amount,
            Builder_Name=@Builder_Name,
            Audit_Log=@Audit_Log
          WHERE 
            Id=@Id";
                return(Constants.Save_Data <BuilderAllocation>(query, this));
            }
            else
            {
                return(true);
            }
        }