/// <summary> /// Deletes the specified object. /// </summary> /// <param name="voucherListEntity">The voucher list entity.</param> /// <returns></returns> public string DeleteVoucherList(VoucherListEntity voucherListEntity) { const string sql = @"uspDelete_VoucherList"; object[] parms = { "@VoucherListID", voucherListEntity.VoucherListId }; return(Db.Delete(sql, true, parms)); }
/// <summary> /// Takes the specified budget source property. /// </summary> /// <param name="voucherList">The voucherList.</param> /// <returns></returns> private static object[] Take(VoucherListEntity voucherList) { return(new object[] { "@VoucherListID", voucherList.VoucherListId, "@VoucherListCode", voucherList.VoucherListCode, "@VoucherDate", voucherList.VoucherDate, "@PostDate", voucherList.PostDate, "@Description", voucherList.Description, "@DocAttach", voucherList.DocAttach }); }
/// <summary> /// Takes the specified budget source property. /// </summary> /// <param name="voucherList">The voucherList.</param> /// <returns></returns> private static object[] Take(VoucherListEntity voucherList) { return(new object[] { "@VoucherListID", voucherList.VoucherListId, "@VoucherListCode", voucherList.VoucherListCode, "@VoucherListName", voucherList.VoucherListName, "@FromDate", voucherList.FromDate, "@ToDate", voucherList.ToDate, "@DocumentAttached", voucherList.DocumentAttached, "@Description", voucherList.Description, "@IsActive", voucherList.IsActive }); }
/// <summary> /// Updates the account category. /// </summary> /// <param name="voucherListEntity">The automatic business entity.</param> /// <returns> /// AccountCategoryResponse. /// </returns> public VoucherListResponse UpdateVoucherList(VoucherListEntity voucherListEntity) { var response = new VoucherListResponse { Acknowledge = AcknowledgeType.Success }; try { if (!voucherListEntity.Validate()) { foreach (string error in voucherListEntity.ValidationErrors) { response.Message += error + Environment.NewLine; } response.Acknowledge = AcknowledgeType.Failure; return(response); } var voucherList = VoucherListDao.GetVoucherListsByCode(voucherListEntity.VoucherListCode.Trim()); if (voucherList != null) { if (voucherList.VoucherListId != voucherListEntity.VoucherListId) { response.Acknowledge = AcknowledgeType.Failure; response.Message = @"Số chứng từ ghi sổ " + voucherListEntity.VoucherListCode.Trim() + @" đã tồn tại !"; return(response); } } response.Message = VoucherListDao.UpdateVoucherList(voucherListEntity); if (!string.IsNullOrEmpty(response.Message)) { response.Acknowledge = AcknowledgeType.Failure; return(response); } response.VoucherListId = voucherListEntity.VoucherListId; return(response); } catch (Exception ex) { response.Message = ex.Message; return(response); } }
/// <summary> /// Updates the specified object. /// </summary> /// <param name="voucherListEntity">The voucher list entity.</param> /// <returns></returns> public string UpdateVoucherList(VoucherListEntity voucherListEntity) { const string sql = @"uspUpdate_VoucherList"; return(Db.Update(sql, true, Take(voucherListEntity))); }
/// <summary> /// Inserts the specified object. /// </summary> /// <param name="voucherListEntity">The voucher list entity.</param> /// <returns></returns> public int InsertVoucherList(VoucherListEntity voucherListEntity) { const string sql = @"uspInsert_VoucherList"; return(Db.Insert(sql, true, Take(voucherListEntity))); }