public string DeleteGLVoucherList(GLVoucherListEntity glVoucherList) { const string sql = @"uspDelete_GlVoucherList"; object[] parms = { "@RefID", glVoucherList.RefId }; return(Db.Delete(sql, true, parms)); }
private static object[] Take(GLVoucherListEntity gLVoucherListEntity) { return(new object[] { "@RefID", gLVoucherListEntity.RefId, "@RefType", gLVoucherListEntity.RefType, "@RefDate", gLVoucherListEntity.RefDate, "@RefNo", gLVoucherListEntity.RefNo, "@VoucherTypeID", gLVoucherListEntity.VoucherTypeId, "@SetupType", gLVoucherListEntity.SetupType, "@Description", gLVoucherListEntity.Description, "@TotalAmount", gLVoucherListEntity.TotalAmount, "@EditVersion", gLVoucherListEntity.EditVersion, }); }
//private List<BankInfo> banks; public List <GLVoucherListEntity> GetGLVoucherLists(string connectionString) { List <GLVoucherListEntity> buentity = new List <GLVoucherListEntity>(); using (var context = new MISAEntity(connectionString)) { var querry = context.GLVoucherListDetails.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.GLVoucherLists.ToList(); //var fixedasset = context.FixedAssets.ToList(); //var inventoryitems = context.InventoryItems.ToList(); //var stocks = context.Stocks.ToList(); //Detail var vouchertype = context.VoucherTypes.ToList(); foreach (var result in resultcontext) { var newresult = new GLVoucherListEntity(); newresult.RefId = result.RefID.ToString(); newresult.RefType = ConvRefType.ConvRefType(result.RefType); newresult.RefDate = result.RefDate; newresult.RefNo = result.RefNo; newresult.VoucherTypeId = result.VoucherType == null ? null : result.VoucherType.VoucherTypeID.ToString(); newresult.SetupType = result.SetupType ?? 0; newresult.FromDate = result.FromDate ?? result.RefDate; newresult.ToDate = result.ToDate ?? result.RefDate; newresult.Description = result.Description; newresult.TotalAmount = result.TotalAmount; newresult.EditVersion = result.EditVersion ?? 0; newresult.GlVoucherListDetails = result.GLVoucherListDetails.Count <= 0 ? null : GLVoucherListDetails(result.GLVoucherListDetails.ToList(), result.RefID.ToString()); buentity.Add(newresult); } } return(buentity); }
public GLVoucherListResponse InsertGLVoucherList(GLVoucherListEntity glVoucherListEntity) { var response = new GLVoucherListResponse { Acknowledge = AcknowledgeType.Success }; try { if (!glVoucherListEntity.Validate()) { foreach (var error in glVoucherListEntity.ValidationErrors) { response.Message += error + Environment.NewLine; } response.Acknowledge = AcknowledgeType.Failure; return(response); } using (var scope = new TransactionScope()) { var faDepreciation = GlVoucherListDao.GetGLVoucherListByRefNo(glVoucherListEntity.RefNo.Trim(), glVoucherListEntity.RefDate); if (faDepreciation != null && faDepreciation.RefDate.Year == glVoucherListEntity.RefDate.Year) { response.Acknowledge = AcknowledgeType.Failure; response.Message = @"Số chứng từ " + glVoucherListEntity.RefNo + @" đã tồn tại !"; return(response); } glVoucherListEntity.RefId = Guid.NewGuid().ToString(); response.Message = GlVoucherListDao.InsertGLVoucherList(glVoucherListEntity); if (!string.IsNullOrEmpty(response.Message)) { response.Acknowledge = AcknowledgeType.Failure; return(response); } #region Insert detail if (glVoucherListEntity.GlVoucherListDetails != null) { foreach (var glVoucherListDetail in glVoucherListEntity.GlVoucherListDetails) { glVoucherListDetail.RefDetailId = Guid.NewGuid().ToString(); glVoucherListDetail.RefId = glVoucherListEntity.RefId; response.Message = GlVoucherListDetailDao.InsertGLVoucherListDetail(glVoucherListDetail); if (!string.IsNullOrEmpty(response.Message)) { response.Acknowledge = AcknowledgeType.Failure; return(response); } } } #endregion scope.Complete(); } response.RefId = glVoucherListEntity.RefId; return(response); } catch (Exception ex) { response.Message = ex.Message; return(response); } }
public string InsertGLVoucherList(GLVoucherListEntity glVoucherList) { const string sql = @"uspInsert_GLVoucherList"; return(Db.Insert(sql, true, Take(glVoucherList))); }
public string UpdateGLVoucherList(GLVoucherListEntity glVoucherList) { const string sql = @"uspUpdate_GLVoucherList"; return(Db.Update(sql, true, Take(glVoucherList))); }