/// <summary> /// Takes the specified fixed asset ledger. /// </summary> /// <param name="fixedAssetLedger">The fixed asset ledger.</param> /// <returns>System.Object[][].</returns> private static object[] Take(OpeningFixedAssetEntryEntity openingFixedAssetEntryEntity) { return(new object[] { "@RefID", openingFixedAssetEntryEntity.RefId, "@RefType", openingFixedAssetEntryEntity.RefType, "@PostedDate", openingFixedAssetEntryEntity.PostedDate, "@CurrencyCode", openingFixedAssetEntryEntity.CurrencyCode, "@ExchangeRate", openingFixedAssetEntryEntity.ExchangeRate, "@FixedAssetID", openingFixedAssetEntryEntity.FixedAssetId, "@DepartmentID", openingFixedAssetEntryEntity.DepartmentId, "@BudgetChapterCode", openingFixedAssetEntryEntity.BudgetChapterCode, "@OrgPriceAccount", openingFixedAssetEntryEntity.OrgPriceAccount, "@OrgPriceDebitAmountOC", openingFixedAssetEntryEntity.OrgPriceDebitAmountOC, "@OrgPriceDebitAmount", openingFixedAssetEntryEntity.OrgPriceDebitAmount, "@DepreciationAccount", openingFixedAssetEntryEntity.DepreciationAccount, "@DepreciationCreditAmountOC", openingFixedAssetEntryEntity.DepreciationCreditAmountOC, "@DepreciationCreditAmount", openingFixedAssetEntryEntity.DepreciationCreditAmount, "@CapitalAccount", openingFixedAssetEntryEntity.CapitalAccount, "@CapitalCreditAmountOC", openingFixedAssetEntryEntity.CapitalCreditAmountOC, "@CapitalCreditAmount", openingFixedAssetEntryEntity.CapitalCreditAmount, "@SortOrder", openingFixedAssetEntryEntity.SortOrder, "@DevaluationCreditAmount", openingFixedAssetEntryEntity.DevaluationCreditAmount }); }
/// <summary> /// Updates the opening account entry. /// </summary> /// <param name="openingFixedAssetEntryEntity">The opening account entry entity.</param> /// <returns></returns> public string DeleteOpeningFixedAssetEntry(OpeningFixedAssetEntryEntity openingFixedAssetEntryEntity) { const string sql = @"uspDelete_OpeningFixedAssetEntry"; object[] parms = { "@RefID", openingFixedAssetEntryEntity.RefId }; return(Db.Delete(sql, true, parms)); }
/// <summary> /// Takes the specified opening account entry. /// </summary> /// <param name="openingAccountEntry">The opening account entry.</param> /// <returns></returns> private static object[] Take(OpeningFixedAssetEntryEntity openingAccountEntry) { return(new object[] { @"RefID", openingAccountEntry.RefId, @"RefNo", openingAccountEntry.RefNo, @"RefTypeID", openingAccountEntry.RefTypeId, @"PostedDate", openingAccountEntry.PostedDate, @"FixedAssetID", openingAccountEntry.FixedAssetId, @"DepartmentID", openingAccountEntry.DepartmentId, @"LifeTime", openingAccountEntry.LifeTime, @"IncrementDate", openingAccountEntry.IncrementDate, @"Unit", openingAccountEntry.Unit, @"UsedDate", openingAccountEntry.UsedDate, @"CurrencyCode", openingAccountEntry.CurrencyCode, @"ExchangeRate", openingAccountEntry.ExchangeRate, @"OrgPriceAccount", openingAccountEntry.OrgPriceAccount, @"OrgPriceDebitAmount", openingAccountEntry.OrgPriceDebitAmount, @"OrgPriceDebitAmountUSD", openingAccountEntry.OrgPriceDebitAmountUSD, @"DepreciationAccount", openingAccountEntry.DepreciationAccount, @"DepreciationCreditAmount", openingAccountEntry.DepreciationCreditAmount, @"DepreciationCreditAmountUSD", openingAccountEntry.DepreciationCreditAmountUSD, @"CapitalAccount", openingAccountEntry.CapitalAccount, @"CapitalCreditAmount", openingAccountEntry.CapitalCreditAmount, @"CapitalCreditAmountUSD", openingAccountEntry.CapitalCreditAmountUSD, @"RemainingAmount", openingAccountEntry.RemainingAmount, @"RemainingAmountUSD", openingAccountEntry.RemainingAmountUSD, @"BudgetChapterCode", openingAccountEntry.BudgetChapterCode, @"Description", openingAccountEntry.Description, @"Quantity", openingAccountEntry.Quantity, @"BudgetSourceCode", openingAccountEntry.BudgetSourceCode }); }
//private List<BankInfo> banks; public List <OpeningFixedAssetEntryEntity> GetOpeningFixedAssetEntrys(string connectionString) { List <OpeningFixedAssetEntryEntity> buentity = new List <OpeningFixedAssetEntryEntity>(); using (var context = new MISAEntity(connectionString)) { //var querry = context.OpeningFixedAssetEntryDetails.ToList(); //var projects = context.Projects.ToList(); //var currencys = context.CCies.ToList(); //var budgetsource = context.BudgetSources.ToList(); //var listitems = context.ListItems.ToList(); //var funds = context.Funds.ToList(); //var fundstructures = context.FundStructures.ToList(); //var budgetproviders = context.BudgetProvidences.ToList(); //var accountingobject = context.AccountingObjects.ToList(); //var projectexpenses = context.ProjectExpenses.ToList(); //var activity = context.Activities.ToList(); //var tasks = context.Tasks.ToList(); //var topics = context.Topics.ToList(); //banks = context.BankInfoes.ToList(); var department = context.Departments.ToList(); var resultcontext = context.OpeningFixedAssetEntries.ToList(); var fixedasset = context.FixedAssets.ToList(); //var inventoryitems = context.InventoryItems.ToList(); //var stocks = context.Stocks.ToList(); //var invoiceformnumber = context.InvoiceFormNumbers.ToList(); foreach (var result in resultcontext) { var newresult = new OpeningFixedAssetEntryEntity(); newresult.RefId = result.RefID.ToString(); newresult.RefType = result.RefType; newresult.PostedDate = result.PostedDate; newresult.CurrencyCode = result.CurrencyID; newresult.ExchangeRate = result.ExchangeRate ?? 0; newresult.FixedAssetId = result.FixedAsset == null ? null : result.FixedAsset.FixedAssetID.ToString(); newresult.DepartmentId = result.DepartmentID.ToString(); newresult.BudgetChapterCode = result.BudgetChapterCode; newresult.OrgPriceAccount = result.OrgPriceAccount; newresult.OrgPriceDebitAmountOC = result.OrgPriceDebitAmountOC ?? 0; newresult.OrgPriceDebitAmount = result.OrgPriceDebitAmount ?? 0; newresult.DepreciationAccount = result.DepreciationAccount; newresult.DepreciationCreditAmountOC = result.DepreciationCreditAmountOC ?? 0; newresult.DepreciationCreditAmount = result.DepreciationCreditAmount ?? 0; newresult.CapitalAccount = result.CapitalAccount; newresult.CapitalCreditAmountOC = result.CapitalCreditAmountOC ?? 0; newresult.CapitalCreditAmount = result.CapitalCreditAmount ?? 0; //newresult.e = result.EditVersion; //newresult.po = result.PostVersion; newresult.SortOrder = result.SortOrder ?? 0; newresult.DevaluationCreditAmount = result.DevaluationCreditAmount ?? 0; buentity.Add(newresult); } } return(buentity); }
internal static OpeningFixedAssetEntryModel FromDataTransferObject(OpeningFixedAssetEntryEntity entity) { return(entity == null ? null : AutoMapper.Mapper.Map <OpeningFixedAssetEntryEntity, OpeningFixedAssetEntryModel>(entity)); }
public OpeningFixedAssetResponse DeleteOpeningFixedAssetEntry( OpeningFixedAssetEntryEntity openingFixedAssetEntity) { var openingFixedAssetEntryResponse = new OpeningFixedAssetResponse { Acknowledge = AcknowledgeType.Success }; using (var scope = new TransactionScope()) { if (openingFixedAssetEntity != null) { //.Delete OpeningFixedEntry by FixedAssetId AutoMapper(DeleteOpeningFixedAssetEntry(openingFixedAssetEntity.FixedAssetId), openingFixedAssetEntryResponse); //AutoMapper(DeleteFixAssetLedger(openingFixedAssetEntity.RefId, openingFixedAssetEntity.RefType), openingFixedAssetEntryResponse); //AutoMapper(DeleteOriginalLedger(openingFixedAssetEntity.RefId), openingFixedAssetEntryResponse); #region Delete Entity AutoMapper(DeleteGeneralLedger(openingFixedAssetEntity.RefId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(DeleteOriginalLedger(openingFixedAssetEntity.RefId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(DeleteFixAssetLedger(openingFixedAssetEntity.RefId, openingFixedAssetEntity.RefType), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } #endregion #region Delete OriginalLedger //AnhNT: Xóa theo cách mới (phù hợp với kiểu lưu mới) AutoMapper( DeleteOriginalLedgerByReftypeRefNo(openingFixedAssetEntity.RefType.ToString(), openingFixedAssetEntity.FixedAssetCode), openingFixedAssetEntryResponse); //AnhNT: Xóa theo cách cũ (dành cho DB của khách hàng đang hoạt động) AutoMapper(DeleteOriginalLedger(openingFixedAssetEntity.FixedAssetId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } #endregion #region Delete General Ledger AutoMapper(DeleteGeneralLedger(openingFixedAssetEntity.FixedAssetId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } #endregion #region Delete FixAsset Ledger AutoMapper( DeleteFixAssetLedger603(openingFixedAssetEntity.FixedAssetId, openingFixedAssetEntity.RefType), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } #endregion #region Error Error: if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { openingFixedAssetEntryResponse.RefId = openingFixedAssetEntity.RefId; openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; scope.Dispose(); return(openingFixedAssetEntryResponse); } scope.Complete(); #endregion } } return(openingFixedAssetEntryResponse); }
public OpeningFixedAssetResponse UpdateOpeningFixedAssetEntry( OpeningFixedAssetEntryEntity openingFixedAssetEntity) { var openingFixedAssetEntryResponse = new OpeningFixedAssetResponse { Acknowledge = AcknowledgeType.Success }; using (var scope = new TransactionScope()) { if (openingFixedAssetEntity != null) { //.Delete OpeningFixedEntry by FixedAssetId AutoMapper(DeleteOpeningFixedAssetEntry(openingFixedAssetEntity.FixedAssetId), openingFixedAssetEntryResponse); //AutoMapper(DeleteFixAssetLedger(openingFixedAssetEntity.RefId, openingFixedAssetEntity.RefType), openingFixedAssetEntryResponse); //AutoMapper(DeleteOriginalLedger(openingFixedAssetEntity.RefId), openingFixedAssetEntryResponse); #region Insert Entity if (string.IsNullOrEmpty(openingFixedAssetEntity.RefId)) { openingFixedAssetEntity.RefId = Guid.NewGuid().ToString(); } else { AutoMapper(DeleteGeneralLedger(openingFixedAssetEntity.RefId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(DeleteOriginalLedger(openingFixedAssetEntity.RefId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(DeleteFixAssetLedger(openingFixedAssetEntity.RefId, openingFixedAssetEntity.RefType), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } } if (!openingFixedAssetEntity.Validate()) { foreach (string error in openingFixedAssetEntity.ValidationErrors) { openingFixedAssetEntryResponse.Message += error + Environment.NewLine; } openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; return(openingFixedAssetEntryResponse); } openingFixedAssetEntryResponse.Message = OpeningFixedAssetEntryDao.InsertOpeningFixedAssetEntry(openingFixedAssetEntity); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; return(openingFixedAssetEntryResponse); } openingFixedAssetEntryResponse.RefId = openingFixedAssetEntity.RefId; #endregion #region Insert OriginalLedger //AnhNT: Xóa theo cách mới (phù hợp với kiểu lưu mới) AutoMapper( DeleteOriginalLedgerByReftypeRefNo(openingFixedAssetEntity.RefType.ToString(), openingFixedAssetEntity.FixedAssetCode), openingFixedAssetEntryResponse); //AnhNT: Xóa theo cách cũ (dành cho DB của khách hàng đang hoạt động) AutoMapper(DeleteOriginalLedger(openingFixedAssetEntity.FixedAssetId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(InsertOriginalLedger(openingFixedAssetEntity), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; return(openingFixedAssetEntryResponse); } #endregion #region Insert General Ledger AutoMapper(DeleteGeneralLedger(openingFixedAssetEntity.FixedAssetId), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(InsertGeneralLedger(openingFixedAssetEntity), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; return(openingFixedAssetEntryResponse); } #endregion #region Insert FixAsset Ledger AutoMapper( DeleteFixAssetLedger603(openingFixedAssetEntity.FixedAssetId, openingFixedAssetEntity.RefType), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { goto Error; } AutoMapper(InsertFixAssetLedger(openingFixedAssetEntity), openingFixedAssetEntryResponse); if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; return(openingFixedAssetEntryResponse); } #endregion #region Error Error: if (!string.IsNullOrEmpty(openingFixedAssetEntryResponse.Message)) { openingFixedAssetEntryResponse.RefId = openingFixedAssetEntity.RefId; openingFixedAssetEntryResponse.Acknowledge = AcknowledgeType.Failure; scope.Dispose(); return(openingFixedAssetEntryResponse); } scope.Complete(); #endregion } } return(openingFixedAssetEntryResponse); }
/// <summary> /// Updates the opening account entry. /// </summary> /// <param name="openingFixedAssetEntryEntity">The opening account entry entity.</param> /// <returns>System.String.</returns> /// <exception cref="System.NotImplementedException"></exception> public string UpdateOpeningFixedAssetEntry(OpeningFixedAssetEntryEntity openingFixedAssetEntryEntity) { const string sql = @"upsUpdate_OpeningFixedAssetEntry"; return(Db.Update(sql, true, Take(openingFixedAssetEntryEntity))); }
/// <summary> /// Inserts the opening account entry. /// </summary> /// <param name="openingFixedAssetEntryEntity">The opening account entry entity.</param> /// <returns>System.Int64.</returns> /// <exception cref="System.NotImplementedException"></exception> public string InsertOpeningFixedAssetEntry(OpeningFixedAssetEntryEntity openingFixedAssetEntryEntity) { const string sql = @"uspInsert_OpeningFixedAssetEntry"; return(Db.Insert(sql, true, Take(openingFixedAssetEntryEntity))); }