Example #1
0
        public StatementOfAccountModel EntityToModel(StatementOfAccount entity)
        {
            StatementOfAccountModel model = new StatementOfAccountModel();

            if (entity != null)
            {
                model.StatementOfAccountId          = entity.StatementOfAccountId;
                model.StatementOfAccountNo          = entity.StatementOfAccountNo;
                model.StatementOfAccountDate        = entity.StatementOfAccountDate;
                model.StatementOfAccountPeriodFrom  = entity.StatementOfAccountPeriodFrom;
                model.StatementOfAccountPeriodUntil = entity.StatementOfAccountPeriodUntil;
                model.CompanyId  = entity.CompanyId;
                model.Company    = entity.Company;
                model.SoaDueDate = entity.SoaDueDate;
                model.CiNo       = entity.CiNo;
                model.Remarks    = entity.Remarks;
                //StatementOfAccountPrints = entity.StatementOfAccountPrints,
                model.CreatedBy    = entity.CreatedBy;
                model.CreatedDate  = entity.CreatedDate;
                model.ModifiedBy   = entity.ModifiedBy;
                model.ModifiedDate = entity.ModifiedDate;
                model.RecordStatus = entity.RecordStatus;
                if (model.CompanyId != null || model.CompanyId == Guid.Empty)
                {
                    model.CompanyAccountNoBarcode = BarcodeGenerator.GetBarcode(model.Company.AccountNo);
                }

                model.StatementOfAccountNoBarcode = BarcodeGenerator.GetBarcode(model.StatementOfAccountNo);
            }

            return(model);
        }
Example #2
0
        /// <summary>
        /// Update SOA with SOANo
        /// Generate PDF and store to file system
        /// Finalized SOA are non-editable
        /// </summary>
        /// <param name="entity"></param>
        public StatementOfAccountModel Finalize(StatementOfAccountModel model)
        {
            Logs.AppLogs(LogPath, "SOA BL - Finalize");
            StatementOfAccount entity = base.GetById(model.StatementOfAccountId);

            if (entity != null && string.IsNullOrEmpty(entity.StatementOfAccountNo))
            {
                //entity.StatementOfAccountNoInt = GetNewSoaNo(entity.StatementOfAccountId);
                entity.ModifiedBy   = model.ModifiedBy;
                entity.ModifiedDate = DateTime.Now;
                try
                {
                    base.Edit(entity);
                    //model.StatementOfAccountNo = entity.StatementOfAccountNo;
                    model.StatementOfAccountNoBarcode = BarcodeGenerator.GetBarcode(model.StatementOfAccountNo);
                    model.ModifiedDate = entity.ModifiedDate;
                    Logs.AppLogs(LogPath, "SOA BL - Finalize", "Successfull");
                }
                catch (Exception ex)
                {
                    Logs.ErrorLogs(LogPath, "SOA BL - Finalize", ex.Message);
                }
            }
            return(model);
        }