/// <summary> /// Updates the specified fixed asset detail accessory entity. /// </summary> /// <param name="fixedAssetDetailAccessoryEntity">The fixed asset detail accessory entity.</param> /// <returns></returns> public FixedAssetDetailAccessoryResponse Update(FixedAssetDetailAccessoryEntity fixedAssetDetailAccessoryEntity) { var response = new FixedAssetDetailAccessoryResponse { Acknowledge = AcknowledgeType.Success }; try { if (!fixedAssetDetailAccessoryEntity.Validate()) { foreach (string error in fixedAssetDetailAccessoryEntity.ValidationErrors) { response.Message += error + Environment.NewLine; } response.Acknowledge = AcknowledgeType.Failure; return(response); } response.Message = FixedAssetDetailAccessoryDao.UpdateFixedAssetDetailAccessory(fixedAssetDetailAccessoryEntity); return(response); } catch (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = ex.Message; return(response); } }
/// <summary> /// Takes the specified fixed asset detail accessory entity. /// </summary> /// <param name="entity">The fixed asset detail accessory entity.</param> /// <returns></returns> private static object[] Take(FixedAssetDetailAccessoryEntity entity) { return(new object[] { "@FixedAssetDetailAccessoryID", entity.FixedAssetDetailAccessoryId, "@FixedAssetID", entity.FixedAssetId, "@Description", entity.Description, "@Unit", entity.Unit, "@Quantity", entity.Quantity, "@Amount", entity.Amount, "@SortOrder", entity.SortOrder }); }
/// <summary> /// Updates the fixed asset detail accessory. /// </summary> /// <param name="fixedAssetDetailAccessory">The fixed asset detail accessory.</param> /// <returns></returns> public string UpdateFixedAssetDetailAccessory(FixedAssetDetailAccessoryEntity fixedAssetDetailAccessory) { const string sql = "uspUpdate_FixedAssetDetailAccessory"; return(Db.Insert(sql, true, Take(fixedAssetDetailAccessory))); }